예제 #1
0
        public int GetMaxTrainCount()
        {
            Building     b  = (Building)GetParent();
            BuildingData bd = b.GetBuildingData();

            return(bd.GetUnitProduction(b.GetUpgradeLevel()));
        }
예제 #2
0
        public void SetUnitType(GameObject go)
        {
            Building     b  = (Building)GetParent();
            BuildingData bd = b.GetBuildingData();

            m_vIsSpellForge = bd.IsSpellForge();
        }
예제 #3
0
 public void RemoveGameObject(GameObject go)
 {
     m_vGameObjects[go.ClassId].Remove(go);
     if (go.ClassId == 0)
     {
         Building     b  = (Building)go;
         BuildingData bd = b.GetBuildingData();
         if (bd.IsWorkerBuilding())
         {
             m_vLevel.WorkerManager.DecreaseWorkerCount();
         }
     }
     RemoveGameObjectReferences(go);
 }
예제 #4
0
 public void AddGameObject(GameObject go)
 {
     go.GlobalId = GenerateGameObjectGlobalId(go);
     if (go.ClassId == 0)
     {
         Building     b  = (Building)go;
         BuildingData bd = b.GetBuildingData();
         if (bd.IsWorkerBuilding())
         {
             m_vLevel.WorkerManager.IncreaseWorkerCount();
         }
     }
     m_vGameObjects[go.ClassId].Add(go);
 }
예제 #5
0
        public JObject Save()
        {
            JObject jsonData = new JObject();

            //Buildings
            JArray jsonBuildingsArray = new JArray();

            foreach (var go in m_vGameObjects[0])
            {
                Building b          = (Building)go;
                JObject  jsonObject = new JObject();
                jsonObject.Add("data", b.GetBuildingData().GetGlobalID());
                b.Save(jsonObject);
                jsonBuildingsArray.Add(jsonObject);
            }
            jsonData.Add("buildings", jsonBuildingsArray);

            //Traps
            JArray jsonTrapsArray = new JArray();

            foreach (var go in m_vGameObjects[4])
            {
                Trap    t          = (Trap)go;
                JObject jsonObject = new JObject();
                jsonObject.Add("data", t.GetTrapData().GetGlobalID());
                t.Save(jsonObject);
                jsonTrapsArray.Add(jsonObject);
            }
            jsonData.Add("traps", jsonTrapsArray);

            //Decos
            JArray jsonDecosArray = new JArray();

            foreach (var go in m_vGameObjects[6])
            {
                Deco    d          = (Deco)go;
                JObject jsonObject = new JObject();
                jsonObject.Add("data", d.GetDecoData().GetGlobalID());
                d.Save(jsonObject);
                jsonDecosArray.Add(jsonObject);
            }
            jsonData.Add("decos", jsonDecosArray);

            return(jsonData);
        }
예제 #6
0
        public int GetMaxTrainCount()
        {
            Building parent = (Building)GetParent();

            return(parent.GetBuildingData().GetUnitProduction(parent.GetUpgradeLevel()));
        }