Merge remote-tracking branch 'origin/main'

This commit is contained in:
M1_IDMhan 2023-08-23 11:58:08 +09:00
commit 46a19eb8c0
4 changed files with 20 additions and 13 deletions

View File

@ -39,7 +39,7 @@ namespace BlueWaterProject
[EnableIf("alwaysFalse")]
[EnumToggleButtons]
[SerializeField] protected AttackerType attackerType;
private bool alwaysFalse = false;
private bool alwaysFalse;
[EnableIf("alwaysFalse")]
[ShowIf("attackerType", AttackerType.OFFENSE)]

View File

@ -155,21 +155,16 @@ namespace BlueWaterProject
}
[PropertyOrder(-7)]
[EnableIf("@unit.soliderCount > 0 && attackerType != AttackerType.NONE")]
[GUIColor(1, 0, 0)]
[Button("타입 초기화")]
private void ResetTypeAll()
[Button("유닛 초기화")]
private void ResetUnit()
{
unit = new Unit();
attackIslandInfo = null;
attackerType = AttackerType.NONE;
offenseType = OffenseType.NONE;
defenseType = DefenseType.NONE;
foreach (var soldier in unit.soldierList)
{
soldier.SetAttackerType(attackerType);
soldier.SetOffenseType(offenseType);
soldier.SetDefenseType(defenseType);
}
isClickedTypeAllButton = false;
}
[PropertyOrder(1)]

View File

@ -57,9 +57,8 @@ namespace BlueWaterProject
#region Unity built-in function
protected override void Awake()
protected override void OnAwake()
{
base.Awake();
GroundLayer = LayerMask.GetMask("Ground");
InitUnitMatrices();
InitPlayerUnitList();

View File

@ -24,6 +24,19 @@ public abstract class Singleton<T> : Singleton where T : MonoBehaviour
{
if (Quitting)
{
if (_instance != null)
return _instance;
var instances = FindObjectsOfType<T>();
var count = instances.Length;
if (count > 0)
{
if (count == 1)
return _instance = instances[0];
Debug.LogWarning($"[{nameof(Singleton)}<{typeof(T)}>] There should never be more than one {nameof(Singleton)} of type {typeof(T)} in the scene, but {count} were found. The first instance found will be used, and all others will be destroyed.");
for (var i = 1; i < instances.Length; i++)
Destroy(instances[i]);
return _instance = instances[0];
}
Debug.LogWarning($"[{nameof(Singleton)}<{typeof(T)}>] Instance will not be returned because the application is quitting.");
// ReSharper disable once AssignNullToNotNullAttribute
return null;