Пример #1
0
 public void ChangeCivOnPlanet(Point locPlanet, nameCiv civ, IActForm act, mapObject[,] map, Point ship)
 {
     if (civ == nameCiv.You)
     {
         planets[locPlanet].ChangeCiv(You, act);
         You.AddPlanet(planets[locPlanet]);
         map[locPlanet.X, locPlanet.Y] = mapObject.PlanetYou;
         if (ship.X != -1)
         {
             You.DeleteShip(ship);
             map[ship.X, ship.Y] = mapObject.None;
         }
     }
     else
     {
         planets[locPlanet].ChangeCiv(enemy);
         enemy.AddPlanet(planets[locPlanet]);
         map[locPlanet.X, locPlanet.Y] = mapObject.PlanetEnemy;
         if (ship.X != -1)
         {
             enemy.DeleteShip(ship);
             map[ship.X, ship.Y] = mapObject.None;
         }
     }
 }
Пример #2
0
 public CreateObject(string name, int food, int titan, int irid, int gold, IActForm act)
 {
     InitializeComponent();
     NamePlanet.Text = name;
     FoodLabel.Text = "Еда + " + food;
     TitaniumLabel.Text = "Титан + " + titan;
     IridiumLabel.Text = "Иридий + " + irid;
     GoldLabel.Text = "Золото + " + gold;
     Status.Text = "";
     Pic = new List<BuildBox> { new BuildBox(pictureBox2), new BuildBox(pictureBox3), new BuildBox(pictureBox4), new BuildBox(pictureBox5), new BuildBox(pictureBox6), new BuildBox(pictureBox7), new BuildBox(pictureBox8) };
     indexPic = 0;
     ColonistBox.Image = Image.FromFile(@"Images/Colonist60.png");
     DestroyerBox.Image = Image.FromFile(@"Images/Destroyer60.png");
     colonist = new PictureBox();
     colonist.Image = ColonistBox.Image;
     colonist.Size = ColonistBox.Size;
     this.act = act;
 }
Пример #3
0
 private void NewGameForm_Load(object sender, EventArgs e)
 {
     sizeForm = new Size(ClientSize.Width, ClientSize.Height);
     g = CreateGraphics();
     act = new ActGameForm(this);
     BackgroundImage = act.GetDefaultMap();
     InitImage();
 }
Пример #4
0
 public void MoveShip(Point start, Point end, mapObject[,] map, IForm form, PaintGame draw, IActForm actForm)
 {
     switch (map[end.X, end.Y])
     {
         case mapObject.None:
             form.Invalidate(draw.MoveShip(map, start, end));
             break;
         case mapObject.Chest:
             form.Invalidate(draw.MoveShip(map, start, end));
             form.Status(RandomChest());
             form.ChangeResources(You.Food, You.Titanium, You.Iridium, You.Gold);
             break;
         case mapObject.DestroyerEnemy:
             if (map[start.X, start.Y] == mapObject.DestroyerYou)
             {
                 map[end.X, end.Y] = mapObject.None;
                 KillEnemyShip(end);
                 form.Invalidate(draw.GetMap(map));
                 draw.MovingShip = false;
             }
             break;
         case mapObject.ColonistEnemy:
             if (map[start.X, start.Y] == mapObject.DestroyerYou)
             {
                 map[end.X, end.Y] = mapObject.None;
                 KillEnemyShip(end);
                 form.Invalidate(draw.GetMap(map));
                 draw.MovingShip = false;
             }
             break;
         case mapObject.PlanetEnemy:
             if (map[start.X, start.Y] == mapObject.DestroyerYou)
             {
                 map[end.X, end.Y] = mapObject.Planet;
                 ClearPlanet(end);
                 form.Invalidate(draw.GetMap(map));
                 draw.MovingShip = false;
             }
             draw.MovingShip = false;
             break;
         case mapObject.Planet:
             if (map[start.X, start.Y] == mapObject.ColonistYou)
             {
                 ChangeCivOnPlanet(end, nameCiv.You, actForm, map, start);
                 form.Invalidate(draw.GetMap(map));
             }
             else
                 draw.MovingShip = false;
             break;
         default:
             draw.MovingShip = false;
             break;
     }
 }
Пример #5
0
 public void SelectEnemyCapital(Point locPlanet, nameCiv civ, IActForm act, mapObject[,] map, Point ship)
 {
     foreach (var p in planets.Keys)
     {
         if (planets[p].civ == null)
         {
             //planets[p].ChangeCiv(enemy);
             //enemy.AddPlanet(planets[p]);
             ChangeCivOnPlanet(new Point(p.X, p.Y), nameCiv.Enemy, act, map, ship);
             break;
         }
     }
 }
Пример #6
0
 public void ChangeCiv(Civilization civ, IActForm act)
 {
     this.civ = civ;
     createObj = new CreateObject(name, Food, Titanium, Iridium, Gold, act);
 }