Beispiel #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag(JUMP_PLACE_TAG))
     {
         currentState = BouncingManState.ReadyToJump;
     }
 }
Beispiel #2
0
    public void JumpToPosition(Vector3 clickPosition)
    {
        jumpPosition = new Vector3(clickPosition.x, transform.position.y, transform.position.z);
        if (currentState == BouncingManState.ReadyToJump)
        {
            ScoreContoller.IncreaseScore();
            SettingsController.SetNextJumpSetting();
            currentState = BouncingManState.Jumping;
            animator.SetTrigger(JUMP_TRIGGER);

            float jumpDuration = Vector3.Distance(transform.position, jumpPosition) / BouncingManJumpSpeed;
            transform.DOJump(jumpPosition, SettingsController.CurrentJumpSetting.JumpHeight, 1, jumpDuration).AppendCallback(delegate
            {
                OnJumpEnded();
            });
        }
    }
Beispiel #3
0
 private void OnJumpEnded()
 {
     currentState = BouncingManState.Run;
 }
Beispiel #4
0
 private void Restart()
 {
     currentState       = BouncingManState.Run;
     transform.position = startPosition;
 }
Beispiel #5
0
 public void LoadSaveData(BouncingManSaveData savedata)
 {
     currentState       = savedata.State;
     transform.position = savedata.Position;
 }