Ejemplo n.º 1
0
    void OpenDoor(GameObject room)
    {
        RoomController roomController = room.GetComponent <RoomController> ();
        bool           enemies        = roomController.ContainsEnemySpawn();

        if (!enemies)
        {
            foreach (Transform child in room.transform)
            {
                GameObject door = child.gameObject;
                if (door.tag == "Door" && door.name != "DoorSwitchExit")
                {
                    Animator doorAnimator = door.GetComponent <Animator> ();
                    doorAnimator.SetTrigger("Open");
                }
            }
        }
    }