void Start()
        {
            Room entranceHall = new Room("Entrance Hall");
            Room eastHall = (new Room("East Hall"));
            Room westHall = (new Room("West Hall"));
            Room diningRoom = (new Room("Dining Room"));
            Room study = (new Room("Study"));
            Room kitchen = (new Room("Kitchen"));
            Room livingRoom = (new Room("Living Room"));
            Room eastWashroom = (new Room("East Washroom"));
            Room westWashroom = (new Room("West Washroom"));
            Room storage = (new Room("Storage"));

            rooms.AddRange(new List<Room> { entranceHall, eastHall, westHall, diningRoom, study, kitchen, livingRoom, eastWashroom, westWashroom, storage });

            entranceHall.setNeighbouringRooms(new List<Room> { diningRoom, eastHall, westHall });
            eastHall.setNeighbouringRooms(new List<Room> { entranceHall, study, eastWashroom, livingRoom, storage });
            westHall.setNeighbouringRooms(new List<Room> { entranceHall, kitchen, westWashroom });
            diningRoom.setNeighbouringRooms(new List<Room> { entranceHall, kitchen });
            study.setNeighbouringRooms(new List<Room> { eastHall });
            kitchen.setNeighbouringRooms(new List<Room> { diningRoom, westHall });
            livingRoom.setNeighbouringRooms(new List<Room> { eastHall });
            eastWashroom.setNeighbouringRooms(new List<Room> { eastHall });
            westWashroom.setNeighbouringRooms(new List<Room> { westHall });
            storage.setNeighbouringRooms(new List<Room> { eastHall });
        }
        public GameObject createItem(int i, Room room)
        {
            GameObject item = Instantiate(itemPrefabs[i]);
            Item itemScript = item.GetComponent<Item>();

            itemScript.room = room;
            room.items.Add(item);
            return item;
        }
        void Start()
        {
            //items = new List<GameObject>();
            Mansion mansion = GameObject.Find("GameManager").GetComponent<Mansion>();

            //TODO - Fix this! This is horrible and ineffecient. Room scripts should be added to the gameObject as it's imported from Tiled, then the import script can simply gameobject.find(roomname) to add containers toi t
            foreach(Room room in mansion.rooms) {
                if (room.roomName == roomName) {
                    room.containers.Add(gameObject);
                    this.room = room;
                }
            }
        }
示例#4
0
        public void enterRoom(Room room)
        {
            if (currentRoom != null) {
                currentRoom.npcs.Remove(this);
                lastRoom = currentRoom;
            }
            Timeline.addEvent(new SwitchRooms(pg.timeSteps, this, currentRoom, room));
            room.npcs.Add(this);
            currentRoom = room;

            //If there are any other NPCs, log that they were seen
            foreach (Npc npc in currentRoom.npcs) {
                if (npc != this) {
                    if (npc.isAlive) Timeline.addEvent(new Encounter(pg.timeSteps, this, npc, currentRoom));
                    else {
                        if (!isMurderer && !pg.bodyFound) {
                            Event e = new FoundBody(pg.timeSteps, this, npc, currentRoom);
                            Timeline.addEvent(e);

                            if (pg.debugMode) Debug.Log(e.toString());

                            foundBody = true;
                            pg.bodyWasFound();
                        }
                    }
                }
            }
        }