Beispiel #1
0
 private void OnTriggerStay(Collider other)
 {
     if (other.CompareTag(Tags.Pirate))
     {
         GameObject victim = Inventory.GetItem(VictimKey);
         if (!victim || Vector3.Distance(transform.position, victim.transform.position) > Vector3.Distance(transform.position, other.transform.position))
         {
             // Check if the pirate is attacking someone
             GAgent otherAgent = other.GetComponent <GAgent>();
             if (otherAgent.Inventory.GetItem(VictimKey) != null)
             {
                 Inventory.AddItem(VictimKey, other.gameObject);
                 Beliefs.SetState(FoundVictimKey, 1);
             }
         }
     }
 }
Beispiel #2
0
    private void OnTriggerStay(Collider other)
    {
        if (other.CompareTag(Tags.Victim))
        {
            GameObject victim = Inventory.GetItem(VictimKey);
            if (!victim || Vector3.Distance(transform.position, victim.transform.position) > Vector3.Distance(transform.position, other.transform.position))
            {
                Inventory.AddItem(VictimKey, other.gameObject);
                Beliefs.SetState(FoundVictimKey, 1);
            }
        }

        if (other.CompareTag(Tags.Cargo))
        {
            Inventory.AddItem(CargoKey, other.gameObject);
            Beliefs.SetState(CanSeeCargoKey, 1);
        }
    }