void OnokSkillBtn(Transform panel) { MusicManager.PlaySe("click"); if (BattleGlobals.currentSid != "") { Skill s = GameFuncs.GetSkill(BattleGlobals.currentSid); Hero h = BattleGlobals.currentObj.GetComponent <Hero>(); if ((!s.isCp && h.currentMp >= s.cost) || (s.isCp && h.cp >= s.cost))//可消耗 { BattleCamera.SetAnimStop(); skillPanel.SetActive(false); heroPanel.SetActive(false); if (!s.isAoe)//单体 { BattleGlobals.isSelectEnemy = true; } else { BattleCamera.Instance.SetPos(0); BattleGlobals.currentObj.GetComponent <Hero>().Magic(BattleGlobals.currentSid); } foreach (Transform so in panel.Find("list/grid")) { Destroy(so.gameObject); } BattleGlobals.isMagic = true; } else//mp(cp)不足 { string msg = (s.isCp ? "cp" : "mp") + "不足!"; GameFuncs.CreateMsg(msg); } } }
void OnatkBtnClick() { MusicManager.PlaySe("click"); BattleCamera.SetAnimStop(); if (true) { BattleGlobals.isNearAttack = true; //近战 } BattleGlobals.isSelectEnemy = true; heroPanel.SetActive(false); }
void OndefBtnClick() { MusicManager.PlaySe("click"); if (BattleGlobals.currentObj != null && BattleGlobals.currentObj.tag == "Hero") { BattleCamera.SetAnimStop(); Hero hero = BattleGlobals.currentObj.GetComponent <Hero>(); hero.isDef = true; heroPanel.SetActive(false); BattleGlobals.isStop = false; BattleGlobals.currentObj = null; BattleGlobals.otherObjs.Clear(); } }
public void EnterNextWave() { if (BattleGlobals.liveMonsters.Count <= 0)//这波敌人死亡 { BattleGlobals.isStop = true; if (BattleGlobals.currentWave < BattleGlobals.waves)//进入下一波 { BattleGlobals.currentObj = null; BattleGlobals.otherObjs.Clear(); foreach (Transform mp in GameObject.Find("mpoints").transform) { foreach (Transform m in mp) { Destroy(m.gameObject); } } //wave ui BattleGlobals.currentWave++; UIManager.ChangeText("waveText", "Battle " + BattleGlobals.currentWave.ToString() + "/" + BattleGlobals.waves.ToString()); //create monsters Battle.currentMonsters = BattleGlobals.monsters[BattleGlobals.currentWave - 1]; Battle.CreateCurrentEnemy(); BattleUI.CreateHeads(); //is boss if (BattleGlobals.currentWave == BattleGlobals.waves) { BattleGlobals.isStop = true; BattleUI.canvas.SetActive(false); //boss(play boss bgm;hp slider;camera anim) MusicManager.PlayBgm("boss"); BattleCamera.PlayAnim("_boss"); StartCoroutine(DelayToInvoke.DelayToInvokeDo(WaitNotStop, 6)); } else { StartCoroutine(DelayToInvoke.DelayToInvokeDo(WaitNotStop, 0.2f)); } } else//win { BattleGlobals.isOver = true; BattleUI.HideUI(); //if current hero else random(live heroes) -> set win bool true GameObject winObj = null; Hero winHero = null; if (BattleGlobals.currentObj.tag == "Hero") { winObj = BattleGlobals.currentObj; } else { winObj = BattleFuncs.FindObj (BattleGlobals.liveHeroes[Random.Range(0, BattleGlobals.liveHeroes.Count - 1)]); } //camera string winIndex = winObj.transform.parent.gameObject.name [winObj.transform.parent.gameObject.name.Length - 1].ToString(); BattleCamera.SetAnimStop(); BattleCamera.PlayAnim("h" + winIndex); winHero = BattleGlobals.currentObj.GetComponent <Hero>(); winHero.Win(); //show win ui(every select heroes exp++;date(attribute) ++;click->return select map) StartCoroutine(DelayToInvoke.DelayToInvokeDo(WaitShowWin, 4f)); } } if (BattleGlobals.liveHeroes.Count <= 0)//英雄全部死亡,失败 { BattleGlobals.isOver = true; BattleGlobals.isStop = true; BattleUI.HideUI(); //show lose ui(click->return select map) BattleUI.ShowLosePanel(); } }