Exemplo n.º 1
0
        public AirTransportUnit CreateAirTransportUnit(int unitId, Nation nation, int startingTileId)
        {
            int equipmentId = 0;
            AirTransportUnit unit = new AirTransportUnit();

            switch (nation.NationEnum)
            {
                case NationEnum.German:
                    equipmentId = 29;
                    break;
                case NationEnum.GreatBritain:
                    equipmentId = 178;
                    break;
                case NationEnum.Italy:
                    equipmentId = 309;
                    break;
                case NationEnum.UnitedStates:
                    equipmentId = 354;
                    break;
                default:
                    if (Game.NationFactory.SideFactory.GetSideForANation(nation.NationId).SideEnum == SideEnum.Axis)
                    {
                        equipmentId = 29;
                    }
                    else
                    {
                        equipmentId = 178;
                    }
                    break;
            }

            unit.UnitId = unitId;
            unit.Equipment = EquipmentFactory.GetEquipment(equipmentId);
            unit.UnitName = String.Format("{0} {1}", unitId, unit.Equipment.EquipmentDescription);
            unit.Nation = nation;
            unit.CurrentStrength = 10;
            unit.CurrentExperience = 0;
            unit.CurrentFuel = 99;
            unit.CanMove = true;
            unit.CurrentTileId = startingTileId;
            return unit;
        }
Exemplo n.º 2
0
 public void AddNation(Hex hex, Nation nation)
 {
     hex.Dispatcher.BeginInvoke(() =>
     {
         Canvas canvas = new Canvas();
         canvas.Name = "NationCanvas";
         canvas.SetValue(Canvas.ZIndexProperty, 1);
         Path path = new Path();
         CreatePathOutline(path, "NationPath");
         AddImage(path, Game.ImageFactory.NationImage, nation.ImageXCoordinate * -1, nation.ImageYCoordinate * -1);
         canvas.Children.Add(path);
         hex.MainCanvas.Children.Add(canvas);
     });
 }
Exemplo n.º 3
0
        public LandTransportUnit CreateLandTransport(int unitId, int equipmentId, Nation nation, bool coreInd, int startingTileId)
        {
            LandTransportUnit unit = new LandTransportUnit();
            unit.UnitId = unitId;
            unit.Equipment = EquipmentFactory.GetEquipment(equipmentId);
            unit.UnitName = String.Format("{0} {1}", unitId, unit.Equipment.EquipmentDescription);
            unit.CurrentStrength = 10;
            unit.CurrentExperience = 0;
            if (unit.Equipment.MaxFuel == 0)
            {
                unit.CurrentFuel = 99;
            }
            else
            {
                unit.CurrentFuel = unit.Equipment.MaxFuel;
            }
            unit.CoreIndicator = coreInd;
            unit.Nation = nation;
            unit.CanMove = true;
            unit.CurrentTileId = startingTileId;

            return unit;
        }
Exemplo n.º 4
0
        public SeaTransportUnit CreateSeaTransportUnit(int unitId, Nation nation, int startingTileId)
        {
            SeaTransportUnit unit = new SeaTransportUnit();
            int equipmentId = 0;
            if (nation.SideEnum == SideEnum.Axis)
            {
                equipmentId = 299;
            }
            else
            {
                equipmentId = 291;
            }

            unit.UnitId = unitId;
            unit.Equipment = EquipmentFactory.GetEquipment(equipmentId);
            unit.UnitName = String.Format("{0} {1}", unitId, unit.Equipment.EquipmentDescription);
            unit.Nation = nation;
            unit.CurrentStrength = 10;
            unit.CurrentExperience = 0;
            unit.CurrentFuel = 99;
            unit.CanMove = true;
            unit.CurrentTileId = startingTileId;

            return unit;
        }
Exemplo n.º 5
0
        public LandCombatUnit CreateDefaultAntiTankUnit(int unitId, Nation nation, int startingTileId)
        {
            LandCombatUnit unit = new LandCombatUnit();
            List<Equipment> equipments = EquipmentFactory.Equipments.Where(e => e.Nation == nation).ToList();
            Equipment equipment = equipments.Where(eq => eq.UnitCost == equipments.Min(e => e.UnitCost)).FirstOrDefault();

            unit.UnitId = unitId;
            unit.Equipment = equipment;
            unit.UnitName = String.Format("{0} {1}", unitId, unit.Equipment.EquipmentDescription);
            unit.Nation = nation;
            unit.CurrentStrength = 10;
            unit.CurrentExperience = 0;
            unit.CanMove = true;
            unit.CurrentTileId = startingTileId;

            if (unit.SideEnum == SideEnum.Axis)
            {
                Game.CurrentTurn.CurrentAxisPrestige = Game.CurrentTurn.CurrentAxisPrestige - unit.Equipment.UnitCost;
            }
            else
            {
                Game.CurrentTurn.CurrentAlliedPrestige = Game.CurrentTurn.CurrentAlliedPrestige - unit.Equipment.UnitCost;
            }

            return unit;
        }