Ejemplo n.º 1
0
    void Update()
    {
        if (hasTarget)
        {
            if (agent.destination != playerPos && Vector3.Distance(transform.position, playerPos) > agent.stoppingDistance)
            {
                agent.SetDestination(playerPos);
            }
            else
            {
                Debug.Log("RATATATA");
                weapon.Attack();
            }

            transform.forward = -(playerPos - transform.position);
        }
    }