Exemple #1
0
        public BattleGameState(ShooterGame game)
            : base(game)
        {
            Game    = game;
            Map     = new GameMap();
            MapView = new GameMapView(this);
            UIViewport mapViewport = new UIViewport(0, 0, UI.Width, UI.Height, MapView, game);

            mapViewport.IsAlwaysAtBottom = true;

            UI.Add(mapViewport);
        }
Exemple #2
0
 private void LoadSurfaces()
 {
     surfacesAnimations = GameMapView.EnumerateSurfaceAnimations();
     foreach (var pair in surfacesAnimations)
     {
         var newButton = new Button()
         {
             Content = new Image()
             {
                 Source  = pair.Value[0],
                 Stretch = System.Windows.Media.Stretch.None
             },
             ToolTip = pair.Key,
             Tag     = pair.Key,
         };
         newButton.Click += SurfaceButton_Click;
         mapToolBar.Items.Add(newButton);
     }
 }
Exemple #3
0
        public override void Initialize()
        {
            // setup players
            var humanPlayer = new PlayerHuman();

            // setup map/board
            Globals.Instance.GameWorld.Intialize(200, 160, humanPlayer, null);

            //humanPlayer.UnitMoved += Player_UnitMoved;
            //humanPlayer.TurnEnded += Player_TurnEnded;
            //humanPlayer.AddSettlement("Margeritaville", Point2.Create(1, 1), Globals.Instance.RaceTypes[0]);
            humanPlayer.AddUnit(4, Point2.Create(2, 2)); // cavalry
            humanPlayer.AddUnit(0, Point2.Create(0, 1)); // spearman
            humanPlayer.StartTurn();

            _hud = new Hud(Game);
            _hud.Initialize();
            _gameMapView = new GameMapView(Globals.Instance.GameWorld, new Rectangle(0, 0, Game.GraphicsDevice.Viewport.Width, Game.GraphicsDevice.Viewport.Height), _hud);
            _unitsView   = new UnitsView(Globals.Instance.GameWorld);

            Globals.Instance.GameWorld.StartTurnForHumanPlayer();
        }
Exemple #4
0
 private void NewFileMenuItem_Click(object sender, RoutedEventArgs e)
 {
     currentMap      = new Map();
     mapImage.Source = GameMapView.DrawMap(currentMap);
     ChangeInterfaceState(true);
 }