Example #1
0
    public static void LoadData()
    {
        SerializablePlayerData data = PersistentPlayerDataHandler.LoadData();

        if (data != null)
        {
            playerTruckData.truckType     = (GameEnums.Truck)data.truckType;
            playerTruckData.firePointType = (GameEnums.FirePointType)data.firePointType;

            for (int i = 0; i < playerFirePointData.gunsConfigurations.Length; i++)
            {
                var config = playerFirePointData.gunsConfigurations[i];
                config.gunType       = (GameEnums.Gun)data.gunTypes[i];
                config.locationPath  = (GameEnums.GunLocation)data.locationPaths[i];
                config.trackingGroup = (GameEnums.TrackingGroup)data.trackingGroups[i];
                config.gunDataType   = (GameEnums.GunDataType)data.gunDataTypes[i];
            }

            maxTraveledDistancePerSession = data.maxTraveledDistancePerSession;
            traveledDistance             = data.traveledDistance;
            maxDefeatedEnemiesPerSession = data.maxDefeatedEnemiesPerSession;
            defeatedEnemies = data.defeatedEnemies;
            coins           = data.coins;
            experience      = data.experience;
        }
    }
Example #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");
    }