Beispiel #1
0
        public void AddUpgrade(int uniquePilotId, int upgradeId, bool isLoadingBuild = false)
        {
            int uniqueUpgradeId = 0;

            while (true)
            {
                int origionalUniqueUpgradeId = uniqueUpgradeId;
                foreach (UniquePilot pilot in pilots.Values.ToList())
                {
                    foreach (KeyValuePair <int, Upgrade> upgradeToTest in pilot.upgrades)
                    {
                        if (upgradeToTest.Key == uniqueUpgradeId)
                        {
                            uniqueUpgradeId++;
                            break;
                        }
                    }
                }
                if (origionalUniqueUpgradeId == uniqueUpgradeId)
                {
                    pilots[uniquePilotId].upgrades[uniqueUpgradeId] = Upgrades.upgrades[upgradeId];
                    break;
                }
            }
            if (isLoadingBuild == false)
            {
                Builds.SaveBuilds();
            }
        }
Beispiel #2
0
        public int AddPilot(int pilotId, bool isLoadingBuild = false)
        {
            int         uniquePilotId = 0;
            UniquePilot newPilot;

            while (true)
            {
                int origionalNewPilotId = uniquePilotId;
                foreach (UniquePilot otherPilot in pilots.Values.ToList())
                {
                    if (otherPilot.id == uniquePilotId)
                    {
                        uniquePilotId++;
                        break;
                    }
                }
                if (origionalNewPilotId == uniquePilotId)
                {
                    newPilot = new UniquePilot(Pilots.pilots[pilotId], uniquePilotId);
                    break;
                }
            }
            pilots.Add(uniquePilotId, newPilot);
            if (isLoadingBuild == false)
            {
                Builds.SaveBuilds();
            }
            return(uniquePilotId);
        }
Beispiel #3
0
        public void RemoveUpgrade(int uniquePilotId, int upgradeId)
        {
            int  upgradeToRemoveKey      = 0;
            bool hasFoundUpgradeToRemove = false;

            foreach (KeyValuePair <int, Upgrade> upgrade in pilots[uniquePilotId].upgrades)
            {
                if (upgrade.Value.id == upgradeId)
                {
                    hasFoundUpgradeToRemove = true;
                    upgradeToRemoveKey      = upgrade.Key;
                    break;
                }
            }
            if (hasFoundUpgradeToRemove)
            {
                pilots[uniquePilotId].upgrades.Remove(upgradeToRemoveKey);
                UpgradeModifiers.RemoveUpgrade(this, uniquePilotId, upgradeId);
                Upgrades.RemoveUnusableUpgrades(this, uniquePilotId);
                Builds.SaveBuilds();
            }
        }
Beispiel #4
0
 public void RemovePilot(int uniquePilotId)
 {
     pilots.Remove(uniquePilotId);
     Builds.SaveBuilds();
 }