Beispiel #1
0
        private GameObject RandomRoom(RoomPrefabSubTypes selection, Vector3 position, RoomConditions conditions)
        {
            GameObject roomType = null;

            //make it so the enterance and exit will never be a hallway
            switch (conditions)
            {
            case RoomConditions.StairRoom:

                roomType = RoomTypes.getRandomRoom(selection, RoomPlacementLogic.RoomType.OpenRoom);

                break;

            case RoomConditions.TreasureRoom:

                roomType = RoomTypes.getRandomRoom(selection, RoomPlacementLogic.RoomType.TreasureRoom);
                break;

            case RoomConditions.CombatRoom:
                //roomType = RoomTypes.getRandomRoom(selection, RoomPlacementLogic.RoomType.CombatRoom);

                //this is save time on create new room set with space for combat
                roomType = RoomTypes.getRandomRoom(selection, RoomPlacementLogic.RoomType.OpenRoom);
                Debug.Log("CombatRoom: " + roomType.name);
                //roomType.GetComponent<RoomPlacementLogic>().combatRoom = true;

                break;

            case RoomConditions.DefaultRoom:

                //everything but treasure room and hidden rooms
                int rand = Random.Range(0, 2);

                if (rand == 1)
                {
                    roomType = RoomTypes.getRandomRoom(selection, RoomPlacementLogic.RoomType.OpenRoom);
                }
                else
                {
                    roomType = RoomTypes.getRandomRoom(selection, RoomPlacementLogic.RoomType.Hallway);
                }

                break;
            }

            if (roomType == null)
            {
                Debug.LogError("Room creation returned Null. Issue with setup " + selection.ToString() + " conditions " + conditions.ToString());
            }

            GameObject room = Instantiate(roomType);

            room.transform.parent        = RoomParent.transform;
            room.transform.localPosition = position;

            return(room);
        }
Beispiel #2
0
 public GameObject getRandomRoom(RoomPrefabSubTypes roomObject, RoomPlacementLogic.RoomType lookingFor)
 {
     return(roomObject.getRandomRoom(lookingFor));
 }
Beispiel #3
0
 public GameObject getRandomRoom(RoomPrefabSubTypes roomObject)
 {
     return(roomObject.getRandomRoom());
 }