private static async void TestObjectFactory()
        {
            var nw = new Wall {
                Direction = Wall.DirectionEnum.NORTH, Texture = "NBricks"
            };
            var ew = new Wall {
                Direction = Wall.DirectionEnum.EAST, Texture = "LimeBricks"
            };
            var sw = new Wall {
                Direction = Wall.DirectionEnum.SOUTH, Texture = "NConcrete"
            };
            var ww = new Wall {
                Direction = Wall.DirectionEnum.WEST, Texture = "MarbleBricks"
            };

            var room = new Room
            {
                Floor    = "MarbleTiles",
                Size     = new Vector3f(10, 5, 10),
                Position = new Vector3f(10, -10, 10),
                Ceiling  = "NFabric",
                Walls    = new List <Wall> {
                    nw, ew, sw, ww
                }
            };

            await ObjectFactory.BuildRoom(room);
        }
Пример #2
0
        private void TestObjectFactory()
        {
            var nw = new VREM.Model.Wall();

            nw.direction = "NORTH";
            nw.texture   = "NBricks";
            var ew = new VREM.Model.Wall();

            ew.direction = "EAST";
            ew.texture   = "LimeBricks";
            var sw = new VREM.Model.Wall();

            sw.direction = "SOUTH";
            sw.texture   = "NConcrete";
            var ww = new VREM.Model.Wall();

            ww.direction = "WEST";
            ww.texture   = "MarbleBricks";

            var room = new VREM.Model.Room();

            room.floor    = "MarbleTiles";
            room.size     = new Vector3(10, 5, 10);
            room.position = new Vector3(10, -10, 10);
            room.ceiling  = "NFabric";
            room.walls    = new[] {
                nw, ew, sw, ww
            };

            ObjectFactory.BuildRoom(room);
        }
        public void GenerateExhibition()
        {
            foreach (var room in _exhibition.rooms)
            {
                var roomGameObject = ObjectFactory.BuildRoom(room);
                var exhibitionRoom = roomGameObject.GetComponent <CuboidExhibitionRoom>();
                _rooms.Add(exhibitionRoom);


                // Add unibas logo
                var pref = Resources.Load <GameObject>("Objects/unibas");
                var logo = Object.Instantiate(pref);
                logo.name = "UnibasLogo";
                logo.transform.SetParent(exhibitionRoom.transform, false);
                logo.transform.localPosition =
                    new Vector3(-3.99f, 2.4f, -1.6f); // manually found values
                logo.transform.localRotation = Quaternion.Euler(new Vector3(0, 90, 0));
                logo.transform.localScale    = Vector3.one * 10000;

                // Add Palette
                var pal     = ObjectFactory.GetPalettePrefab();
                var palette = Instantiate(pal);
                palette.transform.SetParent(exhibitionRoom.transform, false);
                palette.name = "MyPalette";
                palette.transform.localPosition = new Vector3(3.99f, 1.5f, -1.2f);
                palette.transform.localRotation = Quaternion.Euler(new Vector3(90, -90, 0));
                palette.transform.localScale    = Vector3.one * 0.1f;
            }

            // For teleporting, each room needs to be created.
            foreach (var room in _rooms)
            {
                CreateAndAttachTeleporters(room);
            }
        }
        public void GenerateExhibition()
        {
            foreach (var room in _exhibition.rooms)
            {
                var roomGameObject = ObjectFactory.BuildRoom(room);
                var exhibitionRoom = roomGameObject.GetComponent <CuboidExhibitionRoom>();
                _rooms.Add(exhibitionRoom);

                if (VREPController.Instance.Settings.CeilingLogoEnabled)
                {
                    GameObject pref = Resources.Load <GameObject>("Objects/unibas");
                    var        logo = GameObject.Instantiate(pref);
                    logo.name = "UnibasLogo";
                    logo.transform.SetParent(exhibitionRoom.transform, false);
                    //logo.transform.localPosition = new Vector3(-1.493f, room.size.y-.01f, -0.642f); // manually found values
                    logo.transform.localPosition =
                        new Vector3(-1.493f, room.size.y - .01f, 3.35f); // manually found values
                    logo.transform.localRotation = Quaternion.Euler(new Vector3(90, 180));
                    logo.transform.localScale    = Vector3.one * 10000;
                }
            }

            // For teleporting, each room needs to be created.
            foreach (var room in _rooms)
            {
                CreateAndAttachTeleporters(room);
            }
        }
Пример #5
0
        /// <summary>
        /// Loads a room model.
        /// </summary>
        /// <param name="room">The room model to load.</param>
        public async Task <GameObject> LoadRoom(Room room)
        {
            var roomGameObject = await ObjectFactory.BuildRoom(room);

            var exhibitionRoom = roomGameObject.GetComponent <CuboidExhibitionRoom>();

            // Add room to map.
            RoomList.Add(exhibitionRoom);

            if (room.Metadata.ContainsKey(GenerationMetadata.Generated.GetKey()))
            {
                GeneratedTpSetup(room);
            }

            return(roomGameObject);
        }
Пример #6
0
        public void GenerateExhibition()
        {
            foreach (var room in _exhibition.rooms)
            {
                var roomGameObject = ObjectFactory.BuildRoom(room);
                var exhibitionRoom = roomGameObject.GetComponent <CuboidExhibitionRoom>();
                _rooms.Add(exhibitionRoom);

                if (VREPController.Instance.Settings.CeilingLogoEnabled)
                {
                    GameObject pref = Resources.Load <GameObject>("Objects/unibas");
                    var        logo = GameObject.Instantiate(pref);
                    logo.name = "UnibasLogo";
                    logo.transform.SetParent(exhibitionRoom.transform, false);
                    //logo.transform.localPosition = new Vector3(-1.493f, room.size.y-.01f, -0.642f); // manually found values
                    logo.transform.localPosition =
                        new Vector3(-1.493f, room.size.y - .01f, 3.35f); // manually found values
                    logo.transform.localRotation = Quaternion.Euler(new Vector3(90, 180));
                    logo.transform.localScale    = Vector3.one * 10000;
                }
                if (VREPController.Instance.Settings.WallTimerCount > 0)
                {
                    GameObject obj = new GameObject("Timer");
                    obj.transform.SetParent(exhibitionRoom.transform, false);
                    obj.transform.localPosition =
                        new Vector3(-room.size.x / 2 + 0.2f, room.size.y - 0.2f, room.size.z / 2); // manually found values
                    obj.transform.localScale = Vector3.one * 0.05f;
                    TextMesh textMesh = obj.AddComponent <TextMesh>();
                    textMesh.fontSize = 150;
                    Countdown timer = obj.AddComponent <Countdown>();
                    timer.countdown = textMesh;
                    timer.initTime  = VREPController.Instance.Settings.WallTimerCount;
                    obj.transform.GetComponent <MeshRenderer>().enabled = false;
                }
            }

            // For teleporting, each room needs to be created.
            foreach (var room in _rooms)
            {
                CreateAndAttachTeleporters(room);
            }
        }