Utilities.Constants 에서 상수들을 따로 관리하는 클래스 추가
This commit is contained in:
parent
8a2abb5a40
commit
5065d1a738
@ -17,7 +17,7 @@ public async void PostInit()
|
||||
{
|
||||
try
|
||||
{
|
||||
ItemDataSo = await AssetManager.LoadAsset<ItemDataSo>("ItemDataSo");
|
||||
ItemDataSo = await AssetManager.LoadAsset<ItemDataSo>(DataConstants.ItemDataSo);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -12,10 +12,10 @@ private async void Start()
|
||||
{
|
||||
try
|
||||
{
|
||||
var playerPrefab = await AssetManager.LoadAsset<GameObject>("RestaurantPlayer");
|
||||
var playerPrefab = await AssetManager.LoadAsset<GameObject>(CommonConstants.RestaurantPlayer);
|
||||
var player = Instantiate(playerPrefab, _spawnPosition, playerPrefab.transform.rotation);
|
||||
player.name = "RestaurantPlayer";
|
||||
CameraManager.Instance.GetCameraGameObject("RestaurantBaseCamera").SetFollowAndLookAtTarget(player.transform);
|
||||
player.name = CommonConstants.RestaurantPlayer;
|
||||
CameraManager.Instance.GetCameraGameObject(CameraType.RestaurantBaseCamera).SetFollowAndLookAtTarget(player.transform);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -24,14 +24,14 @@ private void Awake()
|
||||
{
|
||||
_rigidbody = GetComponent<Rigidbody>();
|
||||
_animation = GetComponent<RestaurantCharacterAnimation>();
|
||||
_visualLook = transform.Find("VisualLook");
|
||||
_visualLook = transform.Find(CommonConstants.VisualLook);
|
||||
}
|
||||
|
||||
private async void Start()
|
||||
{
|
||||
try
|
||||
{
|
||||
_playerData = await AssetManager.LoadAsset<RestaurantPlayerDataSo>("RestaurantPlayerDataSo");
|
||||
_playerData = await AssetManager.LoadAsset<RestaurantPlayerDataSo>(DataConstants.RestaurantPlayerDataSo);
|
||||
|
||||
_playerData.MoveActionReference.action.performed += OnMove;
|
||||
_playerData.MoveActionReference.action.canceled += OnMove;
|
||||
@ -107,7 +107,7 @@ private void Move()
|
||||
SetCurrentDirection(_inputDirection);
|
||||
|
||||
_isMoving = _inputDirection != Vector3.zero;
|
||||
string animationName = _isMoving ? "RunFast" : "Idle";
|
||||
string animationName = _isMoving ? RestaurantPlayerAnimation.Walk : RestaurantPlayerAnimation.Idle;
|
||||
_animation.PlayAnimation(animationName, true);
|
||||
|
||||
Vector3 finalVelocity = _inputDirection * _playerData.MoveSpeed;
|
||||
@ -134,7 +134,7 @@ private IEnumerator DashCoroutine()
|
||||
_isDashing = true;
|
||||
_isDashCooldown = true;
|
||||
|
||||
_animation.PlayAnimationDuration("Dash", false, _playerData.DashTime);
|
||||
_animation.PlayAnimationDuration(RestaurantPlayerAnimation.Dash, false, _playerData.DashTime);
|
||||
|
||||
Vector3 dashVelocity = _currentDirection.normalized * _playerData.DashSpeed;
|
||||
_rigidbody.linearVelocity = dashVelocity;
|
||||
|
21
Assets/_DDD/_Scripts/Utilities/Constants.cs
Normal file
21
Assets/_DDD/_Scripts/Utilities/Constants.cs
Normal file
@ -0,0 +1,21 @@
|
||||
namespace DDD
|
||||
{
|
||||
public static class CommonConstants
|
||||
{
|
||||
public const string VisualLook = "VisualLook";
|
||||
public const string RestaurantPlayer = "RestaurantPlayer";
|
||||
}
|
||||
|
||||
public static class DataConstants
|
||||
{
|
||||
public const string ItemDataSo = "ItemDataSo";
|
||||
public const string RestaurantPlayerDataSo = "RestaurantPlayerDataSo";
|
||||
}
|
||||
|
||||
public static class RestaurantPlayerAnimation
|
||||
{
|
||||
public const string Idle = "Idle";
|
||||
public const string Walk = "RunFast";
|
||||
public const string Dash = "Dash";
|
||||
}
|
||||
}
|
2
Assets/_DDD/_Scripts/Utilities/Constants.cs.meta
Normal file
2
Assets/_DDD/_Scripts/Utilities/Constants.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e8cf38ab843c9e40a94a26ba7102dc4
|
Loading…
Reference in New Issue
Block a user