Beispiel #1
0
        public VictoryForm(Form gameForm, Faction victor)
        {
            InitializeComponent();

            GameForm = gameForm;

            BackColor = Game.GetFactionColor(victor);

            switch (victor)
            {
            case Faction.England:
                VictoryPictureBox.Image = Bitmaps.Get("Data\\BritishVictory.jpg");
                break;

            case Faction.Germany:
                VictoryPictureBox.Image = Bitmaps.Get("Data\\GermanVictory.jpg");
                break;

            case Faction.USA:
                VictoryPictureBox.Image = Bitmaps.Get("Data\\USAVictory.jpg");
                break;

            case Faction.Japan:
                VictoryPictureBox.Image = Bitmaps.Get("Data\\JapaneseVictory.jpg");
                break;

            default:
                VictoryPictureBox.Image = Bitmaps.Get("Data\\Title.jpg");
                break;
            }
        }
            public static Scenario Load(XElement scenarioNode)
            {
                Scenario scenario = new Scenario();

                scenario.Name        = XmlUtils.GetAttributeValue <string>(scenarioNode, "Name");
                scenario.Description = scenarioNode.Value;
                scenario.Map         = Bitmaps.Get(XmlUtils.GetAttributeValue <string>(scenarioNode, "Bitmap"));

                return(scenario);
            }
Beispiel #3
0
        public OrdersDisplay()
        {
            InitializeComponent();

            MovePictureBox.SizeMode           = PictureBoxSizeMode.Zoom;
            MovePictureBox.Image              = Bitmaps.Get("Data\\Move.png");
            LightArtilleryPictureBox.SizeMode = PictureBoxSizeMode.Zoom;
            LightArtilleryPictureBox.Image    = Bitmaps.Get("Data\\LightArtillery.png");
            HeavyArtilleryPictureBox.SizeMode = PictureBoxSizeMode.Zoom;
            HeavyArtilleryPictureBox.Image    = Bitmaps.Get("Data\\HeavyArtillery.png");
            RepairPictureBox.SizeMode         = PictureBoxSizeMode.Zoom;
            RepairPictureBox.Image            = Bitmaps.Get("Data\\Repair.png");
            BuildPictureBox.SizeMode          = PictureBoxSizeMode.Zoom;
            BuildPictureBox.Image             = Bitmaps.Get("Data\\Build.png");
            LoadPictureBox.SizeMode           = PictureBoxSizeMode.Zoom;
            LoadPictureBox.Image              = Bitmaps.Get("Data\\Load.png");
            UnloadPictureBox.SizeMode         = PictureBoxSizeMode.Zoom;
            UnloadPictureBox.Image            = Bitmaps.Get("Data\\Unload.png");
            TorpedoPictureBox.SizeMode        = PictureBoxSizeMode.Zoom;
            TorpedoPictureBox.Image           = Bitmaps.Get("Data\\Torpedo.png");
            DivePictureBox.SizeMode           = PictureBoxSizeMode.Zoom;
            DivePictureBox.Image              = Bitmaps.Get("Data\\Dive.png");
            LoadTorpedoesPictureBox.SizeMode  = PictureBoxSizeMode.Zoom;
            LoadTorpedoesPictureBox.Image     = Bitmaps.Get("Data\\LoadTorpedoes.png");
            DepthChargePictureBox.SizeMode    = PictureBoxSizeMode.Zoom;
            DepthChargePictureBox.Image       = Bitmaps.Get("Data\\DepthCharge.png");
            InstallBatteryPictureBox.SizeMode = PictureBoxSizeMode.Zoom;
            InstallBatteryPictureBox.Image    = Bitmaps.Get("Data\\InstallBattery.png");
            CapturePictureBox.SizeMode        = PictureBoxSizeMode.Zoom;
            CapturePictureBox.Image           = Bitmaps.Get("Data\\Capture.png");
            MinePictureBox.SizeMode           = PictureBoxSizeMode.Zoom;
            MinePictureBox.Image              = Bitmaps.Get("Data\\Mine.png");
            LoadMinesPictureBox.SizeMode      = PictureBoxSizeMode.Zoom;
            LoadMinesPictureBox.Image         = Bitmaps.Get("Data\\LoadMines.png");
            SweepPictureBox.SizeMode          = PictureBoxSizeMode.Zoom;
            SweepPictureBox.Image             = Bitmaps.Get("Data\\Sweep.png");
            SearchMinesPictureBox.SizeMode    = PictureBoxSizeMode.Zoom;
            SearchMinesPictureBox.Image       = Bitmaps.Get("Data\\Search.png");
        }
Beispiel #4
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            if (Game == null)
            {
                return;
            }

            var USACounter     = Bitmaps.Get("Data\\USACounter.png");
            var germanyCounter = Bitmaps.Get("Data\\GermanyCounter.png");
            var japanCounter   = Bitmaps.Get("Data\\JapanCounter.png");
            var englandCounter = Bitmaps.Get("Data\\EnglandCounter.png");
            var neutralCounter = Bitmaps.Get("Data\\NeutralCounter.png");
            var selected       = Bitmaps.Get("Data\\Selected.png");

            DrawMap(pe.Graphics);

            // Draw Mines

            foreach (Mine mine in Game.Mines)
            {
                Point displayPos = MapToDisplay(mine.Position);

                if (mine.IsVisible || Game.CurrentPlayer != null && Game.CurrentPlayer.Faction == mine.Faction)
                {
                    if (displayPos.X > -CameraScale || displayPos.Y > -CameraScale)
                    {
                        if (displayPos.X < Width + CameraScale || displayPos.Y < Height + CameraScale)
                        {
                            Rectangle counterRect = new Rectangle(displayPos, new Size(CameraScale, CameraScale));
                            counterRect.Inflate(0 - counterRect.Width / 5, 0 - counterRect.Height / 5);

                            switch (mine.Faction)
                            {
                            case Faction.USA:
                                pe.Graphics.DrawImage(USACounter, counterRect);
                                break;

                            case Faction.Germany:
                                pe.Graphics.DrawImage(germanyCounter, counterRect);
                                break;

                            case Faction.Japan:
                                pe.Graphics.DrawImage(japanCounter, counterRect);
                                break;

                            case Faction.England:
                                pe.Graphics.DrawImage(englandCounter, counterRect);
                                break;

                            case Faction.Neutral:
                                pe.Graphics.DrawImage(neutralCounter, counterRect);
                                break;
                            }

                            pe.Graphics.DrawImage(Bitmaps.Get("Data\\Mine.png"), counterRect);
                        }
                    }
                }
            }

            // Draw Units
            if (Game.CurrentPlayer != null)
            {
                foreach (Unit unit in Game.Units)
                {
                    if (Game.IsUnitVisibleForPlayer(Game.CurrentPlayer, unit) || unit.Type.AlwaysVisible)
                    {
                        Point displayPos = MapToDisplay(unit.Position);
                        if (displayPos.X > -CameraScale || displayPos.Y > -CameraScale)
                        {
                            if (displayPos.X < Width + CameraScale || displayPos.Y < Height + CameraScale)
                            {
                                switch (unit.Player.Faction)
                                {
                                case Faction.USA:
                                    pe.Graphics.DrawImage(USACounter, new Rectangle(displayPos, new Size(CameraScale, CameraScale)));
                                    break;

                                case Faction.Germany:
                                    pe.Graphics.DrawImage(germanyCounter, new Rectangle(displayPos, new Size(CameraScale, CameraScale)));
                                    break;

                                case Faction.Japan:
                                    pe.Graphics.DrawImage(japanCounter, new Rectangle(displayPos, new Size(CameraScale, CameraScale)));
                                    break;

                                case Faction.England:
                                    pe.Graphics.DrawImage(englandCounter, new Rectangle(displayPos, new Size(CameraScale, CameraScale)));
                                    break;

                                case Faction.Neutral:
                                    pe.Graphics.DrawImage(neutralCounter, new Rectangle(displayPos, new Size(CameraScale, CameraScale)));
                                    break;
                                }
                                pe.Graphics.DrawImage(unit.Type.Bitmap, new Rectangle(new Point(displayPos.X, displayPos.Y), new Size(CameraScale, CameraScale)));
                                RectangleF stringRectangle = new RectangleF(new Point(displayPos.X, displayPos.Y), new Size(CameraScale, CameraScale));
                                stringRectangle.Inflate(-0.1f * CameraScale, -0.1f * CameraScale);
                                StringFormat bottomStringFormat = new StringFormat()
                                {
                                    Alignment     = StringAlignment.Center,
                                    LineAlignment = StringAlignment.Far
                                };
                                Font nameFont = GetFontFromSize(stringRectangle.Width, unit.Name, 0.1f * CameraScale, 0.16f * CameraScale, pe.Graphics);
                                pe.Graphics.DrawString(unit.Name, nameFont, Brushes.Black, stringRectangle, bottomStringFormat);
                                if (!string.IsNullOrEmpty(unit.Information))
                                {
                                    StringFormat topStringFormat = new StringFormat()
                                    {
                                        Alignment     = StringAlignment.Center,
                                        LineAlignment = StringAlignment.Near,
                                    };
                                    Font infoFont = GetFontFromSize(stringRectangle.Width, unit.Information, 0.1f * CameraScale, nameFont.Size, pe.Graphics);
                                    pe.Graphics.DrawString(unit.Information, infoFont, Brushes.Black, stringRectangle, topStringFormat);
                                }
                                if (Game.SelectedUnit == unit)
                                {
                                    Rectangle rectangle = new Rectangle(displayPos, new Size(CameraScale, CameraScale));
                                    rectangle.Inflate((int)Math.Round(CameraScale / 16f), (int)Math.Round(CameraScale / 16f));
                                    pe.Graphics.DrawImage(selected, rectangle);
                                }
                                if (unit.MovesLeft >= 1)
                                {
                                    Rectangle rectangle = new Rectangle(displayPos.X, displayPos.Y, CameraScale / 8, CameraScale / 8);
                                    pe.Graphics.FillEllipse(Brushes.White, rectangle);
                                    pe.Graphics.DrawEllipse(Pens.Black, rectangle);
                                }
                            }
                        }
                    }
                }
            }
            OrdersDisplay.Invalidate();
        }
Beispiel #5
0
 public MapDisplay()
 {
     _TileRenderer    = new TileRenderer(32);
     _OceanLayerId    = _TileRenderer.AddLayer(TileRenderer.LayerLayout.Corners, Bitmaps.Get("Data\\Ocean.png"), Bitmaps.Get("Data\\SeaWrap.png"));
     _LandLayerId     = _TileRenderer.AddLayer(TileRenderer.LayerLayout.Corners, Bitmaps.Get("Data\\Land.png"), null);
     _FogOfWarLayerId = _TileRenderer.AddLayer(TileRenderer.LayerLayout.Corners, Bitmaps.Get("Data\\FogOfWar.png"), Bitmaps.Get("Data\\FogOfWarWrap.png"));
     _RangesLayerId   = _TileRenderer.AddLayer(TileRenderer.LayerLayout.Corners, Bitmaps.Get("Data\\Ranges.png"), null);
     _SoundPlayer     = new SoundPlayer();
     _ToolTip         = new ToolTip();
     CachedTiles      = new Bitmap[16];
     CameraScale      = 20;
     _CurrentOrder    = null;
 }
Beispiel #6
0
        private void DrawMap2(Graphics graphics)
        {
            if (Terrain == null)
            {
                if (Image != null)
                {
                    graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;

                    graphics.DrawImage(Image, new Rectangle(0, 0, Width, Height), new Rectangle(0, 0, 128, 128), GraphicsUnit.Pixel);
                }
                return;
            }

            if (_TileRenderer == null)
            {
                _TileRenderer    = new TileRenderer(32);
                _OceanLayerId    = _TileRenderer.AddLayer(TileRenderer.LayerLayout.Corners, Bitmaps.Get("Data\\Ocean.png"), Bitmaps.Get("Data\\SeaWrap.png"));
                _LandLayerId     = _TileRenderer.AddLayer(TileRenderer.LayerLayout.Corners, Bitmaps.Get("Data\\Land.png"), null);
                _FogOfWarLayerId = _TileRenderer.AddLayer(TileRenderer.LayerLayout.Corners, Bitmaps.Get("Data\\FogOfWar.png"), Bitmaps.Get("Data\\FogOfWarWrap.png"));
                _RangesLayerId   = _TileRenderer.AddLayer(TileRenderer.LayerLayout.Corners, Bitmaps.Get("Data\\Ranges.png"), null);
            }

            CameraScale    = Width / Terrain.Width;
            CameraPosition = new Point(Terrain.Width / 2, Terrain.Height / 2);

            _TileRenderer.TileSize = CameraScale;
            _TileRenderer.DrawTiles(graphics, MapToDisplay(new Point(0, 0)), new Rectangle(0, 0, Terrain.Width, Terrain.Height), p =>
            {
                p.X           = Math.Min(Math.Max(p.X, 0), Terrain.Width - 1);
                p.Y           = Math.Min(Math.Max(p.Y, 0), Terrain.Height - 1);
                TerrainType t = Terrain.Get(p.X, p.Y, TerrainType.Sea);
                int result    = 0;
                switch (t)
                {
                case TerrainType.Sea: result |= _OceanLayerId; break;

                case TerrainType.Land: result |= _OceanLayerId | _LandLayerId; break;

                default: throw new Exception();
                }
                return(result);
            });

            Pen pen = new Pen(Color.FromArgb(64, 0, 0, 0));

            for (int x = 0; x < Terrain.Width; x++)
            {
                graphics.DrawLine(pen, MapToDisplay(new Point(x, 0)), MapToDisplay(new Point(x, Terrain.Height)));
            }
            for (int y = 0; y < Terrain.Height; y++)
            {
                graphics.DrawLine(pen, MapToDisplay(new Point(0, y)), MapToDisplay(new Point(Terrain.Width, y)));
            }
        }
Beispiel #7
0
        public void GameChanged()
        {
            if (MapDisplay.Game.CurrentPlayer == null)
            {
                BeginTurnButton.Show();
                NextTurnButton.Hide();
                BeginTurnButton.Text = "Begin " + MapDisplay.Game.NextPlayer.Faction.ToString() + "'s turn";
            }
            else
            {
                BeginTurnButton.Hide();
                NextTurnButton.Show();
            }

            MovePictureBox.BorderStyle           = BorderStyle.None;
            BuildPictureBox.BorderStyle          = BorderStyle.None;
            LoadPictureBox.BorderStyle           = BorderStyle.None;
            UnloadPictureBox.BorderStyle         = BorderStyle.None;
            RepairPictureBox.BorderStyle         = BorderStyle.None;
            LightArtilleryPictureBox.BorderStyle = BorderStyle.None;
            HeavyArtilleryPictureBox.BorderStyle = BorderStyle.None;
            TorpedoPictureBox.BorderStyle        = BorderStyle.None;
            DivePictureBox.BorderStyle           = BorderStyle.None;
            LoadTorpedoesPictureBox.BorderStyle  = BorderStyle.None;
            DepthChargePictureBox.BorderStyle    = BorderStyle.None;
            InstallBatteryPictureBox.BorderStyle = BorderStyle.None;
            CapturePictureBox.BorderStyle        = BorderStyle.None;
            MinePictureBox.BorderStyle           = BorderStyle.None;
            LoadMinesPictureBox.BorderStyle      = BorderStyle.None;
            SweepPictureBox.BorderStyle          = BorderStyle.None;
            SearchMinesPictureBox.BorderStyle    = BorderStyle.None;

            if (MapDisplay.Game.SelectedUnit != null)
            {
                DivePictureBox.Image = MapDisplay.Game.SelectedUnit.IsSubmerged ? Bitmaps.Get("Data\\Surface.png") : Bitmaps.Get("Data\\Dive.png");
            }

            switch (MapDisplay.CurrentOrder)
            {
            case null:
                break;

            case Order.Move:
                MovePictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.Build:
                BuildPictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.LightArtillery:
                LightArtilleryPictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.HeavyArtillery:
                HeavyArtilleryPictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.Repair:
                RepairPictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.Load:
                LoadPictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.Unload:
                UnloadPictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.Torpedo:
                TorpedoPictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.DiveOrSurface:
                DivePictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.LoadTorpedoes:
                LoadTorpedoesPictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.DepthCharge:
                DepthChargePictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.InstallBattery:
                InstallBatteryPictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.Capture:
                CapturePictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.Mine:
                MinePictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.LoadMines:
                LoadMinesPictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.Sweep:
                SweepPictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;

            case Order.SearchMines:
                SearchMinesPictureBox.BorderStyle = BorderStyle.Fixed3D;
                break;
            }

            if (MapDisplay.Game.CurrentPlayer != null)
            {
                FlagBox.Image          = Game.GetFactionFlag(MapDisplay.Game.CurrentPlayer.Faction);
                GreetingText.Text      = Game.GetFactionGreetings(MapDisplay.Game.CurrentPlayer.Faction);
                GreetingText.BackColor = Game.GetFactionColor(MapDisplay.Game.CurrentPlayer.Faction);
                NextTurnButton.Show();
                BeginTurnButton.Hide();
            }
            else
            {
                FlagBox.Image          = null;
                GreetingText.Text      = "Press the Begin Turn button.";
                GreetingText.BackColor = SystemColors.Control;
                NextTurnButton.Hide();
                BeginTurnButton.Show();
            }

            var selectedUnit = MapDisplay.Game.SelectedUnit;

            if (selectedUnit != null)
            {
                if (MapDisplay.Game.CurrentPlayer != null && MapDisplay.Game.CurrentPlayer.Faction != Faction.Neutral)
                {
                    if (MapDisplay.Game.CurrentPlayer == selectedUnit.Player)
                    {
                        OrdersPanel.Show();
                    }
                    UnitPanel.Show();
                    InfoPanel.Show();
                }

                UnitPictureBox.SizeMode = PictureBoxSizeMode.Zoom;
                UnitPictureBox.Image    = MapDisplay.Game.SelectedUnit.Type.LargeBitmap;
                UnitTextBox.Text        = selectedUnit.Name;
                UnitTextBox.Text       += " : " + selectedUnit.Type.Name;
                UnitTextBox.Text       += Environment.NewLine + "Integrity: " + Math.Round(selectedUnit.Health * 100).ToString() + "%";
                if (selectedUnit.Type.Capacity >= 1)
                {
                    UnitTextBox.Text += Environment.NewLine + "Cargo: " + selectedUnit.Cargo + "/" + selectedUnit.Type.Capacity;
                }
                if (selectedUnit.TurnsUntilCompletion > 0)
                {
                    UnitTextBox.Text += Environment.NewLine + "Turns until completion: " + selectedUnit.TurnsUntilCompletion;
                }
                if (selectedUnit.Type == UnitType.Submarine && selectedUnit.IsSubmerged)
                {
                    UnitTextBox.Text += Environment.NewLine + "Oxygen left: " + ((Submarine)selectedUnit).OxygenLeft.ToString();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.Torpedo))
                {
                    UnitTextBox.Text += Environment.NewLine + "Torpedo salvoes left: " + selectedUnit.Torpedoes;
                }
                if (selectedUnit.Type.Abilities.Contains(Order.Mine))
                {
                    UnitTextBox.Text += Environment.NewLine + "Mine placements left: " + selectedUnit.Mines;
                }
                if (selectedUnit.Type.Abilities.Contains(Order.Move))
                {
                    UnitTextBox.Text += Environment.NewLine + "Moves Left: " + selectedUnit.MovesLeft.ToString("0.0");
                }
                if (selectedUnit.Type.Abilities.Contains(Order.LightArtillery))
                {
                    UnitTextBox.Text += Environment.NewLine + "Light Artillery " + "Power: " + selectedUnit.Type.LightPower + ", Range: " + selectedUnit.Type.LightRange;
                }
                if (selectedUnit.Type.Abilities.Contains(Order.HeavyArtillery))
                {
                    UnitTextBox.Text += Environment.NewLine + "Heavy Artillery " + "Power: " + selectedUnit.Type.HeavyPower + ", Range: " + selectedUnit.Type.HeavyRange;
                }
                if (!float.IsPositiveInfinity(selectedUnit.Type.Armour))
                {
                    UnitTextBox.Text += Environment.NewLine + "Armour: " + selectedUnit.Type.Armour;
                }

                if (selectedUnit.Type.Abilities.Contains(Order.Move))
                {
                    MoveBox.Show();
                }
                else
                {
                    MoveBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.LightArtillery))
                {
                    LightArtilleryBox.Show();
                }
                else
                {
                    LightArtilleryBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.HeavyArtillery))
                {
                    HeavyArtilleryBox.Show();
                }
                else
                {
                    HeavyArtilleryBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.Repair))
                {
                    RepairBox.Show();
                }
                else
                {
                    RepairBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.Build))
                {
                    BuildBox.Show();
                }
                else
                {
                    BuildBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.Load))
                {
                    LoadBox.Show();
                }
                else
                {
                    LoadBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.Unload))
                {
                    UnloadBox.Show();
                }
                else
                {
                    UnloadBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.Torpedo))
                {
                    TorpedoBox.Show();
                }
                else
                {
                    TorpedoBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.DiveOrSurface))
                {
                    DiveBox.Show();
                    DiveButton.Text = selectedUnit.IsSubmerged ? "Surface" : "Dive";
                }
                else
                {
                    DiveBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.LoadTorpedoes))
                {
                    LoadTorpedoesBox.Show();
                }
                else
                {
                    LoadTorpedoesBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.DepthCharge))
                {
                    DepthChargeBox.Show();
                }
                else
                {
                    DepthChargeBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.InstallBattery))
                {
                    InstallBatteryBox.Show();
                }
                else
                {
                    InstallBatteryBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.Capture))
                {
                    CaptureBox.Show();
                }
                else
                {
                    CaptureBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.Mine))
                {
                    MineBox.Show();
                }
                else
                {
                    MineBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.LoadMines))
                {
                    LoadMinesBox.Show();
                }
                else
                {
                    LoadMinesBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.Sweep))
                {
                    SweepBox.Show();
                }
                else
                {
                    SweepBox.Hide();
                }
                if (selectedUnit.Type.Abilities.Contains(Order.SearchMines))
                {
                    SearchMinesBox.Show();
                }
                else
                {
                    SearchMinesBox.Hide();
                }

                MoveBox.Enabled           = selectedUnit.MovesLeft >= 1;
                LightArtilleryBox.Enabled = selectedUnit.LightShotsLeft >= 1 && !selectedUnit.IsSubmerged;
                HeavyArtilleryBox.Enabled = selectedUnit.HeavyShotsLeft >= 1 && !selectedUnit.IsSubmerged;
                BuildBox.Enabled          = !selectedUnit.IsSubmerged;
                RepairBox.Enabled         = selectedUnit.RepairsLeft >= 1 && !selectedUnit.IsSubmerged;
                LoadBox.Enabled           = selectedUnit.LoadsLeft >= 1 && !selectedUnit.IsSubmerged;
                UnloadBox.Enabled         = selectedUnit.LoadsLeft >= 1 && !selectedUnit.IsSubmerged;
                TorpedoBox.Enabled        = selectedUnit.TorpedoesLeft >= 1 && selectedUnit.Torpedoes >= 1;
                DiveBox.Enabled           = selectedUnit.DivesLeft >= 1;
                LoadTorpedoesBox.Enabled  = selectedUnit.Torpedoes < selectedUnit.Type.MaxTorpedoes;
                DepthChargeBox.Enabled    = selectedUnit.DepthChargesLeft >= 1;
                InstallBatteryBox.Enabled = selectedUnit.InstallsLeft >= 1;
                CaptureBox.Enabled        = selectedUnit.CapturesLeft >= 1;
                MineBox.Enabled           = selectedUnit.MinesLeft >= 1 && selectedUnit.Mines >= 1;
                LoadMinesBox.Enabled      = selectedUnit.Mines < selectedUnit.Type.MaxMines;
                SweepBox.Enabled          = selectedUnit.SweepsLeft >= 1;
                SearchMinesBox.Enabled    = selectedUnit.MineSearchesLeft >= 1;

                if (MapDisplay.CurrentOrder == Order.Move && selectedUnit.MovesLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.LightArtillery && selectedUnit.LightShotsLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.HeavyArtillery && selectedUnit.HeavyShotsLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.Repair && selectedUnit.RepairsLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.Load && selectedUnit.LoadsLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.Unload && selectedUnit.LoadsLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.Torpedo && selectedUnit.TorpedoesLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.LoadTorpedoes && selectedUnit.Torpedoes >= selectedUnit.Type.MaxTorpedoes)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.DepthCharge && selectedUnit.DepthChargesLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.InstallBattery && selectedUnit.InstallsLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.Capture && selectedUnit.CapturesLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.Mine && selectedUnit.MinesLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.LoadMines && selectedUnit.Mines >= selectedUnit.Type.MaxMines)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.Sweep && selectedUnit.SweepsLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }
                if (MapDisplay.CurrentOrder == Order.SearchMines && selectedUnit.MineSearchesLeft < 1)
                {
                    MapDisplay.CurrentOrder = null;
                }

                HealthBar.Value = (int)(selectedUnit.Health * 100);
            }
            else
            {
                UnitPanel.Hide();
                OrdersPanel.Hide();
                InfoPanel.Hide();
            }
            Invalidate();
        }
Beispiel #8
0
        public static void InitializeUnitTypes()
        {
            SuperBattleship = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.HeavyArtillery, Order.LightArtillery
                },
                Name                  = "Super Battleship",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\SuperBattleshipLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\SuperBattleship.png"),
                Speed                 = 4,
                ViewDistance          = 9,
                HeavyPower            = 16,
                HeavyRange            = 9,
                LightPower            = 4,
                LightRange            = 7,
                TorpedoHitProbability = 0.4f,
                Armour                = 38,
                BuildTime             = 10,
                Cost                  = 40,
                Factions              = new List <Faction> {
                    Faction.Japan, Faction.USA
                },
                CreateUnit = (player, position) => new SuperBattleship(player, position)
            };

            Battleship = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.HeavyArtillery, Order.LightArtillery
                },
                Name                  = "Battleship",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\BattleshipLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\Battleship.png"),
                Speed                 = 4,
                ViewDistance          = 9,
                HeavyPower            = 13,
                HeavyRange            = 9,
                LightPower            = 4,
                LightRange            = 7,
                TorpedoHitProbability = 0.4f,
                Armour                = 30,
                BuildTime             = 9,
                Cost                  = 32,
                Factions              = new List <Faction> {
                    Faction.Germany, Faction.England, Faction.Japan, Faction.USA
                },
                CreateUnit = (player, position) => new Battleship(player, position)
            };

            Battlecruiser = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.HeavyArtillery, Order.LightArtillery
                },
                Name                  = "Battlecruiser",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\BattlecruiserLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\Battlecruiser.png"),
                Speed                 = 5,
                ViewDistance          = 9,
                HeavyPower            = 13,
                HeavyRange            = 9,
                LightPower            = 4,
                LightRange            = 7,
                TorpedoHitProbability = 0.4f,
                Armour                = 20,
                BuildTime             = 9,
                Cost                  = 32,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new Battlecruiser(player, position)
            };

            PocketBattleship = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.HeavyArtillery, Order.LightArtillery
                },
                Name                  = "Pocket Battleship",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\PocketBattleshipLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\PocketBattleship.png"),
                Speed                 = 4,
                ViewDistance          = 9,
                HeavyPower            = 10,
                HeavyRange            = 9,
                LightPower            = 4,
                LightRange            = 7,
                TorpedoHitProbability = 0.4f,
                Armour                = 18,
                BuildTime             = 8,
                Cost                  = 24,
                Factions              = new List <Faction> {
                    Faction.Germany
                },
                CreateUnit = (player, position) => new PocketBattleship(player, position)
            };

            HeavyCruiser = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.HeavyArtillery, Order.LightArtillery
                },
                Name                  = "Heavy Cruiser",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\HeavyCruiserLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\HeavyCruiser.png"),
                Speed                 = 5,
                ViewDistance          = 9,
                HeavyPower            = 7,
                HeavyRange            = 8,
                LightPower            = 2,
                LightRange            = 6,
                TorpedoHitProbability = 0.4f,
                Armour                = 12,
                Capacity              = 0,
                RepairPower           = 0,
                BuildTime             = 7,
                Cost                  = 16,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new HeavyCruiser(player, position)
            };

            LightCruiser = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.HeavyArtillery, Order.LightArtillery
                },
                Name                  = "Light Cruiser",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\LightCruiserLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\LightCruiser.png"),
                Speed                 = 5,
                ViewDistance          = 9,
                HeavyPower            = 4,
                HeavyRange            = 7,
                LightPower            = 1,
                LightRange            = 5,
                TorpedoHitProbability = 0.4f,
                Armour                = 8,
                Capacity              = 0,
                RepairPower           = 0,
                BuildTime             = 5,
                Cost                  = 10,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new LightCruiser(player, position)
            };

            Destroyer = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.LightArtillery, Order.Torpedo, Order.DepthCharge, Order.LoadTorpedoes
                },
                Name                  = "Destroyer",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\DestroyerLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\Destroyer.png"),
                Speed                 = 6,
                ViewDistance          = 9,
                SonarRange            = 2,
                HeavyPower            = 0,
                HeavyRange            = 0,
                LightPower            = 2,
                LightRange            = 6,
                TorpedoPower          = 9,
                TorpedoHitProbability = 0.2f,
                MaxTorpedoes          = 4,
                Armour                = 4,
                Capacity              = 0,
                RepairPower           = 0,
                BuildTime             = 3,
                Cost                  = 7,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new Destroyer(player, position)
            };

            Frigate = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.LightArtillery, Order.DepthCharge
                },
                Name                  = "Frigate",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\FrigateLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\Frigate.png"),
                Speed                 = 5,
                ViewDistance          = 9,
                SonarRange            = 2,
                HeavyPower            = 0,
                HeavyRange            = 0,
                LightPower            = 1,
                LightRange            = 5,
                TorpedoHitProbability = 0.2f,
                Armour                = 3,
                Capacity              = 0,
                RepairPower           = 0,
                BuildTime             = 3,
                Cost                  = 4,
                Factions              = new List <Faction> {
                    Faction.England
                },
                CreateUnit = (player, position) => new Frigate(player, position)
            };

            TorpedoBoat = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.Torpedo, Order.LoadTorpedoes
                },
                Name                  = "Torpedo Boat",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\TorpedoBoatLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\TorpedoBoat.png"),
                Speed                 = 6,
                ViewDistance          = 8,
                SonarRange            = 0,
                HeavyPower            = 0,
                HeavyRange            = 0,
                LightPower            = 0,
                LightRange            = 0,
                TorpedoPower          = 7,
                MaxTorpedoes          = 2,
                TorpedoHitProbability = 0.2f,
                Armour                = 1,
                BuildTime             = 2,
                Cost                  = 3,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new TorpedoBoat(player, position)
            };

            Minesweeper = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.Mine, Order.Sweep, Order.SearchMines, Order.LoadMines, Order.LightArtillery
                },
                Name                  = "Minesweeper",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\MinesweeperLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\Minesweeper.png"),
                Speed                 = 4,
                ViewDistance          = 8,
                LightPower            = 1,
                LightRange            = 5,
                TorpedoHitProbability = 0.2f,
                Armour                = 4,
                Capacity              = 0,
                MaxMines              = 3,
                RepairPower           = 0,
                BuildTime             = 3,
                Cost                  = 6,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new Minesweeper(player, position)
            };

            TroopShip = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.Capture
                },
                Name                  = "Troop Ship",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\TroopShipLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\TroopShip.png"),
                Speed                 = 3,
                ViewDistance          = 8,
                TorpedoHitProbability = 0.4f,
                Armour                = 4,
                Cost                  = 10,
                BuildTime             = 5,
                Factions              = new List <Faction> {
                    Faction.England, Faction.USA, Faction.Germany, Faction.Japan, Faction.Neutral
                },
                CreateUnit = (player, position) => new TroopShip(player, position)
            };

            LightCargo = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.Load, Order.Unload
                },
                Name                  = "Light Cargo Ship",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\LightCargoLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\LightCargo.png"),
                Speed                 = 4,
                ViewDistance          = 8,
                SonarRange            = 0,
                HeavyPower            = 0,
                HeavyRange            = 0,
                LightPower            = 0,
                LightRange            = 0,
                TorpedoHitProbability = 0.4f,
                Armour                = 3,
                Capacity              = 5,
                RepairPower           = 0,
                BuildTime             = 2,
                Cost                  = 5,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new LightCargo(player, position)
            };

            MediumCargo = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.Load, Order.Unload
                },
                Name                  = "Medium Cargo Ship",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\MediumCargoLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\MediumCargo.png"),
                Speed                 = 3,
                ViewDistance          = 8,
                SonarRange            = 0,
                HeavyPower            = 0,
                HeavyRange            = 0,
                LightPower            = 0,
                LightRange            = 0,
                TorpedoHitProbability = 0.4f,
                Armour                = 6,
                Capacity              = 10,
                RepairPower           = 0,
                BuildTime             = 3,
                Cost                  = 6,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new MediumCargo(player, position)
            };

            Submarine = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.Torpedo, Order.LightArtillery, Order.DiveOrSurface, Order.LoadTorpedoes
                },
                Name                  = "Submarine",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\SubmarineLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\Submarine.png"),
                Speed                 = 4,
                SubmergedSpeed        = 2.5f,
                ViewDistance          = 8,
                SonarRange            = 1,
                HeavyPower            = 0,
                HeavyRange            = 0,
                LightPower            = 1,
                LightRange            = 5,
                TorpedoPower          = 9,
                MaxTorpedoes          = 4,
                TorpedoHitProbability = 0.2f,
                Armour                = 2,
                Capacity              = 0,
                RepairPower           = 0,
                BuildTime             = 2,
                Cost                  = 6,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new Submarine(player, position)
            };

            UBoat = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.Torpedo, Order.LightArtillery, Order.DiveOrSurface, Order.LoadTorpedoes
                },
                Name                  = "U-Boat",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\SubmarineLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\Submarine.png"),
                Speed                 = 4,
                SubmergedSpeed        = 2.5f,
                ViewDistance          = 8,
                SonarRange            = 1,
                HeavyPower            = 0,
                HeavyRange            = 0,
                LightPower            = 1,
                LightRange            = 5,
                TorpedoPower          = 9,
                MaxTorpedoes          = 4,
                TorpedoHitProbability = 0.2f,
                Armour                = 2,
                Capacity              = 0,
                RepairPower           = 0,
                BuildTime             = 2,
                Cost                  = 4,
                Factions              = new List <Faction> {
                    Faction.Germany
                },
                CreateUnit = (player, position) => new UBoat(player, position)
            };

            CoastalBattery = new UnitType
            {
                Abilities = new List <Order> {
                    Order.HeavyArtillery, Order.LightArtillery
                },
                Name                  = "Coastal Battery",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\CoastalBatteryLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\CoastalBattery.png"),
                ViewDistance          = 9,
                AlwaysVisible         = true,
                LightPower            = 4,
                LightRange            = 7,
                HeavyPower            = 10,
                HeavyRange            = 9,
                TorpedoHitProbability = 0f,
                Armour                = 24,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new CoastalBattery(player, position)
            };

            BatteryInProgress = new UnitType
            {
                Abilities             = new List <Order> {
                },
                Name                  = "Battery Under Construction",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\BatteryInProgressLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\BatteryInProgress.png"),
                ViewDistance          = 1,
                TorpedoHitProbability = 0f,
                Armour                = 5,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new BatteryInProgress(player, position)
            };

            BatteryBarge = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Move, Order.InstallBattery
                },
                Name                  = "Battery Installation Barge",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\BatteryBargeLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\BatteryBarge.png"),
                Speed                 = 3,
                ViewDistance          = 8,
                TorpedoHitProbability = 0.4f,
                Armour                = 2,
                BuildTime             = 5,
                Cost                  = 10,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new BatteryBarge(player, position)
            };

            //AircraftCarrier = new UnitType
            //{
            //    Abilities = new List<Order> { Order.Move, Order.LightArtillery },
            //    Name = "Aircraft Carrier",
            //    LargeBitmap = Bitmaps.Get("Data\\Ships\\AircraftCarrierLarge.png"),
            //    Bitmap = Bitmaps.Get("Data\\Ships\\AircraftCarrier.png"),
            //    Speed = 4,
            //    ViewDistance = 9,
            //    HeavyPower = 0,
            //    HeavyRange = 0,
            //    LightPower = 3,
            //    LightRange = 6,
            //    TorpedoPower = 0,
            //    Armour = 10,
            //    Capacity = 0,
            //    RepairPower = 0,
            //    BuildTime = 12,
            //    Cost = 35,
            //    Factions = new List<Faction> { Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral },
            //    CreateUnit = (player, position) => new AircraftCarrier(player, position)
            //};

            Wreck = new UnitType
            {
                Abilities    = new List <Order> {
                },
                Name         = "Wreck",
                LargeBitmap  = Bitmaps.Get("Data\\Ships\\WreckLarge.png"),
                Bitmap       = Bitmaps.Get("Data\\Ships\\Wreck.png"),
                Speed        = 0,
                ViewDistance = 1,
                HeavyPower   = 0,
                HeavyRange   = 0,
                LightPower   = 0,
                LightRange   = 0,
                TorpedoPower = 0,
                Armour       = float.PositiveInfinity,
                Capacity     = 0,
                RepairPower  = 0,
                BuildTime    = 0,
                Cost         = 0,
                Factions     = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new Wreck(player, position)
            };

            ShipInProgress = new UnitType
            {
                Abilities             = new List <Order> {
                },
                Name                  = "ShipInProgress",
                LargeBitmap           = Bitmaps.Get("Data\\Ships\\ShipInProgressLarge.png"),
                Bitmap                = Bitmaps.Get("Data\\Ships\\ShipInProgress.png"),
                Speed                 = 0,
                ViewDistance          = 1,
                HeavyPower            = 0,
                HeavyRange            = 0,
                LightPower            = 0,
                LightRange            = 0,
                TorpedoHitProbability = 0.8f,
                Armour                = 2f,
                Capacity              = 0,
                RepairPower           = 0,
                BuildTime             = 0,
                Cost                  = 0,
                Factions              = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new ShipInProgress(player, position)
            };

            Port = new UnitType
            {
                Abilities = new List <Order> {
                    Order.Build, Order.Repair
                },
                Name          = "Port",
                LargeBitmap   = Bitmaps.Get("Data\\Ships\\PortLarge.png"),
                Bitmap        = Bitmaps.Get("Data\\Ships\\Port.png"),
                Speed         = 0,
                ViewDistance  = 10,
                AlwaysVisible = true,
                Armour        = float.PositiveInfinity,
                Capacity      = 80,
                RepairPower   = 2.5f,
                BuildTime     = 0,
                Cost          = 0,
                Factions      = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new Port(player, position)
            };

            Factory = new UnitType
            {
                Abilities     = new List <Order> {
                },
                Name          = "Factory",
                LargeBitmap   = Bitmaps.Get("Data\\Ships\\FactoryLarge.png"),
                Bitmap        = Bitmaps.Get("Data\\Ships\\Factory.png"),
                Speed         = 0,
                ViewDistance  = 9,
                AlwaysVisible = true,
                HeavyPower    = 0,
                HeavyRange    = 0,
                LightPower    = 0,
                LightRange    = 0,
                TorpedoPower  = 0,
                Armour        = float.PositiveInfinity,
                Capacity      = 20,
                RepairPower   = 0,
                BuildTime     = 0,
                Cost          = 0,
                Factions      = new List <Faction> {
                    Faction.England, Faction.Germany, Faction.Japan, Faction.USA, Faction.Neutral
                },
                CreateUnit = (player, position) => new Factory(player, position)
            };

            UnitTypes = new List <UnitType>
            {
                LightCargo, MediumCargo, TorpedoBoat, Frigate, Destroyer, LightCruiser, HeavyCruiser, PocketBattleship, Battlecruiser, Battleship, SuperBattleship, Minesweeper, Submarine, UBoat, TroopShip, BatteryBarge, BatteryInProgress, Wreck, ShipInProgress, CoastalBattery, Port, Factory
            };
        }