コード例 #1
0
 public async void Run(PlayersComponent players)
 {
     await world.GetBehavior <Sender>().NotifyAsync(players.Players(), FuncDefine.onPlaying, new IdData()
     {
         id = players[players.current]
     });
 }
コード例 #2
0
        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();
        }
コード例 #3
0
        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
                });
            }
        }