示例#1
0
        AnimationClip GetAnimClipFromMovePos(EPlayerMovementPosition _movePos)
        {
            switch (_movePos)
            {
            case EPlayerMovementPosition.LowerLeft:
                return(LowerLeftClip);

            case EPlayerMovementPosition.Left:
                return(LeftClip);

            case EPlayerMovementPosition.UpperLeft:
                return(UpperLeftClip);

            case EPlayerMovementPosition.LowerRight:
                return(LowerRightClip);

            case EPlayerMovementPosition.Right:
                return(RightClip);

            case EPlayerMovementPosition.UpperRight:
                return(UpperRightClip);

            default:
                return(null);
            }
        }
示例#2
0
        string GetAnimTriggerFromMovePos(EPlayerMovementPosition _movePos)
        {
            switch (_movePos)
            {
            case EPlayerMovementPosition.LowerLeft:
                return(LowerLeftTrigger);

            case EPlayerMovementPosition.Left:
                return(LeftTrigger);

            case EPlayerMovementPosition.UpperLeft:
                return(UpperLeftTrigger);

            case EPlayerMovementPosition.LowerRight:
                return(LowerRightTrigger);

            case EPlayerMovementPosition.Right:
                return(RightTrigger);

            case EPlayerMovementPosition.UpperRight:
                return(UpperRightTrigger);

            default:
                return(null);
            }
        }
 public void CallOnPlayerMoveEnd(EPlayerMovementPosition _movePos)
 {
     _bPlayerIsMoving = false;
     if (OnPlayerMoveEnd != null)
     {
         OnPlayerMoveEnd(_movePos);
     }
 }
 public void CallOnPlayerMoveStart(EPlayerMovementPosition _movePos)
 {
     _bPlayerIsMoving = true;
     if (OnPlayerMoveStart != null)
     {
         OnPlayerMoveStart(_movePos);
     }
 }
示例#5
0
        void StartPlayingAnimation(EPlayerMovementPosition _movePos)
        {
            if (bHasAnimClips == false)
            {
                Debug.LogError("No Animation Clips On Player Animations");
                return;
            }

            myAnimator.SetBool(IsMovingAnimParameter, true);
            StartCoroutine(PlayAnimationCoroutine(_movePos));
        }
示例#6
0
        IEnumerator PlayAnimationCoroutine(EPlayerMovementPosition _movePos)
        {
            var _clip    = GetAnimClipFromMovePos(_movePos);
            var _trigger = GetAnimTriggerFromMovePos(_movePos);

            if (_clip != null)
            {
                myAnimator.SetTrigger(_trigger);
                yield return(new WaitForSeconds(
                                 Mathf.Min(_clip.length, longestAnimationTimeInSeconds)));
            }
            myEventHandler.CallOnPlayerMoveEnd(_movePos);
        }
示例#7
0
        void OnPlayerEndMove(EPlayerMovementPosition _movePos)
        {
            switch (_movePos)
            {
            case EPlayerMovementPosition.LowerLeft:
                this.transform.position = this.transform.position +
                                          new Vector3(-MovementSpeed, -MovementSpeed, 0);
                break;

            case EPlayerMovementPosition.Left:
                this.transform.position = this.transform.position +
                                          new Vector3(-MovementSpeed, 0, 0);
                break;

            case EPlayerMovementPosition.UpperLeft:
                this.transform.position = this.transform.position +
                                          new Vector3(-MovementSpeed, MovementSpeed, 0);
                break;

            case EPlayerMovementPosition.LowerRight:
                this.transform.position = this.transform.position +
                                          new Vector3(MovementSpeed, -MovementSpeed, 0);
                break;

            case EPlayerMovementPosition.Right:
                this.transform.position = this.transform.position +
                                          new Vector3(MovementSpeed, 0, 0);
                break;

            case EPlayerMovementPosition.UpperRight:
                this.transform.position = this.transform.position +
                                          new Vector3(MovementSpeed, MovementSpeed, 0);
                break;

            default:
                break;
            }
        }
示例#8
0
 void OnStopMoving(EPlayerMovementPosition _movePos)
 {
     myAnimator.SetBool(IsMovingAnimParameter, false);
     myAnimator.SetTrigger(IdleTrigger);
 }
示例#9
0
 void OnPlayerMove(EPlayerMovementPosition _movePos)
 {
     myAudioSource.clip = JumpSound;
     myAudioSource.Play();
 }