//Determine room prefab private Room GetRoom(ClassObject classObject) { //Path to prefab file string _room = "Prefabs/Environment/4DoorRoom"; return(new Room(classObject, Resources.Load <GameObject>(_room))); }
public Room(ClassObject classObject, GameObject roomGO) { this._entryCounter = 0; this.RoomGO = roomGO; this.Info = classObject; this.RoomGO.transform.position = new Vector3(0, 0, 0); this.RoomGO.name = Info.name; int rels = GameObjectCreator.CountRels(classObject); _doorsNum = rels > 4 ? 4 : rels; }
public List <GameObject> CreateRoomAndExtensions(ClassObject classObject) { var room = GetRoom(classObject); var newRoom = InstantiateEnvironmentItem(room.RoomGO); _actorCreator.CreateAttributes(room, newRoom); _actorCreator.CreateMethods(room, newRoom); newRoom.gameObject.name = room.Info.name; newRoom.AddComponent <RoomBehaviour>(); CreateExtensions(room, newRoom); return(items); }
//Count number of relationships a class has public static int CountRels(ClassObject classObject) { int res = 0; foreach (string sc in classObject.subclasses) { res++; } foreach (string assoc in classObject.associations) { res++; } if (!string.IsNullOrEmpty(classObject.superclass)) { res++; } return(res); }