// 重置角色 ai public void ResetWarriorAI(Warrior warrior) { if (!AIs.ContainsKey(warrior.Team)) { AIs[warrior.Team] = new Dictionary <int, WarriorAI>(); } AIs[warrior.Team][warrior.IDInMap] = warrior.AI; }
public void StartNextRound(int player) { BeforeStartNextRound1?.Invoke(player); BeforeStartNextRound2?.Invoke(player); // 处理所属当前队伍的 ai if (AIs.ContainsKey(player)) { var ais = AIs[player].Values.ToArray(); ais.Resort(); foreach (var id in AIs[player].Keys.ToArray()) { AIs[player][id].ActFirst?.Invoke(); } } OnNextRoundStarted?.Invoke(player); AfterStartNextRound?.Invoke(player); }
public void ActionDone(int player) { BeforeActionDone?.Invoke(player); OnActionDone?.Invoke(player); // 处理所属当前队伍的 ai if (AIs.ContainsKey(player)) { var ais = AIs[player].Values.ToArray(); ais.Resort(); foreach (var id in AIs[player].Keys.ToArray()) { AIs[player][id].ActLast?.Invoke(); } } AfterActionDone?.Invoke(player); TryBattleEnd(); // 回合结束时检查战斗结束条件 Move2NextPlayer(player); // 行动机会转移至下一队伍 }