Example #1
0
        public GameObject CreateCasern(UnitData unitData)
        {
            GameObject prefab = WarRes.GetPrefab(WarRes.Unit_Build_Casern);
            GameObject go     = GameObject.Instantiate(prefab);

            go.name = go.name.Replace("(Clone)", "") + "_" + unitData.id;
            go.AddEComponent(unitData);

            // TODO NewWar
//			LevelData levelData = new LevelData();
//			levelData.buildConfig = War.model.GetBuildConfig(BuildType.Casern);

            ProduceData produceData = new ProduceData();
            SendArmData sendArmData = new SendArmData();

//			go.AddEComponent(levelData);
            go.AddEComponent(produceData);
            go.AddEComponent(sendArmData);


            unitData.Init();

            if (unitData.legionData.produceLimit)
            {
                produceData.produceLimitNum = unitData.hp;
            }

            go.transform.SetParent(War.scene.rootCaserns);
            go.transform.position = unitData.position;
            go.SetActive(true);
            return(go);
        }
Example #2
0
        public GameObject CreateSpot(UnitData unitData)
        {
            GameObject prefab = WarRes.GetPrefab(WarRes.Unit_Build_Spot);

            GameObject go = GameObject.Instantiate(prefab);

            go.name = go.name.Replace("(Clone)", "") + "_" + unitData.id;
            go.AddEComponent(unitData);


            SendArmData sendArmData = new SendArmData();

            go.AddEComponent(sendArmData);


            unitData.Init();


            go.transform.SetParent(War.scene.rootCaserns);
            go.transform.position = unitData.position;
            go.SetActive(true);
            return(go);
        }