Beispiel #1
0
        public void NewTGame()
        {
            game = new Treasure.Game(new GameParameters()
            {
                FieldWidth  = 6,
                FieldHeight = 6,
                PortalCount = 0,
                SwampCount  = 0,
                SwampSize   = 0,
                PlayerCount = 4,
            }, null, rnd);
            game.InitializeField();

            /*
             * game.field[1, 1].terrainType = TerrainType.Field;
             * game.field[2, 1].terrainType = TerrainType.Field;
             * game.field[3, 1].terrainType = TerrainType.Field;
             * game.field[4, 1].terrainType = TerrainType.Water;
             * game.field[1, 2].terrainType = TerrainType.Field;
             * game.field[2, 2].terrainType = TerrainType.Water;
             * game.field[3, 2].terrainType = TerrainType.Water;
             * game.field[4, 2].terrainType = TerrainType.Water;
             * game.field[1, 3].terrainType = TerrainType.Field;
             * game.field[2, 3].terrainType = TerrainType.Water;
             * game.field[3, 3].terrainType = TerrainType.Water;
             * game.field[4, 3].terrainType = TerrainType.Field;
             * game.field[1, 4].terrainType = TerrainType.Field;
             * game.field[2, 4].terrainType = TerrainType.Field;
             * game.field[3, 4].terrainType = TerrainType.Water;
             * game.field[4, 4].terrainType = TerrainType.Field;
             */
        }
Beispiel #2
0
        public void NewTGame(int seed)
        {
            game = new Treasure.Game(new GameParameters()
            {
                FieldWidth  = 6,
                FieldHeight = 6,
                PortalCount = 0,
                SwampCount  = 0,
                SwampSize   = 0,
                PlayerCount = 4,
            }, null, rnd.Next());
            game.InitializeField();
            bool b = false;

            while (!b)
            {
                b = game.InitializeField();
            }
        }
Beispiel #3
0
        public void GenerateGame()
        {
            var gp = new GameParameters()
            {
                FieldWidth  = screenSize.X / a,
                FieldHeight = screenSize.Y / a,
                PortalCount = 3,
                SwampCount  = 4,
                SwampSize   = 3,
                PlayerCount = 4,
            };

            game = new Treasure.Game(gp, new IPlayerController[] { new BotController(gp), new BotController(gp), new BotController(gp), new BotController(gp) }, new Random());

            game.InitializeField();
        }
Beispiel #4
0
        private void TryStartGame(object sender, EventArgs e)
        {
            var gameParameters = new GameParameters()
            {
                FieldHeight = widthBar.Value,
                FieldWidth  = heightBar.Value,
                PortalCount = portalBar.Value,
                SwampCount  = swampBar.Value,
                SwampSize   = swampSizeBar.Value,
                Through     = throughCheckBox.Checked,
                PlayerCount = playersInfo.Count,
            };

            IPlayerController[] controllers = new IPlayerController[playersInfo.Count];

            Dictionary <PlayerType, Func <IPlayerController> > dict = new Dictionary <PlayerType, Func <IPlayerController> >()
            {
                { PlayerType.Human, () => new SignalingPlayerContoller() },
                { PlayerType.RandomBot, () => new BotController(gameParameters) },
            };

            for (int i = 0; i < playersInfo.Count; i++)
            {
                controllers[i] = dict[playersInfo[i].type]();
            }

            Treasure.Game game = new Treasure.Game(gameParameters, controllers, new Random());
            if (game.InitializeField())
            {
                ActivityBridge.game = game;
                ActivityBridge.playersParameters = Enumerable.Range(0, playersInfo.Count).Select(_ => new PlayerParameters(playersInfo[_].name, _)).ToArray();
                //Finish();
                StartActivity(typeof(GameActivity));
            }
            else
            {
                Toast.MakeText(this, "Ohh... Your parametres is so hard! Choose something else.", ToastLength.Short).Show();
            }
        }