public void SetAnim(PlayerAnimationType animType) { if (AnimationType == animType) { return; } AnimationType = animType; string clipName = null; switch (animType) { case PlayerAnimationType.Idle: clipName = "Idle"; break; case PlayerAnimationType.Slide: clipName = "Slide"; break; } if (clipName != null) { m_animator.SetTrigger(clipName); } }
public virtual void Start() { pcController = GetComponent <CharacterController>(); animator = GetComponentInChildren <Animator>(); animationType = PlayerAnimationType.NORMAL_IDLE; }
public void ChangeAnimationState(PlayerAnimationType animationtype) { switch (animationtype) { case PlayerAnimationType.idle: animator.ChangeSpriteArray(idleSprites);; break; case PlayerAnimationType.holding: animator.ChangeSpriteArray(holdSprites); break; case PlayerAnimationType.throwNPC: animator.ChangeSpriteArray(throwSprites, false, () => ChangeAnimationState(PlayerAnimationType.idle)); break; } }
void CharacterControl_Slerp() { Vector3 direction = new Vector3(0, 0, 0); animationType = PlayerAnimationType.NORMAL_IDLE; if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.DownArrow)) { direction.x = Input.GetAxis("Horizontal"); direction.z = Input.GetAxis("Vertical"); Vector3 forward = Vector3.Slerp(transform.forward, direction, rotationSpeed * Time.deltaTime / Vector3.Angle(transform.forward, direction)); transform.LookAt(transform.position + forward); animationType = PlayerAnimationType.NORMAL_WALK; } if (Input.GetKeyDown(KeyCode.C)) { jumpPower = jumpSpeed; } if (jumpPower > 0) { jumpPower -= Time.deltaTime * 10; animationType = PlayerAnimationType.NORMAL_JUMP; } else { jumpPower = 0.0f; } Vector3 jump = new Vector3(0, jumpPower, 0); pcController.Move((direction * runSpeed + Physics.gravity + jump) * Time.deltaTime); }
/* * Gets the type of animation it is required to play and plays it */ public void CallAnimationChange(PlayerAnimationType animType) { switch (animType) { case PlayerAnimationType.TRANSITION_IDLE_INTO_STANCETOP: animator.SetTrigger("TransIntoCombat"); break; case PlayerAnimationType.TRANSITION_STANCETOP_INTO_IDLE: animator.SetTrigger("CombatIntoTrans"); break; case PlayerAnimationType.SLICE_FROM_ANY_STANCE: animator.SetTrigger("Slice"); break; case PlayerAnimationType.THRUST_FROM_ANY_STANCE: animator.SetTrigger("Thrust"); break; case PlayerAnimationType.FROM_ATTACK_TO_STANCE: animator.SetTrigger("BackToStance"); break; case PlayerAnimationType.SLICE_SLICE_FROM_ANY_STANCE: animator.SetTrigger("Slice"); break; case PlayerAnimationType.THRUST_SLICE_FROM_ANY_STANCE: animator.SetTrigger("Slice"); break; case PlayerAnimationType.THRUST_THRUST_FROM_ANY_STANCE: animator.SetTrigger("Thrust"); break; case PlayerAnimationType.SLICE_THRUST_FROM_ANY_STANCE: animator.SetTrigger("Thrust"); break; } }
public void SetPlayerAnimationType(PlayerAnimationType _animationType) { animationType = _animationType; animator.SetInteger("AnimationIndex", animationType.GetHashCode()); }
public void PlayAnimation(PlayerAnimationType playerAnimationType) { }
private int DefineTriggerTime(PlayerAnimationType animType, Stance playerStance) { switch (playerStance) { case Stance.TOP: switch (animType) { case PlayerAnimationType.SLICE_FROM_ANY_STANCE: return(0); case PlayerAnimationType.THRUST_FROM_ANY_STANCE: return(0); case PlayerAnimationType.SLICE_SLICE_FROM_ANY_STANCE: return(1); case PlayerAnimationType.THRUST_THRUST_FROM_ANY_STANCE: return(1); case PlayerAnimationType.SLICE_THRUST_FROM_ANY_STANCE: return(2); case PlayerAnimationType.THRUST_SLICE_FROM_ANY_STANCE: return(2); default: return(-1); } case Stance.MIDDLE: switch (animType) { case PlayerAnimationType.SLICE_FROM_ANY_STANCE: return(3); case PlayerAnimationType.THRUST_FROM_ANY_STANCE: return(3); case PlayerAnimationType.SLICE_SLICE_FROM_ANY_STANCE: return(4); case PlayerAnimationType.THRUST_THRUST_FROM_ANY_STANCE: return(4); case PlayerAnimationType.SLICE_THRUST_FROM_ANY_STANCE: return(5); case PlayerAnimationType.THRUST_SLICE_FROM_ANY_STANCE: return(5); default: return(-1); } case Stance.BOTTOM: switch (animType) { case PlayerAnimationType.SLICE_FROM_ANY_STANCE: return(6); case PlayerAnimationType.THRUST_FROM_ANY_STANCE: return(6); case PlayerAnimationType.SLICE_SLICE_FROM_ANY_STANCE: return(7); case PlayerAnimationType.THRUST_THRUST_FROM_ANY_STANCE: return(7); case PlayerAnimationType.SLICE_THRUST_FROM_ANY_STANCE: return(8); case PlayerAnimationType.THRUST_SLICE_FROM_ANY_STANCE: return(8); default: return(-1); } default: return(-1); } }