Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
46a19eb8c0
@ -39,7 +39,7 @@ namespace BlueWaterProject
|
|||||||
[EnableIf("alwaysFalse")]
|
[EnableIf("alwaysFalse")]
|
||||||
[EnumToggleButtons]
|
[EnumToggleButtons]
|
||||||
[SerializeField] protected AttackerType attackerType;
|
[SerializeField] protected AttackerType attackerType;
|
||||||
private bool alwaysFalse = false;
|
private bool alwaysFalse;
|
||||||
|
|
||||||
[EnableIf("alwaysFalse")]
|
[EnableIf("alwaysFalse")]
|
||||||
[ShowIf("attackerType", AttackerType.OFFENSE)]
|
[ShowIf("attackerType", AttackerType.OFFENSE)]
|
||||||
|
@ -155,21 +155,16 @@ namespace BlueWaterProject
|
|||||||
}
|
}
|
||||||
|
|
||||||
[PropertyOrder(-7)]
|
[PropertyOrder(-7)]
|
||||||
[EnableIf("@unit.soliderCount > 0 && attackerType != AttackerType.NONE")]
|
|
||||||
[GUIColor(1, 0, 0)]
|
[GUIColor(1, 0, 0)]
|
||||||
[Button("타입 초기화")]
|
[Button("유닛 초기화")]
|
||||||
private void ResetTypeAll()
|
private void ResetUnit()
|
||||||
{
|
{
|
||||||
|
unit = new Unit();
|
||||||
|
attackIslandInfo = null;
|
||||||
attackerType = AttackerType.NONE;
|
attackerType = AttackerType.NONE;
|
||||||
offenseType = OffenseType.NONE;
|
offenseType = OffenseType.NONE;
|
||||||
defenseType = DefenseType.NONE;
|
defenseType = DefenseType.NONE;
|
||||||
|
isClickedTypeAllButton = false;
|
||||||
foreach (var soldier in unit.soldierList)
|
|
||||||
{
|
|
||||||
soldier.SetAttackerType(attackerType);
|
|
||||||
soldier.SetOffenseType(offenseType);
|
|
||||||
soldier.SetDefenseType(defenseType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[PropertyOrder(1)]
|
[PropertyOrder(1)]
|
||||||
|
@ -57,9 +57,8 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
#region Unity built-in function
|
#region Unity built-in function
|
||||||
|
|
||||||
protected override void Awake()
|
protected override void OnAwake()
|
||||||
{
|
{
|
||||||
base.Awake();
|
|
||||||
GroundLayer = LayerMask.GetMask("Ground");
|
GroundLayer = LayerMask.GetMask("Ground");
|
||||||
InitUnitMatrices();
|
InitUnitMatrices();
|
||||||
InitPlayerUnitList();
|
InitPlayerUnitList();
|
||||||
|
@ -24,6 +24,19 @@ public abstract class Singleton<T> : Singleton where T : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (Quitting)
|
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.");
|
Debug.LogWarning($"[{nameof(Singleton)}<{typeof(T)}>] Instance will not be returned because the application is quitting.");
|
||||||
// ReSharper disable once AssignNullToNotNullAttribute
|
// ReSharper disable once AssignNullToNotNullAttribute
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user