Пример #1
0
 private void Awake()
 {
     rooms             = new List <Room>();
     virtualObjects    = new List <VirtualObject>();
     semanticColors    = new Dictionary <string, Color>();
     simulationOptions = FindObjectOfType <EnvironmentManager>().m_simulationOptions;
 }
Пример #2
0
        public void LoadRoom(SimulationOptions simulationOptions)
        {
            //If you are using Vimantic architecture
            gameObject.AddComponent <SemanticRoom>();

            SendMessage("SetRoomID", transform.name, SendMessageOptions.DontRequireReceiver);
            SendMessage("SetRoomType", roomType.ToString(), SendMessageOptions.DontRequireReceiver);


            doors = GetComponentsInChildren <Door>().ToList();

            SetDoors(simulationOptions.RandomStateDoor);

            List <Material> materialsWall = simulationOptions.WallsMaterialsByRoomType.Find(pair => pair.roomType == roomType).materials;

            if (materialsWall == null || materialsWall.Count == 0)
            {
                materialsWall = Resources.LoadAll("Walls", typeof(Material)).Cast <Material>().ToList();
            }

            if (materialsWall.Count != 0)
            {
                PaintWall(materialsWall[Random.Range(0, materialsWall.Count)]);
            }
            else
            {
                Log("No wall painting found", LogLevel.Error, true);
            }

            List <Material> materialsFloor = simulationOptions.FloorsMaterialsByRoomType.Find(pair => pair.roomType == roomType).materials;

            if (materialsFloor == null || materialsFloor.Count == 0)
            {
                materialsFloor = Resources.LoadAll("Floors", typeof(Material)).Cast <Material>().ToList();
            }

            if (materialsFloor.Count != 0)
            {
                PaintFloor(materialsFloor[Random.Range(0, materialsFloor.Count)]);
            }
            else
            {
                Log("No floor painting found", LogLevel.Error, true);
            }
        }