Ejemplo n.º 1
0
        public void Load()
        {
            shipItems.Clear();
            equippedPrimaryWeapons.Clear();
            equippedEnergyCell = null;
            equippedShield     = emptyShield;
            equippedPlating    = null;

            // Load inventory
            int count = Game.saveFile.GetPropertyAsInt("shipitems", "count", 0);

            for (int i = 0; i < count; i++)
            {
                //InsertItem(i, Game.saveFile.GetItemFromSavefile("shipinv" + i));
                InsertItem(i, Game.saveFile.CreateItemFromSector("shipinv" + i));
            }

            // Equip Items
            int pos;

            ShipInventoryManager.equippedPrimaryWeapons.Clear();

            pos = Game.saveFile.GetPropertyAsInt("shipequipped", "primaryinvpos0", -1);
            if (pos != -1)
            {
                ShipInventoryManager.equippedPrimaryWeapons.Insert(0, (PlayerWeapon)ownedPrimaryWeapons[pos]);
            }

            pos = Game.saveFile.GetPropertyAsInt("shipequipped", "primaryinvpos1", -1);
            if (pos != -1)
            {
                ShipInventoryManager.equippedPrimaryWeapons.Insert(1, (PlayerWeapon)ownedPrimaryWeapons[pos]);
            }

            pos = Game.saveFile.GetPropertyAsInt("shipequipped", "secondaryinvpos", -1);
            if (pos != -1)
            {
                EquipItemFromSublist(ShipParts.Secondary, 0, pos);
            }

            pos = Game.saveFile.GetPropertyAsInt("shipequipped", "energyinvpos", -1);
            if (pos != -1)
            {
                EquipItemFromSublist(ShipParts.EnergyCell, 0, pos);
            }

            pos = Game.saveFile.GetPropertyAsInt("shipequipped", "shieldinvpos", -1);
            if (pos != -1)
            {
                EquipItemFromSublist(ShipParts.Shield, 0, pos);
            }
            pos = Game.saveFile.GetPropertyAsInt("shipequipped", "platinginvpos", -1);
            if (pos != -1)
            {
                EquipItemFromSublist(ShipParts.Plating, 0, pos);
            }
        }
Ejemplo n.º 2
0
        public static void EquipItemFromSublist(ShipParts kind, int equipPos, int invPos)
        {
            List <ShipPart> availablePrimaryWeapons;

            switch (kind)
            {
            case ShipParts.Primary1:
            {
                availablePrimaryWeapons = ShipInventoryManager.GetAvailablePrimaryWeapons(1);
                ShipInventoryManager.equippedPrimaryWeapons.RemoveAt(0);
                ShipInventoryManager.equippedPrimaryWeapons.Insert(0, (PlayerWeapon)availablePrimaryWeapons[invPos]);
                break;
            }

            case ShipParts.Primary2:
            {
                availablePrimaryWeapons = ShipInventoryManager.GetAvailablePrimaryWeapons(2);
                ShipInventoryManager.equippedPrimaryWeapons.RemoveAt(1);
                ShipInventoryManager.equippedPrimaryWeapons.Insert(1, (PlayerWeapon)availablePrimaryWeapons[invPos]);
                break;
            }

            case ShipParts.Secondary:
            {
                ShipInventoryManager.equippedSecondary = (PlayerWeapon)ShipInventoryManager.ownedSecondary[invPos];
                break;
            }

            case ShipParts.Plating:
            {
                equippedPlating = (PlayerPlating)ShipInventoryManager.ownedPlatings[invPos];
                ChangePrimarySlots(equippedPlating.PrimarySlots);
                break;
            }

            case ShipParts.EnergyCell:
            {
                ShipInventoryManager.equippedEnergyCell = (PlayerEnergyCell)ShipInventoryManager.ownedEnergyCells[invPos];
                break;
            }

            case ShipParts.Shield:
            {
                ShipInventoryManager.equippedShield = (PlayerShield)ShipInventoryManager.ownedShields[invPos];
                break;
            }

            default:
            {
                throw new ArgumentException("You entered an unimplemented shippart!");
            }
            }

            UpdateLists(emptyItem);
        }
Ejemplo n.º 3
0
        public static void EquipItemFromInventory(String kind, int invPos)
        {
            if (kind == "Primary")
            {
                int equipPos = count;

                count++;

                if (count > 1)
                {
                    count = 0;
                }

                if (equippedPrimaryWeapons.Count == 1)
                {
                    equipPos = 1;
                }

                else if (equippedPrimaryWeapons.Count > 1)
                {
                    for (int i = 0; i < equippedPrimaryWeapons.Count; i++)
                    {
                        if (equippedPrimaryWeapons[i] is EmptyWeapon)
                        {
                            equipPos = i;
                            break;
                        }
                    }
                }

                ShipInventoryManager.equippedPrimaryWeapons.RemoveAt(equipPos);
                ShipInventoryManager.equippedPrimaryWeapons.Insert(equipPos, (PlayerWeapon)shipItems[invPos]);
            }
            else if (kind == "Secondary")
            {
                ShipInventoryManager.equippedSecondary = (PlayerWeapon)shipItems[invPos];
            }
            else if (kind == "Plating")
            {
                equippedPlating = (PlayerPlating)ShipInventoryManager.shipItems[invPos];
                ChangePrimarySlots(equippedPlating.PrimarySlots);
            }
            else if (kind == "EnergyCell")
            {
                ShipInventoryManager.equippedEnergyCell = (PlayerEnergyCell)shipItems[invPos];
            }
            else if (kind == "Shield")
            {
                ShipInventoryManager.equippedShield = (PlayerShield)shipItems[invPos];
            }

            UpdateLists(emptyItem);
        }
Ejemplo n.º 4
0
        public void Initialize()
        {
            equippedPlating = null;

            columnSize = 14;

            emptyWeapon = new EmptyWeapon(Game);
            emptyShield = new EmptyShield(Game);

            //Initial inventory items
            BasicLaserWeapon basicLaser     = new BasicLaserWeapon(Game, ItemVariety.Regular);
            BasicEnergyCell  regularCell    = new BasicEnergyCell(Game, ItemVariety.Regular);
            BasicPlating     regularPlating = new BasicPlating(Game, ItemVariety.Regular);

            shipItems.Clear();

            List <PlayerWeapon> tempPrimary   = new List <PlayerWeapon>();
            List <PlayerWeapon> tempSecondary = new List <PlayerWeapon>();

            shipItems.Add(basicLaser);
            shipItems.Add(regularCell);
            shipItems.Add(regularPlating);

            //Equipped from the beginning
            primarySlots = 2;

            Random random = new Random();

            equippedPrimaryWeapons.Clear();
            equippedPrimaryWeapons.Add(basicLaser);
            equippedEnergyCell = regularCell;
            equippedShield     = emptyShield;
            equippedPlating    = regularPlating;

            for (int n = equippedPrimaryWeapons.Count; n < primarySlots; n++)
            {
                equippedPrimaryWeapons.Add(emptyWeapon);
            }

            equippedSecondary = emptyWeapon;

            currentPrimaryWeapon = equippedPrimaryWeapons[0];

            //Lists with counts for the ShipManager-state
            equipCounts.Add(equippedPrimaryWeapons.Count);
            equipCounts.Add(1);
            equipCounts.Add(1);
            equipCounts.Add(1);
            equipCounts.Add(1);

            UpdateLists(emptyItem);
        }
Ejemplo n.º 5
0
        public static void ActivateCheatEquip2()
        {
            if (isEquip2CheatActivated)
            {
                return;
            }

            equippedPrimaryWeapons[0] = new ProximityLaserWeapon(Game);
            equippedPrimaryWeapons[1] = new AdvancedLaserWeapon(Game);
            equippedSecondary         = new TurretWeapon(Game);
            currentPrimaryWeapon      = equippedPrimaryWeapons[0];

            equippedEnergyCell = new AdvancedEnergyCell(Game);
            equippedShield     = new AdvancedShield(Game);

            isEquip2CheatActivated = true;
        }
Ejemplo n.º 6
0
        public static void ActivateCheatEquip1()
        {
            if (isEquip1CheatActivated)
            {
                return;
            }

            equippedPrimaryWeapons[0] = new SpreadBulletWeapon(Game);
            equippedPrimaryWeapons[1] = new BallisticLaserWeapon(Game);
            equippedSecondary         = new SideMissilesWeapon(Game);
            currentPrimaryWeapon      = equippedPrimaryWeapons[0];

            equippedEnergyCell = new BasicEnergyCell(Game);
            equippedShield     = new BasicShield(Game);

            isEquip1CheatActivated = true;
        }
Ejemplo n.º 7
0
        public static String MapCreatorEquip(int equipNbr)
        {
            equippedEnergyCell = new AdvancedEnergyCell(Game);
            String equipInfo = "";

            switch (equipNbr)
            {
            case 1:
            {
                equippedPrimaryWeapons[0] = new BasicLaserWeapon(Game);
                equippedPrimaryWeapons[1] = new BasicLaserWeapon(Game);
                equippedSecondary         = new HomingMissileWeapon(Game);
                currentPrimaryWeapon      = equippedPrimaryWeapons[0];

                equippedEnergyCell = new RegularEnergyCell(Game);
                equippedPlating    = new BasicPlating(Game);
                equippedShield     = new EmptyShield(Game);

                equipInfo += "Starters kit (mission ~1)";

                break;
            }

            case 2:
            {
                equippedPrimaryWeapons[0] = new DualLaserWeapon(Game);
                equippedPrimaryWeapons[1] = new SpreadBulletWeapon(Game);
                equippedSecondary         = new EmptyWeapon(Game);
                currentPrimaryWeapon      = equippedPrimaryWeapons[0];

                equippedEnergyCell = new BasicEnergyCell(Game);
                equippedPlating    = new BasicPlating(Game);
                equippedShield     = new BasicShield(Game);

                equipInfo += "Past beginner set (mission ~2)";
                break;
            }

            case 3:
            {
                equippedPrimaryWeapons[0] = new MultipleShotWeapon(Game);
                equippedPrimaryWeapons[1] = new WaveBeamWeapon(Game);
                equippedSecondary         = new TurretWeapon(Game);
                currentPrimaryWeapon      = equippedPrimaryWeapons[0];

                equippedEnergyCell = new RegularEnergyCell(Game);
                equippedPlating    = new BasicPlating(Game);
                equippedShield     = new BasicShield(Game);

                equipInfo += "Has reached Fortrun (mission ~3)";
                break;
            }

            case 4:
            {
                equippedPrimaryWeapons[0] = new BeamWeapon(Game);
                equippedPrimaryWeapons[1] = new MultipleShotWeapon(Game);
                equippedSecondary         = new FieldDamageWeapon(Game);
                currentPrimaryWeapon      = equippedPrimaryWeapons[0];

                equippedEnergyCell = new RegularEnergyCell(Game);
                equippedPlating    = new RegularPlating(Game);
                equippedShield     = new RegularShield(Game);

                equipInfo += "A bit more progress at Fortrun (mission ~4)";
                break;
            }

            case 5:
            {
                equippedPrimaryWeapons[0] = new FragmentMissileWeapon(Game);
                equippedPrimaryWeapons[1] = new BeamWeapon(Game);
                equippedSecondary         = new SideMissilesWeapon(Game);
                currentPrimaryWeapon      = equippedPrimaryWeapons[0];

                equippedEnergyCell = new AdvancedEnergyCell(Game);
                equippedPlating    = new RegularPlating(Game);
                equippedShield     = new RegularShield(Game);

                equipInfo += "Has now reached Rebel Station (mission ~5)";
                break;
            }

            case 6:
            {
                equippedPrimaryWeapons[0] = new BallisticLaserWeapon(Game);
                equippedPrimaryWeapons[1] = new BursterWeapon(Game);
                equippedSecondary         = new SideMissilesWeapon(Game);
                currentPrimaryWeapon      = equippedPrimaryWeapons[0];

                equippedEnergyCell = new AdvancedEnergyCell(Game);
                equippedPlating    = new RegularPlating(Game);
                equippedShield     = new RegularShield(Game);

                equipInfo += "Running to Peye (mission ~6+)";
                break;
            }

            case 7:
            {
                equippedPrimaryWeapons[0] = new AdvancedLaserWeapon(Game);
                equippedPrimaryWeapons[1] = new ProximityLaserWeapon(Game);
                equippedSecondary         = new DisruptorWeapon(Game);
                currentPrimaryWeapon      = equippedPrimaryWeapons[0];

                equippedEnergyCell = new AdvancedEnergyCell(Game);
                equippedPlating    = new RegularPlating(Game);
                equippedShield     = new AdvancedShield(Game);

                equipInfo += "Getting inaccurate here (mission >6-7)";
                break;
            }

            case 8:
            {
                equippedPrimaryWeapons[0] = new AdvancedBeamWeapon(Game);
                equippedPrimaryWeapons[1] = new ProximityLaserWeapon(Game);
                equippedSecondary         = new SideMissilesWeapon(Game);
                currentPrimaryWeapon      = equippedPrimaryWeapons[0];

                equippedEnergyCell = new AdvancedEnergyCell(Game);
                equippedPlating    = new AdvancedPlating(Game);
                equippedShield     = new AdvancedShield(Game);

                equipInfo += "Currently highest tier (mission ~10)";
                break;
            }

            case 9:
            {
                equippedPrimaryWeapons[0] = new AdvancedBeamWeapon(Game);
                equippedPrimaryWeapons[1] = new BursterWeapon(Game);
                equippedSecondary         = new BursterWeapon(Game);
                currentPrimaryWeapon      = equippedPrimaryWeapons[0];

                equippedEnergyCell = new AdvancedEnergyCell(Game);
                equippedPlating    = new AdvancedPlating(Game);
                equippedShield     = new AdvancedShield(Game);

                //equippedEnergyCell.Recharge *= 10f;
                //equippedPlating.Speed *= 3f;
                //equippedPlating.Armor *= 10f;
                //equippedShield.Regeneration *= 5f;

                equipInfo += "What's going on here??";
                break;
            }

            case 0:
            {
                equippedPrimaryWeapons[0] = new LongShotWeapon(Game);
                equippedPrimaryWeapons[1] = new FlameShotWeapon(Game);
                equippedSecondary         = new DisruptorWeapon(Game);
                currentPrimaryWeapon      = equippedPrimaryWeapons[0];

                equippedEnergyCell = new AdvancedEnergyCell(Game);
                equippedPlating    = new AdvancedPlating(Game);
                equippedShield     = new AdvancedShield(Game);

                equipInfo += "Jakobs testing slot";
                break;
            }
            }
            equipInfo += "\n" + equippedPrimaryWeapons[0].Name
                         + "\n" + equippedPrimaryWeapons[1].Name
                         + "\n" + equippedSecondary.Name
                         + "\n" + equippedEnergyCell.Name
                         + "\n" + equippedShield.Name
                         + "\n" + equippedPlating.Name;

            return(equipInfo);
        }