Ejemplo n.º 1
0
    public override void Interact()
    {
        base.Interact();
        //attack
        charactercombat playerCombat = PlayerManager.instance.player.GetComponent <charactercombat>();

        if (playerCombat != null)
        {
            playerCombat.Attack(myStats);
        }
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        float distance = Vector3.Distance(target.position, transform.position);

        if (distance <= lookRadius)
        {
            agent.SetDestination(target.position);
            if (distance <= agent.stoppingDistance)
            {
                CharacterStats targetStats = target.GetComponent <CharacterStats>();
                if (targetStats != null)
                {
                    combat.Attack(targetStats);
                }


                FaceTarget();
            }
        }
    }