예제 #1
0
        public void EatFood(int id, Guid id_player, FoodPoint foodPoint)
        {
            var foodServer = FoodPoint.FoodPoints.FirstOrDefault(i => i.ID == id);

            FoodPoint.FoodPoints.Remove(foodServer);
            FoodPoint.FoodPoints.Add(foodPoint);

            var player = AllPlayers.players.FirstOrDefault(i => i.ID == id_player);

            player.Size++;
            player.Score++;

            foreach (PlayerServer playerServer in AllPlayers.players)
            {
                if (id_player != playerServer.ID)
                {
                    playerServer.OperationContext.GetCallbackChannel <IClientCallback>().EnemyEatFood(foodPoint, id, id_player);
                }
            }
        }
예제 #2
0
 public Service1()
 {
     FoodPoint.CreateFood();
 }