Esempio n. 1
0
        private static Sisco_Return onPostGameLoaded(ref object sender, ref object[] args, ref object return_value)
        {
            string gameName        = (string)args[0];
            string plyUpgradesFile = String.Concat(gameName, ".pug");

            // LOAD PLAYER UPGRADES
            if (File.Exists(plyUpgradesFile))
            {
                string   str  = File.ReadAllText(plyUpgradesFile);
                string[] list = str.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
                if (list.Length <= 0)
                {
                    return(null);
                }

                foreach (string ID in list)
                {
                    string        id      = ID.ToLower();
                    PlayerUpgrade upgrade = Get_Upgrade(Upgrade_Type.PLAYER_UPGRADE, id) as PlayerUpgrade;
                    if (upgrade == null)
                    {
                        Player_Upgrades_Missing.Add(id);
                        SLog.Info("[Upgrades] Unable to find Upgrade, ID: {0}", id);
                    }
                    else
                    {
                        Player.GiveUpgrade(upgrade);
                    }
                }
            }
            return(null);
        }
Esempio n. 2
0
 public static bool TryPurchase(PersonalUpgradeUI kiosk, PlayerUpgrade upgrade)
 {
     if (Player.HasUpgrade(upgrade))
     {
         kiosk.PlayErrorCue();
         kiosk.Error("e.already_has_personal_upgrade");
     }
     else if (!Player.CanBuyUpgrade(upgrade))
     {
         kiosk.PlayErrorCue();
         kiosk.Error("e.ineligible_for_personal_upgrade");
     }
     else if (Player.Currency >= upgrade.Cost)
     {
         Sound.Play(SoundId.PURCHASED_PLAYER_UPGRADE);
         Player.SpendCurrency((int)upgrade.Cost, false);
         Player.GiveUpgrade(upgrade);
         kiosk.Close();
         return(true);
     }
     else
     {
         kiosk.PlayErrorCue();
         kiosk.Error("e.insuf_coins");
     }
     return(false);
 }
Esempio n. 3
0
        public static bool CanBuyUpgrade(string ID)
        {
            PlayerUpgrade up = (PlayerUpgrade)Upgrades.Get_Upgrade(Upgrade_Type.PLAYER_UPGRADE, ID);

            if (up == null)
            {
                return(false);
            }

            return(CanBuyUpgrade(up));
        }
Esempio n. 4
0
 public static bool CanBuyUpgrade(PlayerUpgrade upgrade)
 {
     return(upgrade.CanBuy(null));
 }
Esempio n. 5
0
 public static void GiveUpgrade(PlayerUpgrade upgrade)
 {
     Upgrades.PlayerUpgrades.Add(upgrade);
     upgrade.Apply(player.gameObject);
 }