Example #1
0
    private void CheckForCorpses()
    {
        // Listen to wounded units before inspecting bodies
        List <GameObject> woundedList = ObjectContainer.GetAllWounded();

        foreach (GameObject wounded in woundedList)
        {
            if (woundedSeen.IndexOf(wounded) == -1 && CanSeePoint(wounded.transform.position))
            {
                SoundToPosition(wounded.GetComponent <HideMover>().lastSawPlayer, true, Noise.Source.Gun, Vector2.zero);
                SetAwareness(State.Suspicious);
                canInspectBodies = false; // Don't get distracted by other things
                woundedSeen.Add(wounded);
                return;
            }
        }

        List <GameObject> corpseList = ObjectContainer.GetAllCorpses();

        foreach (GameObject corpse in corpseList)
        {
            // If the corpse hasn't been seen yet but the enemy can see it
            if (canInspectBodies && corpsesSeen.IndexOf(corpse) == -1 && CanSeePoint(corpse.transform.position))
            {
                VisualToPosition(corpse.transform.position);
                SetAwareness(State.Suspicious);
                corpsesSeen.Add(corpse);
            }
        }
    }