public void PlayAnim(AnimationsType type) { if (_animator) { _animator.Play(clips[(int)type]._clip.name); } }
private void PlayAnimationClip(AnimationsType m_animationsType) { switch (m_animationsType) { //case AnimationsType.nextCell: // m_animator.SetTrigger(m_animations[AnimationsType.nextCell]); // break; case AnimationsType.playContent: m_animator.SetTrigger(m_animations[AnimationsType.playContent]); break; } }
/// <summary> /// Animation control Switch /// </summary> private void PlayAnimation(AnimationsType type) { //Set previous _previousAnimation = _currentAnimation; //Set text. description.text = "Playing Animation " + type; //set next. _currentAnimation = type; //Activate animation maleAnimator.SetBool(GetAnimationHash(_previousAnimation), false); femaleAnimator.SetBool(GetAnimationHash(_previousAnimation), false); maleAnimator.SetBool(GetAnimationHash(_currentAnimation), true); femaleAnimator.SetBool(GetAnimationHash(_currentAnimation), true); }
/// <summary> /// Awake the instance . /// </summary> private void Awake() { //Single tone . if (animationControlReference == null) { animationControlReference = this; } //animation list count . _animationListCount = animationsTypeList.Count; //Set up idle animation. _previousAnimation = _currentAnimation = _defaultState = AnimationsType.Idle; //play default. PlayAnimation(_defaultState); }
/// <summary> /// Get Animation hash. /// </summary> /// <returns></returns> private int GetAnimationHash(AnimationsType type) { switch (type) { case AnimationsType.Idle: return(Idle); case AnimationsType.Walk: return(Walk); case AnimationsType.Kick: return(Kick); case AnimationsType.Run: return(Run); case AnimationsType.Dance: return(Dance); default: throw new ArgumentOutOfRangeException("type", type, null); } }
public void StartAnimation(AnimationsType animationType, int decresePoints = 0) { GetImages(); StartComponents(); switch (animationType) { case AnimationsType.AttackingAndAttackedLost: trigger = "BothLose"; break; case AnimationsType.None: trigger = "None"; break; case AnimationsType.AttackingWinsAttacked: trigger = GameManager.mainPlayerTurn ? "Player1_Wins" : "Player2_Wins"; currentText = GameManager.mainPlayerTurn ? decreasePlayer2 : decreasePlayer1; currentText.text = "-" + decresePoints.ToString(); break; case AnimationsType.AttackingFailsAttacked: trigger = GameManager.mainPlayerTurn ? "Player1_Lose_Defense" : "Player2_Lose_Defense"; currentText = GameManager.mainPlayerTurn ? decreasePlayer1 : decreasePlayer2; currentText.text = "-" + decresePoints.ToString(); break; case AnimationsType.AttackingLostAttacked: trigger = GameManager.mainPlayerTurn ? "Player1_Lose_Attack" : "Player2_Lose_Attack"; currentText = GameManager.mainPlayerTurn ? decreasePlayer1 : decreasePlayer2; currentText.text = "-" + decresePoints.ToString(); break; } animator.SetTrigger(trigger); }