IEnumerator moveAI(Unit aiUnit, Vector3 targetFloor) { //target position is as same as aiUnit, don't need to move if (aiUnit.transform.position == targetFloor) { Debug.Log(aiUnit.name + " don't need to move"); yield return(0); } else { //auto move forward target aiUnit.GetComponent <CharacterAction>().SetSkill("Move"); Move moveSkill = SkillManager.GetInstance().skillQueue.Peek().Key as Move; moveSkill.Init(aiUnit.transform); GameObject floor = BattleFieldManager.GetInstance().GetFloor(targetFloor); moveSkill.Focus(floor.GetComponent <Floor>()); yield return(new WaitForSeconds(0.5f)); outline.CancelRender(); moveSkill.Confirm(); yield return(new WaitUntil(() => { return moveSkill.skillState == Skill.SkillState.reset; })); } }
public IEnumerator playFree(int playerNumber) { var nonMyUnits = UnitManager.GetInstance().units.FindAll(u => u.playerNumber == playerNumber); foreach (var u in nonMyUnits) { if (outline) { outline.RenderOutLine(u.transform); } rtsCamera.FollowTarget(u.transform.position); if (u.GetComponent <Unit>().UnitEnd) { } else { yield return(StartCoroutine(aiFreeBattle.ActiveAI(u))); u.OnUnitEnd(); //真正的回合结束所应执行的逻辑。 DebugLogPanel.GetInstance().Log(u.GetComponent <CharacterStatus>().roleCName + "执行完毕"); } yield return(new WaitForSeconds(1f)); } outline.CancelRender(); RoundManager.GetInstance().EndTurn(); }
private IEnumerator Play() { var myUnits = UnitManager.GetInstance().units.FindAll(u => u.playerNumber == playerNumber); foreach (var u in myUnits) { if (u.GetComponent<Unit>().UnitEnd) break; rtsCamera.FollowTarget(u.transform.position); outline.RenderOutLine(u.transform); if (u.GetComponent<CharacterStatus>().roleEName == "Rock") { u.OnUnitEnd(); //真正的回合结束所应执行的逻辑。 DebugLogPanel.GetInstance().Log(u.GetComponent<CharacterStatus>().roleCName + "执行完毕"); yield return new WaitForSeconds(1f); } else { yield return StartCoroutine(UseSkill("EarthStyleDorodomuBarrier", u.transform)); u.OnUnitEnd(); //真正的回合结束所应执行的逻辑。 DebugLogPanel.GetInstance().Log(u.GetComponent<CharacterStatus>().roleCName + "执行完毕"); yield return new WaitForSeconds(1f); } } outline.CancelRender(); RoundManager.GetInstance().EndTurn(); }
private IEnumerator JiroubouDrama() { Unit u = UnitManager.GetInstance().units.Find(p => p.name == "jiroubou_1"); rtsCamera.FollowTarget(u.transform.position); outline.RenderOutLine(u.transform); yield return(StartCoroutine(UseSkill("EarthStyleDorodomuBarrier", u.transform))); u.OnUnitEnd(); //真正的回合结束所应执行的逻辑。 DebugLogPanel.GetInstance().Log(u.GetComponent <CharacterStatus>().roleCName + "执行完毕"); yield return(new WaitForSeconds(1f)); outline.CancelRender(); yield return(0); }
private IEnumerator Play() { var myUnits = UnitManager.GetInstance().units.FindAll(u => u.playerNumber == playerNumber); foreach (var u in myUnits) { if (u.GetComponent <Unit>().UnitEnd) { break; } rtsCamera.FollowTarget(u.transform.position); outline.RenderOutLine(u.transform); if (u.GetComponent <CharacterStatus>().roleEName == "Rock") { var currentHp = u.GetComponent <CharacterStatus>().attributes.Find(d => d.eName == "hp").value; var currentHPMax = u.GetComponent <CharacterStatus>().attributes.Find(d => d.eName == "hp").valueMax; var restValue = (int)(currentHPMax * 0.3f); restValue = currentHp + restValue > currentHPMax ? currentHPMax - currentHp : restValue; var hp = currentHp + restValue; UIManager.GetInstance().FlyNum(u.GetComponent <CharacterStatus>().arrowPosition / 2 + u.transform.position + Vector3.down * 0.2f, restValue.ToString(), UIManager.hpColor); ChangeData.ChangeValue(u.transform, "hp", hp); u.OnUnitEnd(); //真正的回合结束所应执行的逻辑。 DebugLogPanel.GetInstance().Log(u.GetComponent <CharacterStatus>().roleCName + "执行完毕"); yield return(new WaitForSeconds(1f)); } else { yield return(StartCoroutine(UseSkill("EarthStyleDorodomuBarrier", u.transform))); u.OnUnitEnd(); //真正的回合结束所应执行的逻辑。 DebugLogPanel.GetInstance().Log(u.GetComponent <CharacterStatus>().roleCName + "执行完毕"); yield return(new WaitForSeconds(1f)); } } outline.CancelRender(); RoundManager.GetInstance().EndTurn(); }