public async void Run(PlayersComponent players) { await world.GetBehavior <Sender>().NotifyAsync(players.Players(), FuncDefine.onPlaying, new IdData() { id = players[players.current] }); }
public async void Run(PlayersComponent players, int win) { players.entity.RemoveComponent <TimeCounterComponent>(); foreach (var item in players.Players()) { world.GetComponent <InfoComponent>(item)?.Reset(); } players.Slibing <ChessComponent>().Clear(); await world.GetBehavior <Sender>().NotifyAsync(players.Players(), FuncDefine.onOver, new IdData { id = players[win] }); players.Clear(); }
public async void Run(PlayersComponent players) { players.entity.AddComponent <ChessComponent>(); int idx = world.GetBehavior <RandomBhr>().Range(0, 2); players.current = idx; world.GetComponent <InfoComponent>(players[idx]).color = Define.white; world.GetComponent <InfoComponent>(players[1 - idx]).color = Define.black; var sender = world.GetBehavior <Sender>(); foreach (var item in players.Players()) { await sender.SendAsync(item, FuncDefine.onInitGame, new StartGame() { color = world.GetComponent <InfoComponent>(item).color }); } }