Пример #1
0
    public void BuyGun(GameEnums.Gun guntype)
    {
        int cost = CustomizationHandler.ShopCosts.ItemsCost(guntype.ToString());

        if (PlayerStaticRunTimeData.coins >= cost)
        {
            for (int i = 0; i < PlayerStaticRunTimeData.playerFirePointData.gunsConfigurations.Length; i++)
            {
                if (PlayerStaticRunTimeData.playerFirePointData.gunsConfigurations[i].locationPath.ToString() == gunPoint.locationPath)
                {
                    PlayerStaticRunTimeData.playerFirePointData.gunsConfigurations[i].gunType            = gunTypeToBuy;
                    PlayerStaticRunTimeData.playerFirePointData.gunsConfigurations[i].gunDataType        = GameEnums.GunDataType.LrLd;
                    PlayerStaticRunTimeData.customizationFirePointData.gunsConfigurations[i].gunType     = gunTypeToBuy;
                    PlayerStaticRunTimeData.customizationFirePointData.gunsConfigurations[i].gunDataType = GameEnums.GunDataType.LrLd;

                    currentGunDataType = GameEnums.GunDataType.LrLd;
                }
            }

            PlayerStaticRunTimeData.coins -= cost;
            PlayerDataDebug.RefreshStatistics();
            PersistentPlayerDataHandler.SaveData(PlayerStaticRunTimeData.playerTruckData, PlayerStaticRunTimeData.playerFirePointData, new PlayerSessionData(0, 0));

            buyButton.gameObject.GetComponentInChildren <Text>().text = "";

            changeGunButton.onClick.RemoveAllListeners();
            buyButton.onClick.RemoveAllListeners();
            damageStat.GetComponentInChildren <Button>().onClick.RemoveAllListeners();
            rateOfFireStat.GetComponentInChildren <Button>().onClick.RemoveAllListeners();


            SelectGun();
        }
    }
Пример #2
0
    private void Awake()
    {
        PlayerStaticRunTimeData.playerTruckData            = playerTruckData;
        PlayerStaticRunTimeData.playerFirePointData        = playerFirePointData;
        PlayerStaticRunTimeData.customizationFirePointData = customizationFirePointData;
        PlayerStaticRunTimeData.customizationTruckData     = customizationTruckData;
        if (PersistentPlayerDataHandler.LoadData() == null)
        {
            PlayerStaticRunTimeData.coins += 20000;
            PersistentPlayerDataHandler.SaveData(PlayerStaticRunTimeData.playerTruckData, PlayerStaticRunTimeData.playerFirePointData, new PlayerSessionData(0, 0));
        }
        else
        {
            PlayerStaticRunTimeData.LoadData();
        }

        UnityEngine.SceneManagement.SceneManager.LoadScene("Customization");
    }
Пример #3
0
 public void UpgradeGunData(GameEnums.GunDataType gunDataTypeToBuy, int cost)
 {
     if (PlayerStaticRunTimeData.coins >= cost)
     {
         for (int i = 0; i < PlayerStaticRunTimeData.playerFirePointData.gunsConfigurations.Length; i++)
         {
             if (PlayerStaticRunTimeData.playerFirePointData.gunsConfigurations[i].locationPath.ToString() == gunPoint.locationPath)
             {
                 PlayerStaticRunTimeData.playerFirePointData.gunsConfigurations[i].gunDataType        = gunDataTypeToBuy;
                 PlayerStaticRunTimeData.customizationFirePointData.gunsConfigurations[i].gunDataType = gunDataTypeToBuy;
             }
         }
         PlayerStaticRunTimeData.coins -= cost;
         currentGunDataType             = gunDataTypeToBuy;
         PersistentPlayerDataHandler.SaveData(PlayerStaticRunTimeData.playerTruckData, PlayerStaticRunTimeData.playerFirePointData, new PlayerSessionData(0, 0));
     }
     PlayerDataDebug.RefreshStatistics();
     UpdateGunStats();
 }
Пример #4
0
 private void StartLevelLoadCheck()
 {
     PersistentPlayerDataHandler.SaveData(PlayerStaticRunTimeData.playerTruckData, PlayerStaticRunTimeData.playerFirePointData, new PlayerSessionData(0, 0));
     asyncLoad.allowSceneActivation = true;
 }