1. Change the 02.Main_TG2 scene for testing
2. Add DebugType used for Utils.GetComponentAndAssert()
This commit is contained in:
parent
ea03670618
commit
f6d858dfec
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,26 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
using UnityEngine.Assertions;
|
||||
using Debug = UnityEngine.Debug;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace BlueWaterProject
|
||||
{
|
||||
public class Utils
|
||||
{
|
||||
public enum DebugType
|
||||
{
|
||||
NONE,
|
||||
LOG,
|
||||
WARNING,
|
||||
ERROR,
|
||||
DEBUG_ASSERT,
|
||||
ASSERT //
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 각도를 통해 방향값을 반환하는 함수
|
||||
/// </summary>
|
||||
@ -25,10 +38,33 @@ namespace BlueWaterProject
|
||||
// return newBehaviorTask;
|
||||
// }
|
||||
|
||||
public static T GetComponentAndAssert<T>(Transform componentLocation) where T : class
|
||||
public static T GetComponentAndAssert<T>(Transform componentLocation, DebugType debugType = DebugType.DEBUG_ASSERT) where T : class
|
||||
{
|
||||
var newComponent = componentLocation.GetComponent<T>();
|
||||
Assert.IsNotNull(newComponent, typeof(T) + "타입의 Component가 존재하지 않습니다.");
|
||||
|
||||
switch (debugType)
|
||||
{
|
||||
case DebugType.NONE:
|
||||
Debug.Log("DebugType is None.");
|
||||
break;
|
||||
case DebugType.LOG:
|
||||
Debug.Log(typeof(T) + "타입의 Component가 존재하지 않습니다.");
|
||||
break;
|
||||
case DebugType.WARNING:
|
||||
Debug.LogWarning(typeof(T) + "타입의 Component가 존재하지 않습니다.");
|
||||
break;
|
||||
case DebugType.ERROR:
|
||||
Debug.LogError(typeof(T) + "타입의 Component가 존재하지 않습니다.");
|
||||
break;
|
||||
case DebugType.DEBUG_ASSERT:
|
||||
Debug.Assert(newComponent != null, typeof(T) + "타입의 Component가 존재하지 않습니다.");
|
||||
break;
|
||||
case DebugType.ASSERT:
|
||||
Assert.IsNotNull(newComponent, typeof(T) + "타입의 Component가 존재하지 않습니다.");
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(debugType), debugType, null);
|
||||
}
|
||||
|
||||
return newComponent;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user