/// <summary> /// 战斗状态改变 /// </summary> /// <param name="state"></param> public void OnFightStateChange(FightState state) { switch (state) { case FightState.Init: break; case FightState.Prepare: //设置所有单位初始站位,目标站位 for (int idx = 0; idx < AllFighters.Count; ++idx) { AllFighters[idx].SystemProtect = false; AllFighters[idx].InitPassiveSkill(); } ZEventSystem.Register(EventConst.OnUnitMoveOver, this, "OnUnitMoveOver"); EnterBattileField(); break; case FightState.Fight: EDebug.Log("战斗开始"); CamMgrObj.ChangeCam(true); //使用被动技能 for (int idx = 0; idx < AllFighters.Count; ++idx) { FightUnit u = AllFighters[idx]; if (u.IsDead) { continue; } AllFighters[idx].FightIntervalAcc = 0; AllFighters[idx].FightInterval = 0; } break; case FightState.Continue: CamMgrObj.ChangeCam(false); clearFightState(false); for (int idx = 0; idx < Fighters.Count; ++idx) { FightUnit u = Fighters[idx]; if (u.IsDead) { continue; } u.RoundOver(); u.NewRound(); } ExitBattleField(); break; case FightState.Over: EDebug.Log("战斗结束, 是否胜利:" + HasWin); clearFightState(true); break; default: break; } }