ACR_CreatureBehavior.CreatureObject.OnPerceptionLostSightObject C# (CSharp) Method

OnPerceptionLostSightObject() private method

Called when an object loses sight of another object.
private OnPerceptionLostSightObject ( uint PerceivedObjectId, bool LastDetection ) : void
PerceivedObjectId uint Supplies the perceived object id. ///
LastDetection bool True if this is the last detection /// method for the perceived object. ///
return void
        private void OnPerceptionLostSightObject(uint PerceivedObjectId,
            bool LastDetection)
        {
            if (Party == null) return; // Creature hasn't initialized as spawned yet; thus, there's nothing
                                       // tracked as already existing.
            if (Script.GetObjectType(PerceivedObjectId) != CLRScriptBase.OBJECT_TYPE_CREATURE) return;
            CreatureObject SeenObject = Server.ObjectManager.GetCreatureObject(PerceivedObjectId, true);

//===== If we've actually lost this creature, we need to populate missing lists. ====//
            if (LastDetection)
            {
                int nReputation = Script.GetReputation(this.ObjectId, PerceivedObjectId);

                if (nReputation < 11)
                {
                    if (!Party.EnemiesLost.Contains(SeenObject))
                    {
                        if (!Party.CanPartyHear(SeenObject) && !Party.CanPartySee(SeenObject))
                        {
                            Party.RemovePartyEnemy(SeenObject);
                            Party.EnemiesLost.Add(SeenObject);
                        }
                    }
                }
            }          
        }