Ejemplo n.º 1
0
    void Attack()
    {
        if (player != null)
        {
            if (Vector3.Distance(player.transform.position, transform.position) < 125.0f)
            {
                tankAim.Aim(player.transform.position);

                Vector3 aimDirection = (player.transform.position - tankAim.transform.position);
                if (Mathf.Abs(Vector3.Distance(GetComponentInChildren <BarrelPivot>().transform.forward, aimDirection.normalized)) < 0.1f)
                {
                    tankAim.Fire();
                }
            }
            else
            {
                tankAim.Aim(randomDirection);
            }
        }
    }
    private void FixedUpdate()
    {
        InputMovement();

        aimingComponent.Aim(target);
    }