Esempio n. 1
0
    private void ControlTripulant()
    {
        Vector2 directionalInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        controlledTripulant.SetDirectionalInput(directionalInput);

        if (Input.GetButtonDown("Jump"))
        {
            controlledTripulant.OnJumpInputDown();
        }

        else if (Input.GetButton("Jump"))
        {
            controlledTripulant.Falling();
        }

        if (Input.GetButtonUp("Jump"))
        {
            controlledTripulant.OnJumpInputUp();
        }
    }
Esempio n. 2
0
    void Chase()
    {
        Vector3 dir = enemy.target.position - enemy.transform.position;

        dir.z = 0.0f;

        if (dir != Vector3.zero)
        {
            enemy.transform.rotation = Quaternion.Slerp(enemy.transform.rotation,
                                                        Quaternion.FromToRotation(Vector3.right, dir), rotationSpeed * Time.deltaTime);
        }

        //enemy.transform.position += (enemy.target.position - enemy.transform.position).normalized * enemy.moveSpeed * Time.deltaTime;
        Vector3 moveDir = (enemy.target.position - enemy.transform.position).normalized;

        theController.SetDirectionalInput(moveDir);

        if (Vector3.Distance(enemy.transform.position, enemy.target.position) < 1f)
        {
            Debug.Log("Dead");
        }
    }
Esempio n. 3
0
 public void ToControlledState()
 {
     theController.SetDirectionalInput(new Vector2(0, 0));
     enemy.currentState = enemy.controlledState;
 }