public static void MoveAI(FightUnitPoint selectedUnit, List <FightUnitPoint> enemyList, System.Action onMove) { System.Action waitMove = () => { Thread.Sleep(waitTimeMs); Threading.Execute(delegate { selectedUnit.TryAction(enemyList.Find((FightUnitPoint unit) => unit.Squad != null)); onMove.Invoke(); }); }; Thread waitThread = new Thread(new ThreadStart(waitMove)); waitThread.Start(); }
public static void SendOnClient(System.Action <GameState, System.DateTime> success, GameState gameState, List <Command> processedCommand, System.DateTime sendTime) { System.Action send = () => { gameState = new GameState(gameState); Thread.Sleep(ping / 2); Threading.Execute(delegate { lock (processedCommand) { foreach (Command command in processedCommand.ToArray()) { command.isApply = true; } success.Invoke(gameState, sendTime); } }); }; Thread SendThread = new Thread(new ThreadStart(send)); SendThread.Start(); }