Ejemplo n.º 1
0
        public void AddMatch(RoomInfo roomInfo)
        {
            GameObject matchPrefabClone = Instantiate(matchPrefab);

            matchPrefabClone.transform.SetParent(matchesParent);

            MatchSpawnPosition randomSpawnPosition = GetSpawnPosition();

            randomSpawnPosition.isUsed            = true;
            matchPrefabClone.transform.position   = randomSpawnPosition.transform.position;
            matchPrefabClone.transform.localScale = Vector3.one;

            RoomButton roomButton = matchPrefabClone.GetComponent <RoomButton> ();

            roomButton.roomInfo      = roomInfo;
            roomButton.isRoomCreated = true;
            roomButton.isValid       = true;

            object sceneObject;

            roomInfo.CustomProperties.TryGetValue("scene", out sceneObject);

            roomButton.room           = ScriptableObject.CreateInstance <Room> ();
            roomButton.room.sceneName = (string)sceneObject;
            roomButton.room.roomName  = roomInfo.Name;

            roomsDictionary.Add(roomInfo.Name, roomButton);
        }
Ejemplo n.º 2
0
 private void Start()
 {
     Transform[] positions = spawnParent.GetComponentsInChildren <Transform> ();
     foreach (Transform item in positions)
     {
         if (item != spawnParent)
         {
             MatchSpawnPosition spawnPosition = new MatchSpawnPosition();
             spawnPosition.transform = item;
             spawnPositions.Add(spawnPosition);
         }
     }
 }