Example #1
0
    public override void Interact()
    {
        base.Interact();
        _CharacterCombat combat = playerGb.GetComponent <_CharacterCombat> ();

        if (combat != null)
        {
            combat.Attack(myStats);
        }
    }
Example #2
0
    void Update()
    {
        float distance = Vector3.Distance(transform.position, player.position);

        if (distance <= lookRadius)
        {
            agent.SetDestination(player.position);
            if (distance <= agent.stoppingDistance)
            {
                _CharacterStat targetStat = player.GetComponent <_CharacterStat> ();
                if (targetStat != null)
                {
                    combat.Attack(targetStat);
                }
                FaceToTarget();
            }
        }
    }