public override bool PrePerform()
    {
        GameObject victim = Inventory.GetItem(VictimKey);

        if (victim)
        {
            if (victim.activeSelf)
            {
                if ((Time.time - mLastAttack) > TimeBetweenAttacks)
                {
                    Health health = victim.GetComponent <Health>();
                    health.ReduceHealth(Damage);
                    if (health.CurrentAmount <= 0)
                    {
                        Loot loot = victim.GetComponent <Loot>();
                        if (loot && mCargo)
                        {
                            mCargo.Add(loot.Value);
                        }

                        victim.gameObject.SetActive(false);
                    }
                    mLastAttack = Time.time;
                }
            }

            if (!victim.activeSelf)
            {
                Inventory.RemoveItem(VictimKey);
                Beliefs.RemoveState(FoundVictimKey);
            }
        }

        return(false);
    }
Beispiel #2
0
 private void OnTriggerExit(Collider other)
 {
     if (other.CompareTag(Tags.Victim))
     {
         GameObject victim = Inventory.GetItem(VictimKey);
         if (victim == other.gameObject)
         {
             Inventory.RemoveItem(VictimKey);
             Beliefs.RemoveState(FoundVictimKey);
         }
     }
 }
Beispiel #3
0
 public override bool PrePerform()
 {
     mVictim = Inventory.GetItem(VictimKey);
     if (mVictim)
     {
         Target = mVictim;
         return(base.PrePerform());
     }
     else
     {
         Beliefs.RemoveState(FoundVictimKey);
         return(false);
     }
 }
Beispiel #4
0
 public override bool PostPerform()
 {
     Beliefs.RemoveState("Exhausted");
     return(true);
 }
 public override bool PostPerform()
 {
     Inventory.RemoveItem(CargoKey);
     Beliefs.RemoveState(CanSeeCargoKey);
     return(base.PostPerform());
 }