Exemplo n.º 1
0
 public CMJ2LevelData(string data, Dictionary<string, CMJ2TileConfig> configInfo)
 {
     Hashtable lvlData = MiniJSON.jsonDecode(data) as Hashtable;
     m_levelName = lvlData["name"] as string;
     //m_directive_count = (int)((double)lvlData["directive_count"]);
     m_directive_count = 0;
     m_originalObjects = new List<CMJ2Object>();
     m_placeableObjects = new List<CMJ2Object>();
     foreach (Hashtable obj in (lvlData["objects"] as ArrayList))
     {
         CMJ2Object preparedObject = new CMJ2Object(obj, configInfo);
         if (preparedObject.m_prefab.layer == CMJ2Manager.LAYER_DIRECTIVE)
         {
             m_directive_count++;
         }
         m_originalObjects.Add(preparedObject);
     }
     foreach (Hashtable obj in (lvlData["placeable_objects"] as ArrayList))
     {
         CMJ2Object preparedObject = new CMJ2Object(obj, configInfo);
         if (preparedObject.m_prefab.layer == CMJ2Manager.LAYER_DIRECTIVE)
         {
             m_directive_count++;
         }
         m_placeableObjects.Add(preparedObject);
     }
 }
Exemplo n.º 2
0
 public GameObject TryInstantiateObjectByNameInCell(string name, Cell cell)
 {
     CMJ2Object obj = new CMJ2Object (m_tileNameToConfigMap[name], cell);
     CMJ2Tile tile = obj.m_prefab.GetComponent<CMJ2Tile>();
     if (CMJ2EnvironmentManager.g.CanPlaceTileAt(tile, cell))
     {
         return GameObject.Instantiate(obj.m_prefab, obj.m_pos, Quaternion.identity) as GameObject;
     }
     return null;
 }
Exemplo n.º 3
0
 public GameObject InstantiateObjectByNameInCell(string name, Cell cell)
 {
     CMJ2Object obj = new CMJ2Object (m_tileNameToConfigMap[name], cell);
     return GameObject.Instantiate(obj.m_prefab, obj.m_pos, Quaternion.identity) as GameObject;
 }