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); }
public int effectBuildCantSendSoldierStart(SkillParameter skillParameter, EffectParameter effectParameter) { //播放技能特效 if (effectParameter.effect.animPathStart != "temp") { GameObject effectPrefabSelf = WarRes.GetPrefab(effectParameter.effect.animPathStart.ToLower()); GameObject effectAnim = GameObject.Instantiate <GameObject>(effectPrefabSelf); int lengion = War.skillWarManager.getLegionByHeroUid(skillParameter.curHeroUid); Vector3 fromPos = War.scene.GetLegionPosition(lengion); effectAnim.transform.position = fromPos; effectParameter.waitTime = 0.5f; } foreach (UnitCtl unit in effectParameter.unitCtlList) { if (unit == null) { continue; } BuildSkillDots skillDots = unit.GetComponent <BuildSkillDots>(); if (skillDots != null) { skillDots.buildStopSendsoldier(effectParameter); } } Debug.Log(string.Format("<color=yellow> effectBuildCantSendSoldierStart all effid={0} time={1} count={2}</color>", effectParameter.effect.id, effectParameter.effect.time, effectParameter.unitCtlList.Count)); ////处理技能2 // War.skillWarManager.StartCoroutine(useSkill2Effect(skillParameter, 1.0f)); return(0); }
IEnumerator effectBuildReplaceEnd(SkillParameter skillParameter, EffectParameter effectParameter) { yield return(new WaitForSeconds(effectParameter.waitTime)); foreach (UnitCtl unit in effectParameter.unitCtlList) { Debug.Log("=======" + effectParameter.effect.buffAnimPath); int lengion = War.skillWarManager.getLegionByHeroUid(skillParameter.curHeroUid); if (lengion != unit.unitData.legionId) { continue; } if (effectParameter.effect.buffAnimPath != "temp") { GameObject effectPrefab = WarRes.GetPrefab(effectParameter.effect.buffAnimPath); GameObject effectAnim = GameObject.Instantiate <GameObject>(effectPrefab); effectAnim.transform.position = unit.transform.position; } if (unit.unitData.buildConfig.id == effectParameter.value) { // unit.unitData.BuildSkillUplevel(); } else { unit.BuildChangeBuildConfig((int)effectParameter.value); } unit.unitData.BuildSkillCostHP(effectParameter.effect.costHP); unit.unitData.BuildSkillCostHPPer(effectParameter.effect.costHPPer); Debug.Log(string.Format("<color=yellow> effectBuildReplaceStart to {0} </color>", unit.unitData.id)); } }
public int changeAttribute(SkillParameter skillParameter, EffectParameter effectParameter) { //SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillParameter.skillId); Debug.Log("changeAttribute=========" + effectParameter.effect.animPathStart + "++++++: " + effectParameter.effect.animPathEnd); //播放技能特效 if (effectParameter.effect.animPathStart != "temp") { GameObject effectPrefabSelf = WarRes.GetPrefab(effectParameter.effect.animPathStart); GameObject effectAnim = GameObject.Instantiate <GameObject>(effectPrefabSelf); int lengion = War.skillWarManager.getLegionByHeroUid(skillParameter.curHeroUid); Vector3 fromPos = War.scene.GetLegionPosition(lengion); effectAnim.transform.position = fromPos; } foreach (UnitCtl unit in effectParameter.unitCtlList) { if (unit == null) { continue; } BuildSkillDots skillDots = unit.GetComponent <BuildSkillDots>(); if (skillDots != null) { skillDots.buildChangeAttri(effectParameter); } } Debug.Log(string.Format("<color=yellow> addAttribute all skill id={0} effid={1}</color>", skillParameter.skillId, effectParameter.effect.id)); return(0); }
//灼烧标记 public void buildingBurnTag(EffectParameter effectInfo) { effectParameterList.Add(effectInfo); UnitCtl unit = gameObject.GetComponent <UnitCtl>(); Prop[] props = new Prop[] { Prop.CreateInstance(PropId.StateBurn, 1) }; AttachPropData attachPropData = new AttachPropData(props); if (effectInfo.effect.buffAnimPath != "temp") { GameObject effectPrefab = WarRes.GetPrefab(effectInfo.effect.buffAnimPath); GameObject effectAnim = GameObject.Instantiate <GameObject>(effectPrefab); effectAnim.transform.position = unit.transform.position; DelayDestory destoryTimer = effectAnim.GetComponent <DelayDestory>(); if (destoryTimer != null) { destoryTimer.DelayTime = effectInfo.effect.time; } effectInfo.effectAnim = effectAnim; Debug.Log("=======destoryTimer.DelayTime: " + effectInfo.effect.time); } unit.unitData.AppProps(attachPropData, true); if (effectInfo.effect.time > 0) { effectInfo.waitTime = effectInfo.effect.time; StartCoroutine(burnTagTimer(attachPropData, effectInfo)); } }
protected override void OnStart() { base.OnStart(); //Coo.assetManager.Load(WarRes.Effect_Fire_2, OnLoadRes); OnLoadRes(WarRes.Effect_Beattack, WarRes.GetPrefab(WarRes.Effect_Beattack)); }
public void Instance() { MapConfig mapConfig = War.sceneData.mapConfig; if (mapConfig.id < 100) { meshRenderer.material.mainTexture = WarRes.GetRes <Texture2D>(mapConfig.terrain); meshRenderer.gameObject.SetActive(true); War.scene.rootTerrains.gameObject.SetActive(false); } else { GameObject prefab = WarRes.GetPrefab(mapConfig.terrain); GameObject go = GameObject.Instantiate(prefab); go.transform.SetParent(War.scene.rootTerrains); go.transform.position = Vector3.zero; meshRenderer.gameObject.SetActive(false); War.scene.rootTerrains.gameObject.SetActive(true); Transform map = go.transform.Find("Map"); if (map != null) { MeshRenderer mapRenderer = map.GetComponent <MeshRenderer>(); if (mapRenderer != null) { mapRenderer.sharedMaterial.shader = Shader.Find("ihaiu/Terrain_3Texture_1Shade"); } } } }
public GameObject Factory() { GameObject prefab = WarRes.GetPrefab(WarRes.Unit_Prefab_Solider); GameObject go = GameObject.Instantiate(prefab); go.transform.SetParent(War.scene.rootSoliders); return(go); }
public GameObject CreatePathGroup() { GameObject prefab = WarRes.GetPrefab(WarRes.Unit_Prefab_UnitPathGroup); GameObject go = GameObject.Instantiate(prefab); go.transform.SetParent(War.scene.rootSoliders); return(go); }
public GameObject CreateSolider(int team) { GameObject prefab = WarRes.GetPrefab(WarRes.Unit_Prefab_Solider); GameObject go = GameObject.Instantiate(prefab); go.name = go.name.Replace("(Clone)", "") + "_" + team; go.transform.SetParent(War.scene.rootSoliders); return(go); }
protected void CreateView() { GameObject prefab = WarRes.GetPrefab(WarRes.Unit_AtkRadius); GameObject go = (GameObject)GameObject.Instantiate(prefab); go.name = go.name.Replace("(Clone)", "-") + unitData.id; go.transform.SetParent(transform); go.transform.localPosition = Vector3.zero; view = go.GetComponent <AtkRadius>(); }
public void Init() { if (isInit) { return; } isInit = true; PrefabPool pool = null; pool = new PrefabPool(); pool.cullAbove = 100; pool.cullDelay = 5; pool.cullMaxPerPass = 5; pool.manager = this; pool.prefab = WarRes.GetPrefab(WarRes.e_buffstate_movespeed_up); pool.group = new GameObject("StateBuffMoveSpeedUp").transform; pool.group.SetParent(transform); stateBuffMoveSpeedUp = pool; pool = new PrefabPool(); pool.cullAbove = 100; pool.cullDelay = 5; pool.cullMaxPerPass = 5; pool.manager = this; pool.prefab = WarRes.GetPrefab(WarRes.e_buffstate_atk_up); pool.group = new GameObject("StateBuffAtkUp").transform; pool.group.SetParent(transform); stateBuffAtkUp = pool; pool = new PrefabPool(); pool.cullAbove = 100; pool.cullDelay = 5; pool.cullMaxPerPass = 5; pool.manager = this; pool.prefab = WarRes.GetPrefab(WarRes.e_buffstate_producespeed_up); pool.group = new GameObject("StateBuffProduceSpeedUp").transform; pool.group.SetParent(transform); stateBuffProduceSpeedUp = pool; pool = new PrefabPool(); pool.cullAbove = 10; pool.cullDelay = 5; pool.cullMaxPerPass = 5; pool.manager = this; pool.prefab = WarRes.GetPrefab(WarRes.e_spot_change); pool.group = new GameObject("SpotChange").transform; pool.group.SetParent(transform); spotChange = pool; legionExpPool.Init(this); }
void InitClock() { GameObject go = GameObject.Instantiate <GameObject>(WarRes.GetPrefab(WarRes.WarViews_UnitClock)); go.name = "WarViews_Clock-" + unitData.id; go.transform.SetParent(War.scene.rootUnitClock); go.transform.localScale = Vector3.one; clockView = go.GetComponent <ClockView>(); clockView.Hide(); go.GetComponent <UIFllowWorldPosition>().targetWorld = transform; }
protected void CreateEffect() { GameObject prefab = WarRes.GetPrefab(WarRes.Effect_Uplevel); GameObject go = (GameObject)GameObject.Instantiate(prefab); go.SetActive(false); go.transform.SetParent(anchorEffectUplevel); go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; effect = go; }
//--------------------定时伤害------------------------------ #endregion #region 手动范围 //--------------------手动范围------------------------------ private int manualHurtRang(SkillParameter skillParameter, EffectParameter effectInfo) { if (effectInfo.effect.animPathStart != "temp") { GameObject effectPrefab = WarRes.GetPrefab(effectInfo.effect.animPathStart); GameObject effectAnim = GameObject.Instantiate <GameObject>(effectPrefab); effectAnim.transform.position = effectInfo.receivePos; } War.skillWarManager.StartCoroutine(manualHurtRangEnd(skillParameter, effectInfo)); return(0); }
protected void OnLoadRes(string name, object obj) { //Debug.Log(string.Format("<color=0x66FF44>name={0} obj={1}</color>", name, obj)); WarRes.AddPrefab(name, obj); redLoaded++; if (redLoaded >= resCount && isLoaded == false) { isLoaded = true; War.signal.PreloadComplete(); } }
public void SetData(SkillOperateData data) { uiCamera = Coo.uiCamera; this.data = data; data.receiveList.Clear(); skillButton.SetData(data); skillInfoNode.SetData(data); if (useEffect != null) { useEffect.SetData(data); } if (data.skillConfig.skillType == SkillType.Build_Replace) { BuildConfig buildConfig = War.model.GetBuildConfig(data.skillConfig.buildId); Debug.Log("data.skillId=" + data.skillId + " data.skillConfig.buildId=" + data.skillConfig.buildId); string file = buildConfig.GetLevelConfig(1).avatarConfig.Model; Debug.Log(file); GameObject prefab = WarRes.GetPrefab(file); obj = GameObject.Instantiate(prefab); obj.SetActive(false); obj.GetComponent <SpriteRenderer>().color = new Color(0.8f, 0.8f, 0.8f, 0.8f); objDestory = true; } else { switch (data.skillConfig.operate) { case SkillOperateType.SelectCircle: obj = GameObject.Instantiate(War.skillUse.selectCircleView.gameObject); obj.SetActive(false); SkillOperateSelectCircleView skillOperateSelectCircleView = obj.GetComponent <SkillOperateSelectCircleView> (); skillOperateSelectCircleView.Radius = data.skillConfig.radius; skillOperateSelectCircleView.Relation = data.skillConfig.relation; objDestory = true; break; } } selectUnitMaterialType = data.skillConfig.relation.REnemy() ? WarMaterialsType.operateSelect_Enemy : WarMaterialsType.operateSelect_Own; if (this.data != null) { rectTransform.anchoredPosition = new Vector2(-180, 56); MoveToGroove(); this.data.sSetUse += SetUse; } }
protected void Init() { GameObject prefab = WarRes.GetPrefab(WarRes.Unit_Shadow); GameObject go = (GameObject)GameObject.Instantiate(prefab as UnityEngine.Object); go.name = "War_Shadow-" + unitData.id; go.transform.SetParent(War.scene.rootShadow); shadow = go.GetComponent <UnitShadow>(); shadow.target = transform; shadow.SetPosition(); OnChangeAvatar(unitAgent); }
void CreateHeroHead() { GameObject prefab = WarRes.GetPrefab(WarRes.WarViews_HeroHead); GameObject go = GameObject.Instantiate(prefab); go.name = "WarViews_HeroHead-" + heroData.heroId; go.transform.SetParent(War.scene.rootHeroHeads, false); go.transform.localScale = Vector3.one; heroHead = go.GetComponent <HeroHead>(); heroHead.SetData(heroData); heroHead.Hide(); }
IEnumerator buildHurt(UnitCtl unit, EffectParameter effectInfo) { yield return(new WaitForSeconds(0.8f)); if (effectInfo.effect.animPathEnd != "temp") { GameObject effectPrefab = WarRes.GetPrefab(effectInfo.effect.animPathEnd); GameObject effectAnim = GameObject.Instantiate <GameObject>(effectPrefab); effectAnim.transform.position = unit.transform.position; } DamageVO damageVo = War.skillWarManager.GetDamageParameter(effectInfo.value, false, DamageType.ATTACK, unit, effectInfo.caster); unit.Damage(damageVo); }
protected void Init() { GameObject prefab = WarRes.GetPrefab(WarRes.SendArmy); GameObject go = GameObject.Instantiate(prefab); go.name = "War_View_SendArmy"; go.transform.SetParent(anchorImageSendArm); go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; sendArmyView = go.GetComponent <SendArmyView>(); sendArmyView.unit = unitCtl; sendArmyView.units = War.scene.buildList; sendArmyView.sSelect += OnSelect; }
public GameObject CreateHero(UnitData unitData, HeroData heroData) { GameObject prefab = WarRes.GetPrefab(WarRes.Unit_Hero); GameObject go = GameObject.Instantiate(prefab); go.name = go.name.Replace("(Clone)", "") + "_" + unitData.legionId + "-" + heroData.heroId; go.AddEComponent(unitData); go.AddEComponent(heroData); unitData.Init(); heroData.isInstance = true; go.transform.SetParent(War.scene.rootHeros); go.SetActive(true); return(go); }
public int stopSoldierStart(SkillParameter skillParameter, EffectParameter effectInfo) { Debug.Log("stopSoldierStart=========" + effectInfo.effect.animPathStart + "++++++" + effectInfo.effect.animPathEnd); //播放技能特效 if (effectInfo.effect.animPathStart != "temp") { GameObject effectPrefabSelf = WarRes.GetPrefab(effectInfo.effect.animPathStart.ToLower()); GameObject effectAnim = GameObject.Instantiate <GameObject>(effectPrefabSelf); effectAnim.transform.position = effectInfo.receivePos; effectInfo.waitTime = 0.8f; } War.skillWarManager.StartCoroutine(stopSoldierEnd(skillParameter, effectInfo)); return(0); }
public static void Exit(bool isHandler) { LuaCallMethod("Exit", isHandler, sceneData.id); // 战斗流程状态 War.processState = WarProcessState.Exit; // 关闭战斗结束面板 Coo.menuManager.CloseMenu(CC.Module.Menu.MenuType.BattleEnd); // 播放 War.Play(); // 退出战斗 进入主场景 Coo.menuManager.OpenMenu(MenuType.MainScene, 1); // 销毁战斗加载的资源 WarRes.Destroy(); War.Instance.Destory(); }
public GameObject CreateWall(UnitData unitData) { GameObject prefab = WarRes.GetPrefab(WarRes.Unit_Wall); GameObject go = GameObject.Instantiate(prefab); go.name = go.name.Replace("(Clone)", "") + "_" + unitData.id; go.AddEComponent(unitData); unitData.Init(); go.transform.SetParent(War.scene.rootWalls); go.transform.position = unitData.position; go.SetActive(true); return(go); }
IEnumerator autoHurtSoilderEnd(SkillParameter skillParameter, EffectParameter effectInfo) { yield return(new WaitForSeconds(effectInfo.waitTime)); SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillParameter.skillId); //播放技能,针对所有出征士兵 int unitType = 0; unitType = unitType.USolider(true); int relation = 0; relation = relation.REnemy(true); List <UnitCtl> unitSoldierList = War.scene.SearchUnit(unitType, effectInfo.caster.unitData.legionId, relation); foreach (UnitCtl unit in unitSoldierList) { if (unit == null) { continue; } if (effectInfo.effect.animPathEnd != "temp") { GameObject effectPrefab = WarRes.GetPrefab(effectInfo.effect.animPathEnd.ToLower()); GameObject effectAnim = GameObject.Instantiate <GameObject>(effectPrefab); effectAnim.transform.position = unit.transform.position; } } foreach (UnitCtl unit in effectInfo.unitCtlList) { if (unit == null) { continue; } unit.DamageToDeath(effectInfo.caster); } Debug.Log(string.Format("<color=yellow> autoHurtSoilder=id:{0} {1}</color>", skillParameter.skillId, effectInfo.unitCtlList.Count)); //处理技能2 if (skillParameter.curDealSkillIdx == 1) { War.skillWarManager.dealSkill2Effect(skillParameter); } }
//==================伤害出征士兵 冰冻效果========================= private int autoHurtSoilderStart(SkillParameter skillParameter, EffectParameter effectInfo) { Debug.Log("=========" + effectInfo.effect.animPathStart + "++++++" + effectInfo.effect.animPathEnd); //播放技能特效 if (effectInfo.effect.animPathStart != "temp") { GameObject effectPrefabSelf = WarRes.GetPrefab(effectInfo.effect.animPathStart.ToLower()); GameObject effectAnim = GameObject.Instantiate <GameObject>(effectPrefabSelf); int lengion = War.skillWarManager.getLegionByHeroUid(skillParameter.curHeroUid); Vector3 fromPos = War.scene.GetLegionPosition(lengion); effectAnim.transform.position = fromPos; effectInfo.waitTime = 0.8f; } War.skillWarManager.StartCoroutine(autoHurtSoilderEnd(skillParameter, effectInfo)); return(0); }
public int effectBuildReplaceStart(SkillParameter skillParameter, EffectParameter effectInfo) { //播放技能特效 if (effectInfo.effect.animPathStart != "temp") { GameObject effectPrefabSelf = WarRes.GetPrefab(effectInfo.effect.animPathStart.ToLower()); GameObject effectAnim = GameObject.Instantiate <GameObject>(effectPrefabSelf); int lengion = War.skillWarManager.getLegionByHeroUid(skillParameter.curHeroUid); Vector3 fromPos = War.scene.GetLegionPosition(lengion); effectAnim.transform.position = fromPos; effectInfo.waitTime = 0.5f; } War.skillWarManager.setBuildHeroInfo(skillParameter, effectInfo); War.skillWarManager.StartCoroutine(effectBuildReplaceEnd(skillParameter, effectInfo)); return(0); }
//单个技能效果 IEnumerator effectHurtSingleStart(SkillParameter skillParameter, EffectParameter effectInfo, UnitCtl unit, bool needDealSkill2) { float idxRand = Random.Range(0.0f, 1.0f); //Debug.LogFormat("=====idxRand:{0}", idxRand); yield return(new WaitForSeconds(idxRand)); SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillParameter.skillId); if (effectInfo.effect.animPathStart != "temp") { GameObject effectPrefab = WarRes.GetPrefab(effectInfo.effect.animPathStart); GameObject effectAnim = GameObject.Instantiate <GameObject>(effectPrefab); effectAnim.transform.position = unit.transform.position; effectInfo.waitTime = 0.2f; } War.skillWarManager.StartCoroutine(autoHurtBuildSingleEnd(skillParameter, effectInfo, unit, needDealSkill2)); }
public void ExeAtk(UnitCtl target) { target.unitData.isTurretHit = true; GameObject prefab = WarRes.GetPrefab(WarRes.Turret_Fx_Projectile); GameObject go = GameObject.Instantiate <GameObject>(prefab); go.transform.position = transform.position + Vector3.up * 3f; TurretProjectile projectile = go.AddComponent <TurretProjectile>(); projectile.curveType = ProjectType.Line; projectile.duration = unitData.attackSpeed * 0.5f; projectile.targetTransform = target.transform; projectile.explosionPrefab = WarRes.GetPrefab(WarRes.Turret_Fx_Explosion); projectile.completeArg = target; projectile.OnCompleteHandler += OnProjectileComplete; War.signal.DoTurretAtk(unitCtl.unitData.uid, target.unitData.uid); }