Beispiel #1
0
 void OnTriggerEnter(Collider col)
 {
     if (currentEnemy == null) {
         if (col.gameObject.GetComponent<BattleScript>() != null) {
             this.currentEnemy = col.gameObject.GetComponent<HealthSystem>();
             currentEnemy.GetComponent<BattleScript>().attack(GetComponent<HealthSystem>());
             if(!isEnemy) {
                 currentEnemy.GetComponent<PathFinding>().stop();
             }
         }
     }
 }
Beispiel #2
0
    public override void Execute()
    {
        StartReloading();
        HealthSystem hs = tracker.GetRandomTarget <HealthSystem>();

        if (this.GetCharAnimator())
        {
            this.GetCharAnimator().SetTrigger("Attack");
            this.transform.LookAt(hs.transform);
        }
        if (hs != null)
        {
            if (hs.Damage(damage))
            {
                if (favourManager != null)
                {
                    favourManager.AddFavours(favoursOnKill);
                }
                tracker.RemoveTarget(hs.GetComponent <Targetable>());
            }
        }
    }