public void Init(params object[] args) { manualReleaseAnalysisor = new BattleSkillManualReleaseAnalysisor(); battleSkillEffectAnalysis = new BattleSkillEffectAnalysis(); BattleManager.Instance.MgrLog("Battle calculator inited."); }
//某个战斗单位点击了使用技能 public void BattleUnitUseSkill(BattleUnit battleUnit, SO_BattleSkill skill) { if (battleUnit == null || battleUnit.battleUnitRenderer == null || !battleUnit.battleUnitRenderer.Equals(manualOperatingBattleUnitRenderer)) { UtilityHelper.LogError("Battle unit use skill failed."); HideManualActionList(); return; } //获取推算的技能释放结果 usedManualReleaseAnalysisor = BattleCalculator.Instance.ManualReleaseAnalysisor; //分析结果 usedManualReleaseAnalysisor.Analysis(manualOperatingBattleUnitRenderer.battleUnit, skill); //显示技能释放范围 if (skill.GetReleaseRadius(battleUnit.mapGrid) > 0) { SetCircularRangeRenderStateActive( true, GridRenderType.SkillReleaseRange, battleUnit.mapGrid.row, battleUnit.mapGrid.column, skill.GetReleaseRadius(battleUnit.mapGrid)); } //根据类型判断技能显示状态 switch (skill.targetType) { //对单个目标 case BattleSkillTargetType.BattleUnit: //可以被选中的 for (int i = 0; i < usedManualReleaseAnalysisor.suitableUnits.Count; ++i) { usedManualReleaseAnalysisor.suitableUnits[i].battleUnitRenderer.UpdateRenderState(BattleUnitRenderState.Selectable); } //不可以被选中的 for (int i = 0; i < usedManualReleaseAnalysisor.distanceLimit.Count; ++i) { usedManualReleaseAnalysisor.distanceLimit[i].battleUnitRenderer.UpdateRenderState(BattleUnitRenderState.NotSelectable); } //队伍不合适的 for (int i = 0; i < usedManualReleaseAnalysisor.teamLimit.Count; ++i) { usedManualReleaseAnalysisor.teamLimit[i].battleUnitRenderer.UpdateRenderState(BattleUnitRenderState.Normal); } //设定技能操作类型 skillOperationType = skill.effectRadius > 0 ? SkillOperationType.SurroundBattleUnit : SkillOperationType.SingleBattleUnitTarget; break; //对范围(某一个位置)目标 case BattleSkillTargetType.GridUnit: skillOperationType = SkillOperationType.GridUnitTarget; //如果没有位置可选,则直接打开范围 if (skill.GetReleaseRadius(battleUnit.mapGrid) <= 0) { //可以被选中,标记为已被选中 for (int i = 0; i < usedManualReleaseAnalysisor.suitableUnits.Count; ++i) { usedManualReleaseAnalysisor.suitableUnits[i].battleUnitRenderer.UpdateRenderState(BattleUnitRenderState.Selected); } //不可以被选中的 for (int i = 0; i < usedManualReleaseAnalysisor.distanceLimit.Count; ++i) { usedManualReleaseAnalysisor.distanceLimit[i].battleUnitRenderer.UpdateRenderState(BattleUnitRenderState.NotSelectable); } //队伍不合适的 for (int i = 0; i < usedManualReleaseAnalysisor.teamLimit.Count; ++i) { usedManualReleaseAnalysisor.teamLimit[i].battleUnitRenderer.UpdateRenderState(BattleUnitRenderState.Normal); } OnBattleUnitAndGridTouched_StateSkill_GridUnitTarget(battleUnit.mapGrid, null); } else { //需要指定范围,需要点击目标地块 } break; //以自身为中心的 case BattleSkillTargetType.Self: //可以被选中,标记为已被选中 for (int i = 0; i < usedManualReleaseAnalysisor.suitableUnits.Count; ++i) { usedManualReleaseAnalysisor.suitableUnits[i].battleUnitRenderer.UpdateRenderState(BattleUnitRenderState.Selected); } //不可以被选中的 for (int i = 0; i < usedManualReleaseAnalysisor.distanceLimit.Count; ++i) { usedManualReleaseAnalysisor.distanceLimit[i].battleUnitRenderer.UpdateRenderState(BattleUnitRenderState.NotSelectable); } //队伍不合适的 for (int i = 0; i < usedManualReleaseAnalysisor.teamLimit.Count; ++i) { usedManualReleaseAnalysisor.teamLimit[i].battleUnitRenderer.UpdateRenderState(BattleUnitRenderState.Normal); } skillOperationType = SkillOperationType.SurroundSelf; //省去一步点击操作,直接展示区域 OnBattleUnitAndGridTouched_StateSkill_SurroundSelf(battleUnit.mapGrid, battleUnit); break; default: break; } //切换操作状态 manualOperationState = ManualOperationState.Skill; HideManualActionList(); }