public HttpResponseMessage Get()
        {
            var players  = TableManager.Get <PlayerEntity>(TableData.PlayersTable).ToList();
            var captains = TableManager.Get <CaptainEntity>(TableData.CaptainsTable).ToList();

            return(this.Response(() => PlayerGenerator.Generate(players, captains), null));
        }
Exemple #2
0
    void LoadPlayer()
    {
        var playerStore = new PlayerStore(this);

        if (playerStore.playerPersisted)
        {
            player  = playerStore.Load();
            newGame = false;
        }
        else
        {
            var playerGen = new PlayerGenerator(this);
            player = playerGen.Generate();
        }
    }
        static void Main(string[] args)
        {
            string json = System.IO.File.ReadAllText($"{AppContext.BaseDirectory}/appsettings.json");

            AppSettings settings = Newtonsoft.Json.JsonConvert.DeserializeObject <AppSettings>(json);

            StandardDeckGenerator standardDeckGenerator = new StandardDeckGenerator();

            var deck = standardDeckGenerator.Generate();

            PlayerGenerator playerGenerator = new PlayerGenerator();

            var players = playerGenerator.Generate(settings.NumberOfPlayers);

            Console.WriteLine("Done");
        }
        void OnGUI()
        {
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Monster");
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Begin Index");
            mMonsterGenerator.BeginIndex = EditorGUILayout.IntField(mMonsterGenerator.BeginIndex);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("End Index");
            mMonsterGenerator.EndIndex = EditorGUILayout.IntField(mMonsterGenerator.EndIndex);
            EditorGUILayout.EndHorizontal();

            if (!mMonsterGenerator.IsGenerating)
            {
                if (GUILayout.Button("Generate"))
                {
                    mMonsterGenerator.Generate();
                }
            }
            else
            {
                mMonsterGenerator.Update();
            }

            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Player");
            if (GUILayout.Button("Generate"))
            {
                mPlayerGenerator.Generate();
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Terrain");
            if (GUILayout.Button("Generate"))
            {
                mTerrainGenerator.Generate();
            }
            EditorGUILayout.EndVertical();
        }
Exemple #5
0
        public static Game CreateGame()
        {
            var players = TableManager.Get <PlayerEntity>(TableData.PlayersTable).ToList();

            if (players.Count < TeamPlayerCount)
            {
                throw new ArgumentException($"Number of generated players should be greater than {TeamPlayerCount}");
            }

            var captains = TableManager.Get <CaptainEntity>(TableData.CaptainsTable).ToList();

            var allPlayers = PlayerGenerator.Generate(players, captains);
            var shuffled   = RandomSelectors.Shuffle(Seeder.Random(), allPlayers).ToList();

            var game = new Game(shuffled.Take(TeamPlayerCount), shuffled.Skip(shuffled.Count - TeamPlayerCount));

            Save(game);

            return(game);
        }
Exemple #6
0
    public void AddPlayer(GameObject gameObject)
    {
        PlayerGenerator player = new PlayerGenerator();

        player.Generate(gameObject);
    }
Exemple #7
0
 void LoadPlayer()
 {
     var playerStore = new PlayerStore(this);
     if (playerStore.playerPersisted) {
       player = playerStore.Load();
       newGame = false;
     } else {
       var playerGen = new PlayerGenerator(this);
       player = playerGen.Generate();
     }
 }
Exemple #8
0
        public void CorrectAmountOfUsersGenerated()
        {
            List <Player> players = sut.Generate(amount: 2);

            Assert.Equal(2, players.Count);
        }