using UnityEngine; /// /// A selectable player pose: an idle held while the player stands still, /// plus optional walk and run clips that the pose system plays itself (the Animator stays empty) while /// moving on the ground, and a y-offset applied to the visual model only while stuck to the ceiling /// (so the pose hangs at the right height). The first ScriptableObject in this project. /// /// Named PlayerPose (not Pose) to avoid shadowing the built-in UnityEngine.Pose struct, mirroring /// why the controller is PlayerCharacterController and not just "PlayerController". /// [CreateAssetMenu(fileName = "NewPose", menuName = "Chameleon/Pose")] public class PlayerPose : ScriptableObject { [Tooltip("Clip held while the player is idle in this pose (looped if the clip itself loops, " + "otherwise frozen on its last frame). Authored for the paintman generic rig; clips for " + "other hierarchies will not retarget.")] [SerializeField] private AnimationClip clip; [Tooltip("Playback speed multiplier for the idle clip. 1 = authored speed.")] [Range(0.1f, 3f)] [SerializeField] private float clipSpeed = 1f; [Tooltip("Optional. Played instead of the idle clip while walking on the ground (moving, not " + "sprinting). Leave empty to keep holding the idle pose while walking. Should loop.")] [SerializeField] private AnimationClip walkClip; [Tooltip("Playback speed multiplier for the walk clip. 1 = authored speed.")] [Range(0.1f, 3f)] [SerializeField] private float walkClipSpeed = 1f; [Tooltip("Optional. Played instead of the idle clip while sprinting on the ground. Leave empty to " + "keep holding the idle pose while sprinting. Should loop.")] [SerializeField] private AnimationClip runClip; [Tooltip("Playback speed multiplier for the run clip. 1 = authored speed.")] [Range(0.1f, 3f)] [SerializeField] private float runClipSpeed = 1f; [Tooltip("Local-up offset added to the visual model ONLY while stuck to the ceiling, so the pose " + "hangs at the right height. Ignored on the ground and on walls. Meters.")] [SerializeField] private float ceilingYOffset; [Tooltip("Local-up offset applied to the camera target (the ThirdPersonCamera's follow/look target) " + "while this pose is active, in ANY state. Frames the pose by raising/lowering what the camera " + "tracks, without moving the body. The ceiling offset is added on top of this while on the " + "ceiling. Meters.")] [SerializeField] private float cameraTargetYOffset; /// Idle clip held while the player stands still in this pose (may be null). public AnimationClip Clip => clip; /// Playback speed multiplier for the idle clip (1 = authored speed). public float ClipSpeed => clipSpeed; /// Optional clip played while walking on the ground; null = hold the idle pose. public AnimationClip WalkClip => walkClip; /// Playback speed multiplier for the walk clip (1 = authored speed). public float WalkClipSpeed => walkClipSpeed; /// Optional clip played while sprinting on the ground; null = hold the idle pose. public AnimationClip RunClip => runClip; /// Playback speed multiplier for the run clip (1 = authored speed). public float RunClipSpeed => runClipSpeed; /// Local-up offset applied to the model only while on the ceiling. public float CeilingYOffset => ceilingYOffset; /// Local-up offset applied to the camera target while this pose is active (any state). public float CameraTargetYOffset => cameraTargetYOffset; }