From 069c7eda00c0d25ce8194f2fa9291d02d1c4ed90 Mon Sep 17 00:00:00 2001 From: craftwill Date: Sun, 23 Jun 2024 10:15:52 -0400 Subject: [PATCH] Cards and level spawning balance testing, Fixed some error logs --- Assets/Design/Levels/Level1.asset | 2 +- Assets/Design/Levels/WaveConfig_1_1.asset | 12 ++++++++++-- Assets/Design/UnitCards/Archer.asset | 2 +- Assets/Design/UnitCards/Castle.asset | 2 +- Assets/Design/UnitCards/Farm.asset | 2 +- Assets/Design/UnitCards/Farmer.asset | 2 +- Assets/Design/UnitCards/FarmerMob.asset | 2 +- Assets/Design/UnitCards/House.asset | 2 +- Assets/Design/UnitCards/Knight.asset | 2 +- Assets/Design/UnitCards/Mill.asset | 2 +- Assets/Scripts/LevelConfig/WaveObserver.cs | 2 +- Assets/Scripts/LevelManager/LevelManager.cs | 2 ++ Assets/Scripts/PlayerAction/ClickBehavior.cs | 4 ++-- Assets/Scripts/WorldMap/WorldMapSave.cs | 13 +++++++++++-- ProjectSettings/ProjectSettings.asset | 3 +-- 15 files changed, 36 insertions(+), 18 deletions(-) diff --git a/Assets/Design/Levels/Level1.asset b/Assets/Design/Levels/Level1.asset index 56169bb..23e574f 100644 --- a/Assets/Design/Levels/Level1.asset +++ b/Assets/Design/Levels/Level1.asset @@ -248,7 +248,7 @@ MonoBehaviour: _renderLayer: Default _position: {x: 0, y: 0} _scale: {x: 1, y: 1} - _waveConfig: {fileID: 11400000, guid: 61b21509b3e4be0438ea87b4e7a73e17, type: 2} + _waveConfig: {fileID: 11400000, guid: d8140ae36f1b7fd4fb1a57ab3dc69de4, type: 2} _startPopulation: 10 _startFood: 40 _startWood: 0 diff --git a/Assets/Design/Levels/WaveConfig_1_1.asset b/Assets/Design/Levels/WaveConfig_1_1.asset index 721069f..05d585f 100644 --- a/Assets/Design/Levels/WaveConfig_1_1.asset +++ b/Assets/Design/Levels/WaveConfig_1_1.asset @@ -16,8 +16,16 @@ MonoBehaviour: - _enemy: {fileID: 80204295746100150, guid: 1be769d6ef642314b8846bed35e7297c, type: 3} _count: 20 _nestedGroupSpawn: + - groupSpawn: + - _enemy: {fileID: 80204295746100150, guid: 2419a879bd4e47d4fa8b30de0fcdde42, type: 3} + _count: 2 + triggerTime: 0.25 - groupSpawn: - _enemy: {fileID: 80204295746100150, guid: 5bbf0d85fa5bb3f4599da79f0a84e3a9, type: 3} _count: 2 - triggerTime: 2 - _gameDuration: 3 + triggerTime: 0.5 + - groupSpawn: + - _enemy: {fileID: 80204295746100150, guid: 2419a879bd4e47d4fa8b30de0fcdde42, type: 3} + _count: 2 + triggerTime: 0.75 + _gameDuration: 1 diff --git a/Assets/Design/UnitCards/Archer.asset b/Assets/Design/UnitCards/Archer.asset index 32e6670..5368f99 100644 --- a/Assets/Design/UnitCards/Archer.asset +++ b/Assets/Design/UnitCards/Archer.asset @@ -15,4 +15,4 @@ MonoBehaviour: _wood: 30 _rock: 0 _food: 20 - _cooldownInSeconds: 3 + _cooldownInSeconds: 5 diff --git a/Assets/Design/UnitCards/Castle.asset b/Assets/Design/UnitCards/Castle.asset index 9967f38..5df408a 100644 --- a/Assets/Design/UnitCards/Castle.asset +++ b/Assets/Design/UnitCards/Castle.asset @@ -15,4 +15,4 @@ MonoBehaviour: _wood: 0 _rock: 350 _food: 0 - _cooldownInSeconds: 3 + _cooldownInSeconds: 30 diff --git a/Assets/Design/UnitCards/Farm.asset b/Assets/Design/UnitCards/Farm.asset index 441d687..8c0695b 100644 --- a/Assets/Design/UnitCards/Farm.asset +++ b/Assets/Design/UnitCards/Farm.asset @@ -15,4 +15,4 @@ MonoBehaviour: _wood: 40 _rock: 0 _food: 0 - _cooldownInSeconds: 3 + _cooldownInSeconds: 1 diff --git a/Assets/Design/UnitCards/Farmer.asset b/Assets/Design/UnitCards/Farmer.asset index c73acb3..57ad701 100644 --- a/Assets/Design/UnitCards/Farmer.asset +++ b/Assets/Design/UnitCards/Farmer.asset @@ -15,4 +15,4 @@ MonoBehaviour: _wood: 0 _rock: 0 _food: 10 - _cooldownInSeconds: 3 + _cooldownInSeconds: 1 diff --git a/Assets/Design/UnitCards/FarmerMob.asset b/Assets/Design/UnitCards/FarmerMob.asset index c48ae84..e63f0c2 100644 --- a/Assets/Design/UnitCards/FarmerMob.asset +++ b/Assets/Design/UnitCards/FarmerMob.asset @@ -15,4 +15,4 @@ MonoBehaviour: _wood: 0 _rock: 0 _food: 10 - _cooldownInSeconds: 3 + _cooldownInSeconds: 4 diff --git a/Assets/Design/UnitCards/House.asset b/Assets/Design/UnitCards/House.asset index 007b591..b7df2f2 100644 --- a/Assets/Design/UnitCards/House.asset +++ b/Assets/Design/UnitCards/House.asset @@ -15,4 +15,4 @@ MonoBehaviour: _wood: 50 _rock: 0 _food: 0 - _cooldownInSeconds: 3 + _cooldownInSeconds: 1 diff --git a/Assets/Design/UnitCards/Knight.asset b/Assets/Design/UnitCards/Knight.asset index 7152766..c6d7bc3 100644 --- a/Assets/Design/UnitCards/Knight.asset +++ b/Assets/Design/UnitCards/Knight.asset @@ -15,4 +15,4 @@ MonoBehaviour: _wood: 0 _rock: 0 _food: 60 - _cooldownInSeconds: 3 + _cooldownInSeconds: 10 diff --git a/Assets/Design/UnitCards/Mill.asset b/Assets/Design/UnitCards/Mill.asset index fed8a05..283fddb 100644 --- a/Assets/Design/UnitCards/Mill.asset +++ b/Assets/Design/UnitCards/Mill.asset @@ -15,4 +15,4 @@ MonoBehaviour: _wood: 120 _rock: 0 _food: 0 - _cooldownInSeconds: 3 + _cooldownInSeconds: 60 diff --git a/Assets/Scripts/LevelConfig/WaveObserver.cs b/Assets/Scripts/LevelConfig/WaveObserver.cs index 4d6e660..fa8f1b0 100644 --- a/Assets/Scripts/LevelConfig/WaveObserver.cs +++ b/Assets/Scripts/LevelConfig/WaveObserver.cs @@ -20,7 +20,7 @@ public class WaveObserver : Singleton public void Init(WaveConfig config) { - _levelConfig = Object.Instantiate(config); + _levelConfig = config; _copyConstantSpawn = new List(); _copyGroupSpawn = new List>(); _groupSpawnTimers = new List(); diff --git a/Assets/Scripts/LevelManager/LevelManager.cs b/Assets/Scripts/LevelManager/LevelManager.cs index c1b1ea7..d47011d 100644 --- a/Assets/Scripts/LevelManager/LevelManager.cs +++ b/Assets/Scripts/LevelManager/LevelManager.cs @@ -164,6 +164,8 @@ public class LevelManager : Singleton ClearLevel(); + Debug.Log("Load level: " + _currentLevel.name + " using " + _currentLevel.WaveConfig.name); + _currentLevel = level; _waveObserver = WaveObserver.Instance; _waveObserver.Init(_currentLevel.WaveConfig); diff --git a/Assets/Scripts/PlayerAction/ClickBehavior.cs b/Assets/Scripts/PlayerAction/ClickBehavior.cs index 5927c39..80a9af3 100644 --- a/Assets/Scripts/PlayerAction/ClickBehavior.cs +++ b/Assets/Scripts/PlayerAction/ClickBehavior.cs @@ -23,7 +23,7 @@ public class ClickBehavior : MonoBehaviour } } -#if UNITY_EDITOR +/*#if UNITY_EDITOR if (Input.GetMouseButtonUp(0)) { const float clickRangeForSpawn = 0.7f; @@ -36,7 +36,7 @@ public class ClickBehavior : MonoBehaviour closest.TriggerSpawnDebug(); } } -#endif +#endif*/ } /// diff --git a/Assets/Scripts/WorldMap/WorldMapSave.cs b/Assets/Scripts/WorldMap/WorldMapSave.cs index 83bf361..8a8e027 100644 --- a/Assets/Scripts/WorldMap/WorldMapSave.cs +++ b/Assets/Scripts/WorldMap/WorldMapSave.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using UnityEngine; using System.IO; using System.Runtime.Serialization.Formatters.Binary; +using System.Linq; public class WorldMapSave { @@ -20,9 +21,10 @@ public class WorldMapSave public void WorldInitialition() { - filePath = Application.persistentDataPath + "/data.dat"; + Debug.Log("Filepath world save: " + Application.persistentDataPath + " + \"/data.dat\""); + if (File.Exists(filePath)) { ReadData(); @@ -60,7 +62,7 @@ public class WorldMapSave } // If LevelState.SAVED not find - return -1; + return 0; } public void UnlockNextLevel() @@ -69,6 +71,13 @@ public class WorldMapSave ReadData(); //int actuelLevel = PlayerPrefs.GetInt(LevelToLoad,NoLevel); //Debug.Log(actuelLevel); + + if (levelUnlocked.Length <= 0) + { + Debug.LogError("Why is LevelUnlocked list empty?"); + return; + } + levelUnlocked[GetSavedLevelIndex() + 1] = LevelState.SAVED; levelUnlocked[GetSavedLevelIndex()] = LevelState.UNLOCKED; WriteData(); diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index e8e4e2e..7b42db3 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -135,8 +135,7 @@ PlayerSettings: 16:9: 1 Others: 1 bundleVersion: 1.0 - preloadedAssets: - - {fileID: 11400000, guid: 2670dfbb5772b0248b8c8ccaa6470d9a, type: 2} + preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1