Beispiel #1
0
 private void PerformWeaponAttack()
 {
     if (playerAnimationController != null)
     {
         playerAnimationController.HandleAnimation("PlayerAttack");
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (playerAgent != null && !(playerAgent.pathPending))
     {
         // Key to this check is that stoppingDistance is set to 0 when current destination in not interactable; hence those "clicks" won't call Interact()
         if (Vector3.Distance(playerAgent.destination, playerAgent.transform.position) <= playerAgent.stoppingDistance)
         {
             if (!hasInteracted)
             {
                 Interact();
             }
             if (!playerAgent.hasPath || playerAgent.velocity.sqrMagnitude == 0f)
             {
                 playerAnimationController.HandleAnimation("PlayerIdle");
             }
         }
         else
         {
             playerAnimationController.HandleAnimation("PlayerRunning");
         }
     }
     GetInput();
 }