diff --git a/Dashing Game/Assets/Scripts/Controllers/HomeScreenController.cs b/Dashing Game/Assets/Scripts/Controllers/HomeScreenController.cs index 4f0dd66..efd1f9e 100644 --- a/Dashing Game/Assets/Scripts/Controllers/HomeScreenController.cs +++ b/Dashing Game/Assets/Scripts/Controllers/HomeScreenController.cs @@ -72,19 +72,34 @@ void Awake() if (Saver.loadData() == null || false) //the || false/true is for debugging purposes { //new player, create new player data file + List skins = new List(); + skins.Add(0); + PlayerData newPlayerData = new PlayerData(true, 0, 0, //new player, money, and highscore 0, 0, 0, 0, 0, //upgrades (reset all to zero) 0, //number of crystals unlocked (set to zero) - new List(), 0, //IDs of currently unlocked skins + skins, 0, //IDs of currently unlocked skins 0, true); //sound (medium volume, music turned on) Debug.Log("New player, creating player data file"); Saver.SavePlayer(newPlayerData); } - //load data data = Saver.loadData(); + #region Upgrading player data files if necessary + if (data.SkinsUnlocked == null) + { + List skins = new List(); + skins.Add(0); + data.SkinsUnlocked = skins; + data.SelectedSkin = 0; + + Saver.SavePlayer(data); + } + #endregion + + //load data money = data.Money; highScore = data.HighScore; diff --git a/Dashing Game/Assets/Scripts/Controllers/UgradeScreenController.cs b/Dashing Game/Assets/Scripts/Controllers/UgradeScreenController.cs index fdec5a6..c06b272 100644 --- a/Dashing Game/Assets/Scripts/Controllers/UgradeScreenController.cs +++ b/Dashing Game/Assets/Scripts/Controllers/UgradeScreenController.cs @@ -99,7 +99,6 @@ void Awake() updateCrystalSprite(); curColor = 0; - playerCustomization.setColor(curColor, true, true); playerCustomization.SkinCost = 300; //keeping all the set prices in this file for organization } @@ -349,6 +348,8 @@ public void BuySkin() data.SelectedSkin = curColor; Saver.SavePlayer(data); } + + playerCustomization.setColor(curColor, data.SkinsUnlocked.Contains(curColor), data.SelectedSkin == curColor); } #endregion } diff --git a/Dashing Game/Assets/Scripts/Player.cs b/Dashing Game/Assets/Scripts/Player.cs index f3d98cd..f9beb82 100644 --- a/Dashing Game/Assets/Scripts/Player.cs +++ b/Dashing Game/Assets/Scripts/Player.cs @@ -231,6 +231,24 @@ void Awake() if (SceneManager.GetActiveScene().name != "Main" && LevelController.saved) //if there are saved settings loadTempState(); //load temp saved data because the level changed + + //set the player's color + if (HomeScreenController.PlayerColors != null && data.SelectedSkin != 0) + { + Color selectedSkin = HomeScreenController.PlayerColors[data.SelectedSkin]; + + GetComponent().color = selectedSkin; + dash_light.color = selectedSkin; + ParticleSystem.MainModule p_settings = dash_particles.main; + + //create a slightly brighter color for the second particle color + Color secondColor = selectedSkin; + secondColor.r = Mathf.Max(0, secondColor.r - 0.2f); + secondColor.g = Mathf.Max(0, secondColor.g - 0.2f); + secondColor.b = Mathf.Max(0, secondColor.b - 0.2f); + + p_settings.startColor = new ParticleSystem.MinMaxGradient(selectedSkin, secondColor); + } } void Start() diff --git a/Dashing Game/Assets/Scripts/Upgrade Menu/PlayerCustomization.cs b/Dashing Game/Assets/Scripts/Upgrade Menu/PlayerCustomization.cs index 49b576b..7fca67a 100644 --- a/Dashing Game/Assets/Scripts/Upgrade Menu/PlayerCustomization.cs +++ b/Dashing Game/Assets/Scripts/Upgrade Menu/PlayerCustomization.cs @@ -65,7 +65,10 @@ void Awake() void Start() { + PlayerData data = Saver.loadData(); + priceText.SetText("$" + skinCost); + setColor(0, true, data.SelectedSkin == 0); } void Update() diff --git a/Dashing Game/Assets/Store.unity b/Dashing Game/Assets/Store.unity index 525b2d0..8ee02e6 100644 --- a/Dashing Game/Assets/Store.unity +++ b/Dashing Game/Assets/Store.unity @@ -98,7 +98,7 @@ LightmapSettings: m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 m_LightingDataAsset: {fileID: 0} - m_UseShadowmask: 1 + m_UseShadowmask: 0 --- !u!196 &4 NavMeshSettings: serializedVersion: 2 @@ -640,7 +640,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: -75.8} - m_SizeDelta: {x: 98.55, y: 30} + m_SizeDelta: {x: 141.84, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &244908673 MonoBehaviour: @@ -665,7 +665,7 @@ MonoBehaviour: m_NormalColor: {r: 1, g: 1, b: 1, a: 0} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 0.4117647} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.83137256} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 0} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0} m_ColorMultiplier: 1 m_FadeDuration: 0.1 @@ -1588,19 +1588,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: TurnSpeedNormal: 30 - TurnSpeedMax: 100 - TurnSpeedDecay: 2.5 - PlayerColors: - - {r: 1, g: 1, b: 1, a: 1} - - {r: 0, g: 1, b: 0, a: 1} - - {r: 0, g: 0, b: 1, a: 1} - - {r: 1, g: 0, b: 0, a: 1} - - {r: 1, g: 1, b: 0, a: 1} - - {r: 1, g: 0, b: 1, a: 1} - - {r: 0.4319067, g: 0, b: 1, a: 1} - - {r: 0, g: 1, b: 0.71418786, a: 1} - - {r: 1, g: 0.5458693, b: 0, a: 1} - - {r: 1, g: 0, b: 0.41291904, a: 1} + TurnSpeedMax: 1000 + TurnSpeedDecay: 10 --- !u!1 &738522068 GameObject: m_ObjectHideFlags: 0