private void SetExcuteOpr(int index, ExcuteOrder opr) { if (m_excuteOpr < opr) { m_excuteIndex = index; m_excuteOpr = opr; } }
public void CheckBattleState() { m_excuteIndex = -1; m_excuteOpr = 0; m_randomList.Clear(); m_attackList.Clear(); var battleRoads = AnimalChecker.GetAIBattleInfo(); for (int i = 0; i < battleRoads.Length; i++) { if (battleRoads[i].OtherMaxMoveDis >= GiveUpDis /**|| !battleRoads[i].IsLastBodyMoveOut**/) { continue; } else if (battleRoads[i].OtherMaxMoveDis >= ImportantDefendDis && battleRoads[i].RoadOtherAllPower >= battleRoads[i].RoadSelfAllPower) { SetExcuteOpr(i, ExcuteOrder.ImportDefend); } else if (battleRoads[i].OtherMaxMoveDis >= DefendDis && battleRoads[i].RoadOtherAllPower >= battleRoads[i].RoadSelfAllPower) { SetExcuteOpr(i, ExcuteOrder.Defend); } else if (battleRoads[i].OtherMaxMoveDis == 0) { SetExcuteOpr(i, ExcuteOrder.Attack); m_attackList.Add(i); } else { SetExcuteOpr(i, ExcuteOrder.Random); m_randomList.Add(i); } } if (m_excuteOpr == ExcuteOrder.Random) { int excuteIndex = UnityEngine.Random.Range(0, m_randomList.Count); AnimalChecker.ExcuteOpr(excuteIndex, 0); } else if (m_excuteOpr == ExcuteOrder.Attack) { int excuteIndex = UnityEngine.Random.Range(0, m_attackList.Count); AnimalChecker.ExcuteOpr(excuteIndex, 0); } else if (m_excuteOpr != ExcuteOrder.None) { float power = battleRoads[m_excuteIndex].RoadOtherAllPower - battleRoads[m_excuteIndex].RoadSelfAllPower; AnimalChecker.ExcuteOpr(m_excuteIndex, power); } }