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);
        }
    private Room CreateRoom(DefaultNamespace.VREM.Model.Room room)
    {
        var goRoom = Instantiate(RoomPrefab);

        goRoom.transform.position = CalculateRoomPosition(room);
        Room roomLogic = goRoom.GetComponent <Room>();

        return(roomLogic);
    }
    public void BuildRoom(DefaultNamespace.VREM.Model.Room room)
    {
        var goRoom = Instantiate(RoomPrefab);

        goRoom.transform.position = CalculateRoomPosition(room);
        Room roomLogic = goRoom.GetComponent <Room>();

        roomLogic.Populate(room);
    }
        private DefaultNamespace.VREM.Model.Room GetPrevious(DefaultNamespace.VREM.Model.Room room)
        {
            var pos = GetRoomIndex(room);

            if (pos == -1)
            {
                return(null);
            }

            return(_exhibition.rooms[GetPreviousRoomIndex(pos)]);
        }
Exemple #5
0
        private DefaultNamespace.VREM.Model.Room GetNext(DefaultNamespace.VREM.Model.Room room)
        {
            var pos = GetRoomIndex(room);

            if (pos == -1)
            {
                // TODO This should not happen
                return(null);
            }

            return(_exhibition.rooms[GetNextRoomIndex(pos)]);
        }
Exemple #6
0
        private int GetRoomIndex(DefaultNamespace.VREM.Model.Room room)
        {
            for (int i = 0; i < _exhibition.rooms.Length; i++)
            {
                if (room.Equals(_exhibition.rooms[i]))
                {
                    return(i);
                }
            }

            return(-1);
        }
Exemple #7
0
    public void Populate(DefaultNamespace.VREM.Model.Room room)
    {
        Debug.Log(room);
        Debug.Log(room.walls);
        _roomModel = room;


        Debug.Log("adjusting ceiling and floor");
        // TODO Use new material loading code
        gameObject.transform.Find("Ceiling").gameObject.GetComponent <TexturedMonoBehaviour>()
        .LoadMaterial(TexturingUtility.Translate(room.ceiling));
        gameObject.transform.Find("Floor").gameObject.GetComponent <TexturedMonoBehaviour>()
        .LoadMaterial(TexturingUtility.Translate(room.floor));

        /*Debug.Log("add globe");
         * if(GlobePrefab != null){ //TODO: add a new check
         *  var globe = Instantiate(GlobePrefab) as GameObject;
         *  globe.transform.rotation = Quaternion.Euler(-90, -90, 0);
         *  globe.transform.position = new Vector3(-2.5f, 0, -2.5f);
         *  globe.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
         * }*/

        if (!string.IsNullOrEmpty(room.GetURLEncodedAudioPath()))
        {
            Debug.Log("add audio to room");

            if (audio == null)
            {
                audio = gameObject.AddComponent <AudioLoader>();
            }

            audio.ReloadAudio(room.GetURLEncodedAudioPath());
        }
        //

        PopulateWalls(room.walls);
        //PlaceExhibits(room.exhibits);


        // DEBUG TESTING TODO REMOVE this when done
        //Debug.Log("Test");
        //LoadAndPlaceModel(ServerSettings.SERVER_ID+"content/get/5bd3292c64aa33a460bcdade%2f1%2fexhibits%2fearth.obj", new Vector3(0,1,0));
    }
    private Vector3 CalculateRoomPosition(DefaultNamespace.VREM.Model.Room room)
    {
        float x = room.position.x, y = room.position.y, z = room.position.z;

        return(new Vector3(x * RoomSize + x * Offset, y * RoomSize + y * Offset, z * RoomSize + z * Offset));
    }