massive number of fixes, removed compilation error, logs, negative scale issues, serialization issues ETC

This commit is contained in:
2024-11-25 15:15:55 +01:00
parent 48d565f77e
commit 8d766ed470
48 changed files with 1442 additions and 2434 deletions

View File

@@ -10,6 +10,7 @@ using Sirenix.OdinInspector;
using SRF.Components;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
namespace Beyond
{
@@ -50,6 +51,7 @@ namespace Beyond
}
private static GameStateManager s_instance = null;
private static bool s_isDestroyed = false;
private float m_enemyDamageModifier = 1f;
public SaveData m_saveData = new();
private HashSet<string> m_CompabStates;
@@ -63,6 +65,11 @@ namespace Beyond
{
return s_instance;
}
else if (s_isDestroyed)
{
//don't recreate object after scene destorys it
return null;
}
else
{
var inst = FindObjectOfType<GameStateManager>();
@@ -80,7 +87,13 @@ namespace Beyond
return s_instance;
}
}
//public void OnSc
public override void OnDestroy()
{
base.OnDestroy();
s_isDestroyed = true;
// Debug.Log("Destroying GameStateManager");
}
//[ShowInInspector]
public Difficulty GameDifficulty => m_saveData.difficulty;
@@ -95,7 +108,7 @@ namespace Beyond
Destroy(this);
return;
}
SceneManager.sceneLoaded += SceneManager_sceneUnloaded;
s_instance = this;
//SetDifficulty(Difficulty.NORMAL);
m_CompabStates = new HashSet<string>();
@@ -109,6 +122,11 @@ namespace Beyond
m_IdleStates.Add("Flee");
m_IdleStates.Add("Patrol");
}
//reset isDestroyed, so object can be recreated for the next scene
private void SceneManager_sceneUnloaded(Scene arg0, LoadSceneMode arg1)
{
s_isDestroyed = false;
}
public enum State
{