Example #1
0
        public Task StartSinglePlayer(string playerName)
        {
            AddPlayer(playerName);

            IsStarted    = true;
            AnimalStates = AnimalStateCollection.InitialGameState();

            return(PublishEventAsync(new GameStartedEvent
            {
                GameName = Entity.Current.EntityKey,
                Players = PlayerStates
                          .Select(player => new Messages.PlayerState
                {
                    Name = player.Name,
                    Credits = player.Credits
                })
                          .ToList(),
                Animals = AnimalStates
                          .Select(animal => new Messages.AnimalState
                {
                    Name = animal.Name,
                    Price = animal.Price,
                    OwnerName = animal.OwnerName,
                    EnclosureName = animal.EnclosureName
                })
                          .ToList()
            }));
        }