private void NewGameButton_Click(object sender, EventArgs e) { ShipConstants.Initialize(); Ship Ship = new Ship(); Ship.Initialize(ShipConstants.ROOMPOINTS); Texture2D sheet = _content.Load <Texture2D>("STSsheet"); SpriteSheet spriteSheet = new SpriteSheet(sheet, 32, 32); Texture2D tileTexture = _content.Load <Texture2D>("Tile"); Dictionary <Component.Component_Type, Sprite> textures = new Dictionary <Component.Component_Type, Sprite>(); textures.Add(Component.Component_Type.Power_Generation, spriteSheet[0]); textures.Add(Component.Component_Type.Power_Storage, spriteSheet[1]); textures.Add(Component.Component_Type.Weapon, spriteSheet[2]); textures.Add(Component.Component_Type.Material_Storage, spriteSheet[3]); textures.Add(Component.Component_Type.Structure, spriteSheet[4]); Ship.LoadContent(textures, tileTexture); _game.ChangeState(new BuildState(_game, _graphicsDevice, _content, Ship)); }
private IEnumerable <Ship> GenerateShips() { var takenCoodinateKeys = new Dictionary <string, string>(); foreach (var ship in ShipConstants.GetShipTypesPerPlayer()) { yield return(GenerateShipFor(ship, ref takenCoodinateKeys)); } }
public CombatState(Game1 game, GraphicsDevice graphicsDevice, ContentManager content, Ship ship) : base(game, graphicsDevice, content) { ShipConstants.Initialize(); Ship = ship; Ship.CurrentHealth = Ship.MaxHealth; Ship.Attacks = new List <Tuple <Room, Projectile.Attack_Against> >(); _oldMaterialCount = Ship.Material; projectileTexture = _content.Load <Texture2D>("Pixel"); Texture2D buttonTexture = _content.Load <Texture2D>(ControlConstants.BUTTON_TEXTURE); SpriteFont buttonFont = _content.Load <SpriteFont>(ControlConstants.BUTTON_FONT); Texture2D tileTexture = content.Load <Texture2D>("Tile"); _pixelTexture = _content.Load <Texture2D>(Config.PIXEL_TEXTURE); Dictionary <Component.Component_Type, Texture2D> textures = new Dictionary <Component.Component_Type, Texture2D>(); Texture2D weaponTexture = content.Load <Texture2D>("Component_Weapon"); textures.Add(Component.Component_Type.Weapon, weaponTexture); Texture2D structureTexture = content.Load <Texture2D>("Structure"); textures.Add(Component.Component_Type.Structure, structureTexture); _canvas = new CombatStateTargetUI(content); _canvas.SetShipGridLocation(Ship.Grid.Info.GridRectangle); _canvas.InitializeButton(TargetEnemyShipButton_Click, ControlConstants.COMBATMODE_TARGETENEMYSHIP.Text); _canvas.InitializeButton(TargetStoragesButton_Click, ControlConstants.COMBATMODE_TARGETSTORAGES.Text); _canvas.InitializeButton(TargetWeaponsButton_Click, ControlConstants.COMBATMODE_TARGETWEAPONS.Text); _canvas.InitializeButton(TargetPowerGenButton_Click, ControlConstants.COMBATMODE_TARGETPOWERGEN.Text); _canvas.InitializeButton(TargetPowerStorageButton_Click, ControlConstants.COMBATMODE_TARGETPOWERSTORAGE.Text); _canvas.InitializeButton(FireWeaponButton_Click, ControlConstants.COMBATMODE_FIREWEAPON.Text); _canvas.InitializeButton(RepairRoomButton_Click, ControlConstants.COMBATMODE_REPAIRROOM.Text); Button BuildModeButton = new Button(buttonTexture, buttonFont) { ButtonInfo = ControlConstants.COMBATMODE_BUILDMODE }; _selectedRoomBox = new UIBox(_pixelTexture) { UIBoxInfo = ControlConstants.ROOM_INFO_BOX, Color = new Color(Color.White, ControlConstants.ROOM_INFO_BOX_ALPHA) }; _playerHealthBar = new ProgressBar(_pixelTexture, buttonFont) { ProgressBarInfo = ControlConstants.PLAYER_HEALTHBAR }; _playerHealthBar.Value = 0.5f; _playerPowerBar = new ProgressBar(_pixelTexture, buttonFont) { ProgressBarInfo = ControlConstants.PLAYER_POWERBAR }; BuildModeButton.Click += BuildModeButton_Click; _uicomponents = new List <UI_Component> { BuildModeButton, _canvas, _selectedRoomBox, _playerHealthBar, _playerPowerBar }; _tooltip = new Tooltip(_pixelTexture, buttonFont); Ship.LoadContent(textures, tileTexture); this.Ship = ship; Ship.SetShipHealth(); Ship.SetCombatValues(); enemyAI = new EnemyAI(this.Ship, this); projectiles = new List <Projectile>(); deadProjectiles = new List <Projectile>(); clicked_State = Clicked_State.None; }
public PlayerStatus(Player player) { OpponentShipStatus = ShipConstants.GetShipTypesPerPlayer().ToDictionary(ship => ship, value => false); PlayerShipStatus = ShipConstants.GetShipTypesPerPlayer().ToDictionary(ship => ship, value => false); Player = player; }