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); }
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); } }
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(); }
private void NewFileMenuItem_Click(object sender, RoutedEventArgs e) { currentMap = new Map(); mapImage.Source = GameMapView.DrawMap(currentMap); ChangeInterfaceState(true); }