Skip to content

Commit 8f8b9d7

Browse files
Updating Scripts
1 parent 905fcd9 commit 8f8b9d7

3 files changed

Lines changed: 20 additions & 24 deletions

File tree

Assets/Scripts/ApplyRemoteConfigSettings.cs

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ async void Start()
8080
// call with await keyword our async Task function
8181
await InitializeRemoteConfigAsync();
8282

83+
// Set-up for how to send a custom Struct value
8384
userAttributes uaStruct = new userAttributes();
8485
uaStruct.score = 10;
8586

@@ -120,20 +121,20 @@ private void RemoteConfigLoaded(ConfigResponse configResponse)
120121
{
121122
SetLocalization(language);
122123
}
124+
125+
season = ConfigManager.appConfig.GetString("Season");
126+
Debug.Log("RC Season " + (ConfigManager.appConfig.GetString("Season")));
123127

124128
activeHat = ConfigManager.appConfig.GetInt("ActiveHat");
125-
//Debug.Log("RC Active Hat " + (ConfigManager.appConfig.GetInt("ActiveHat")));
129+
Debug.Log("RC Active Hat " + (ConfigManager.appConfig.GetInt("ActiveHat")));
126130

127131

128132
characterSize = ConfigManager.appConfig.GetFloat("CharacterSize");
129-
//Debug.Log("RC Size " + (ConfigManager.appConfig.GetFloat("CharacterSize")));
133+
Debug.Log("RC Size " + (ConfigManager.appConfig.GetFloat("CharacterSize")));
130134

131135

132136
characterSpeed = ConfigManager.appConfig.GetFloat("CharacterSpeed");
133-
//Debug.Log("RC Speed " + (ConfigManager.appConfig.GetFloat("CharacterSpeed")));
134-
135-
season = ConfigManager.appConfig.GetString("Season");
136-
//Debug.Log("RC Season " + (ConfigManager.appConfig.GetString("Season")));
137+
Debug.Log("RC Speed " + (ConfigManager.appConfig.GetFloat("CharacterSpeed")));
137138
break;
138139
}
139140
}
@@ -144,22 +145,10 @@ public void FetchConfigs()
144145
ConfigManager.FetchConfigs<userAttributes, appAttributes>(new userAttributes(){}, new appAttributes(){});
145146

146147
ConfigManager.FetchCompleted += RemoteConfigLoaded;
147-
148-
//activeHat = ConfigManager.appConfig.GetInt("ActiveHat");
149-
150-
Debug.Log("RC Size " + (ConfigManager.appConfig.GetFloat("CharacterSize")));
151-
152-
//characterSize = ConfigManager.appConfig.GetFloat("CharacterSize");
153-
154-
Debug.Log("RC Speed " + (ConfigManager.appConfig.GetFloat("CharacterSpeed")));
155-
156-
//characterSpeed = ConfigManager.appConfig.GetFloat("CharacterSpeed");
157-
158-
Debug.Log("RC Active Hat " + (ConfigManager.appConfig.GetInt("ActiveHat")));
159-
Debug.Log("Local Active Hat " + activeHat);
160148
}
161149

162-
// Can also use a Switch / Case check, as well as a Scriptable Object to hold the variable for the new language for more areas of the game to
150+
// Can also use a Switch / Case check, or store the localization variable in a Scriptable Object to hold the
151+
//variable for the new language for more areas of the game to reference
163152
public void SetLocalization(string str)
164153
{
165154
if (str == "English")

Assets/Scripts/Loading.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ private void OnSceneLoaded(AsyncOperationHandle obj)
5858
}
5959
}
6060

61+
// Function to handle which level is loaded next
6162
public void GoToNextLevel()
6263
{
63-
if(ApplyRemoteConfigSettings.Instance.season != "Winter")
64+
if(ApplyRemoteConfigSettings.Instance.season == "Default")
6465
{
6566
Addressables.LoadSceneAsync("Level_0" + GameManager.s_CurrentLevel, UnityEngine.SceneManagement.LoadSceneMode.Single, true);
6667
}
@@ -71,6 +72,13 @@ public void GoToNextLevel()
7172
Debug.LogError("InsideGoToNextLevel()");
7273
Addressables.LoadSceneAsync("Level_0" + "4", UnityEngine.SceneManagement.LoadSceneMode.Single, true);
7374
}
75+
76+
// Else If the season is supposed to be Halloween
77+
else if (ApplyRemoteConfigSettings.Instance.season == "Halloween")
78+
{
79+
Debug.LogError("InsideGoToNextLevel()");
80+
Addressables.LoadSceneAsync("Level_0" + "2", UnityEngine.SceneManagement.LoadSceneMode.Single, true);
81+
}
7482
}
7583

7684
private void Update()

Assets/Scripts/PlayerConfigurator.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using UnityEngine.AddressableAssets;
33
using UnityEngine.ResourceManagement.AsyncOperations;
44

5+
// Used for the Hat selection logic
56
public class PlayerConfigurator : MonoBehaviour
67
{
78
[SerializeField]
@@ -25,7 +26,6 @@ void Start()
2526
//SetHat(string.Format("Hat{0:00}", UnityEngine.Random.Range(0, 4)));
2627

2728
// Fetch the correct hat variable from the ApplyRemoteConfigSettings instance
28-
2929
if (ApplyRemoteConfigSettings.Instance.season == "Default")
3030
{
3131
//Debug.Log("Formatted String 2 " + string.Format("Hat{0:00}", remoteConfigScript.activeHat));
@@ -43,12 +43,11 @@ void Start()
4343
SetHat(string.Format("Hat{0:00}", "05"));
4444
}
4545

46-
// hatKey is an Addressable Label
46+
//hatKey is an Addressable Label
4747
//Debug.Log("Hat String: " + string.Format("Hat{0:00}", UnityEngine.Random.Range(0, 4)));
4848
}
4949
}
5050

51-
// TODO: Change the string parameter
5251
public void SetHat(string hatKey)
5352
{
5453
// We are using the InstantiateAsync function on the Addressables API, the non-Addressables way

0 commit comments

Comments
 (0)