Exemplo n.º 1
0
        private void GetMovementInput()
        {
            // Vector2 input = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));

            horizontal = Input.GetAxis("Horizontal");
            vertical   = Input.GetAxis("Vertical");

            OnMovementInput?.Invoke(horizontal, vertical);
        }
Exemplo n.º 2
0
 void Update()
 {
     playerDetectionResult = DetectPlayer();
     if (playerDetectionResult)
     {
         var directionToPlayer = playerTransform.position - transform.position;
         directionToPlayer = Vector3.Scale(directionToPlayer, Vector3.forward + Vector3.right);
         if (directionToPlayer.magnitude > stoppingDistance)
         {
             directionToPlayer.Normalize();
             OnMovementInput?.Invoke(Vector2.up);
             OnMovementDirectionInput?.Invoke(directionToPlayer);
             return;
         }
         playerHealth.TakeDamage(3);
     }
     OnMovementInput?.Invoke(Vector2.zero);
     OnMovementDirectionInput?.Invoke(transform.forward);
 }
Exemplo n.º 3
0
    void GetMovementInput()
    {
        Vector2 input = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));

        OnMovementInput?.Invoke(input);
    }