示例#1
0
        //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)));
        }
示例#2
0
        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;
        }
示例#3
0
        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);
        }