void SetAnimation(string animaitonName) { if (currentPlayingAnimation != animaitonName) { uAnimator.Play(animaitonName); currentPlayingAnimation = animaitonName; if (_state.Equals(_State.TRANSITION_BACK)) { uAnimator.Time = uAnimator.Length; } } }
void AttackAndRetreat() { if (_state.Equals(_State.ATTACK) || _state.Equals(_State.RETREAT)) { if (currentPlayingAnimation != "attack") { SetAnimation("attack"); } MoveFlower(); if (transform.localPosition.y > 6.49f && _state.Equals(_State.ATTACK)) { _state = _State.RETREAT; } if (transform.localPosition.y < 0 && _state.Equals(_State.RETREAT)) { transform.localPosition = new Vector2(0, 0); _state = _State.TRANSITION_BACK; } } }