public ActGameForm(IForm formGame) { map = new MapStruct(); map.InitMap(); form = formGame; draw = new PaintGame(form.sizeForm.Width, form.sizeForm.Height); selectCapital = firstShip = true; game = new GameLogic(map.MapObject); }
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; } }