Combat2D 씬 작업 중

CombatPlayer 수정 작업 중
Input System 수정
This commit is contained in:
NTG_Lenovo 2024-05-02 16:10:19 +09:00
parent be6a089e43
commit e4ccf72d84
14 changed files with 1474 additions and 379 deletions

File diff suppressed because it is too large Load Diff

View File

@ -135,15 +135,6 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Dash"",
""type"": ""Button"",
""id"": ""c68960a5-036f-4304-8d05-25778470ecfd"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""ActivateMainSkill"",
""type"": ""Button"",
@ -396,17 +387,6 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""5a134753-6868-4dec-9b0e-5839b48f7417"",
""path"": ""<Keyboard>/space"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""Dash"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""f1364876-ede7-4831-b23e-532d6995031e"",
@ -546,31 +526,31 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
]
},
{
""name"": ""Unit"",
""id"": ""72deb161-83b9-4d14-8bcf-0bd0c122f76f"",
""name"": ""Combat"",
""id"": ""fcad259b-ca44-46e3-b008-1297fa7be828"",
""actions"": [
{
""name"": ""SelectUnit"",
""name"": ""Move"",
""type"": ""Value"",
""id"": ""4714fdf1-f399-40c7-b623-660c9bfff052"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""Attack"",
""type"": ""Button"",
""id"": ""2c1978d2-b4be-453a-9413-7b54903dbf38"",
""id"": ""5ff50411-308e-490e-acb2-e1001785169d"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""CancelSelectedUnit"",
""name"": ""Dash"",
""type"": ""Button"",
""id"": ""952be7b5-8952-47b7-a2db-ced6517d161a"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""MoveUnit"",
""type"": ""Button"",
""id"": ""2fe8434e-42e2-4b88-b0b3-0b2b4f8596a8"",
""id"": ""07c70113-456d-4ae6-a273-92bfa09153c2"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
@ -578,36 +558,91 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
}
],
""bindings"": [
{
""name"": ""WASD"",
""id"": ""362fb18c-8b50-4fcd-9bc9-9fcab5fd2ce5"",
""path"": ""2DVector"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Move"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""up"",
""id"": ""36746c9d-eca6-4ff8-bcec-2d658d907744"",
""path"": ""<Keyboard>/w"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""down"",
""id"": ""8420a87e-ccc1-4940-addd-1516ac2896af"",
""path"": ""<Keyboard>/s"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""left"",
""id"": ""6ac0b570-a29a-40f9-b039-c4085ef669a8"",
""path"": ""<Keyboard>/a"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""right"",
""id"": ""975926ee-895b-4858-b17d-c8ccc3142fb4"",
""path"": ""<Keyboard>/d"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""2daa9903-ce4b-4c8d-9347-5f59b09e8674"",
""id"": ""17f1b73a-900f-477d-b3aa-2cfc0335591f"",
""path"": ""<Mouse>/leftButton"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""SelectUnit"",
""action"": ""Attack"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""76632044-5edc-4dba-97aa-64d5173c78ec"",
""path"": ""<Mouse>/rightButton"",
""id"": ""acdb5d7e-efe0-4c9a-9c7c-c6810fc37c72"",
""path"": ""<Keyboard>/k"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""MoveUnit"",
""action"": ""Attack"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""e768abd0-e04f-4441-b6b3-09f456041cd8"",
""path"": ""<Keyboard>/escape"",
""id"": ""4a22ea68-00e5-46bf-b622-b6ceb0351141"",
""path"": ""<Keyboard>/space"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""CancelSelectedUnit"",
""action"": ""Dash"",
""isComposite"": false,
""isPartOfComposite"": false
}
@ -658,7 +693,6 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
m_Player_SpawnInIsladnPlayer = m_Player.FindAction("SpawnInIsladnPlayer", throwIfNotFound: true);
m_Player_CancelHold = m_Player.FindAction("CancelHold", throwIfNotFound: true);
m_Player_Attack = m_Player.FindAction("Attack", throwIfNotFound: true);
m_Player_Dash = m_Player.FindAction("Dash", throwIfNotFound: true);
m_Player_ActivateMainSkill = m_Player.FindAction("ActivateMainSkill", throwIfNotFound: true);
m_Player_ToggleLaunchMode = m_Player.FindAction("ToggleLaunchMode", throwIfNotFound: true);
m_Player_LaunchCannon = m_Player.FindAction("LaunchCannon", throwIfNotFound: true);
@ -670,11 +704,11 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
m_Camera = asset.FindActionMap("Camera", throwIfNotFound: true);
m_Camera_Zoom = m_Camera.FindAction("Zoom", throwIfNotFound: true);
m_Camera_Rotate = m_Camera.FindAction("Rotate", throwIfNotFound: true);
// Unit
m_Unit = asset.FindActionMap("Unit", throwIfNotFound: true);
m_Unit_SelectUnit = m_Unit.FindAction("SelectUnit", throwIfNotFound: true);
m_Unit_CancelSelectedUnit = m_Unit.FindAction("CancelSelectedUnit", throwIfNotFound: true);
m_Unit_MoveUnit = m_Unit.FindAction("MoveUnit", throwIfNotFound: true);
// Combat
m_Combat = asset.FindActionMap("Combat", throwIfNotFound: true);
m_Combat_Move = m_Combat.FindAction("Move", throwIfNotFound: true);
m_Combat_Attack = m_Combat.FindAction("Attack", throwIfNotFound: true);
m_Combat_Dash = m_Combat.FindAction("Dash", throwIfNotFound: true);
}
public void Dispose()
@ -748,7 +782,6 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
private readonly InputAction m_Player_SpawnInIsladnPlayer;
private readonly InputAction m_Player_CancelHold;
private readonly InputAction m_Player_Attack;
private readonly InputAction m_Player_Dash;
private readonly InputAction m_Player_ActivateMainSkill;
private readonly InputAction m_Player_ToggleLaunchMode;
private readonly InputAction m_Player_LaunchCannon;
@ -772,7 +805,6 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
public InputAction @SpawnInIsladnPlayer => m_Wrapper.m_Player_SpawnInIsladnPlayer;
public InputAction @CancelHold => m_Wrapper.m_Player_CancelHold;
public InputAction @Attack => m_Wrapper.m_Player_Attack;
public InputAction @Dash => m_Wrapper.m_Player_Dash;
public InputAction @ActivateMainSkill => m_Wrapper.m_Player_ActivateMainSkill;
public InputAction @ToggleLaunchMode => m_Wrapper.m_Player_ToggleLaunchMode;
public InputAction @LaunchCannon => m_Wrapper.m_Player_LaunchCannon;
@ -825,9 +857,6 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
@Attack.started += instance.OnAttack;
@Attack.performed += instance.OnAttack;
@Attack.canceled += instance.OnAttack;
@Dash.started += instance.OnDash;
@Dash.performed += instance.OnDash;
@Dash.canceled += instance.OnDash;
@ActivateMainSkill.started += instance.OnActivateMainSkill;
@ActivateMainSkill.performed += instance.OnActivateMainSkill;
@ActivateMainSkill.canceled += instance.OnActivateMainSkill;
@ -889,9 +918,6 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
@Attack.started -= instance.OnAttack;
@Attack.performed -= instance.OnAttack;
@Attack.canceled -= instance.OnAttack;
@Dash.started -= instance.OnDash;
@Dash.performed -= instance.OnDash;
@Dash.canceled -= instance.OnDash;
@ActivateMainSkill.started -= instance.OnActivateMainSkill;
@ActivateMainSkill.performed -= instance.OnActivateMainSkill;
@ActivateMainSkill.canceled -= instance.OnActivateMainSkill;
@ -985,67 +1011,67 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
}
public CameraActions @Camera => new CameraActions(this);
// Unit
private readonly InputActionMap m_Unit;
private List<IUnitActions> m_UnitActionsCallbackInterfaces = new List<IUnitActions>();
private readonly InputAction m_Unit_SelectUnit;
private readonly InputAction m_Unit_CancelSelectedUnit;
private readonly InputAction m_Unit_MoveUnit;
public struct UnitActions
// Combat
private readonly InputActionMap m_Combat;
private List<ICombatActions> m_CombatActionsCallbackInterfaces = new List<ICombatActions>();
private readonly InputAction m_Combat_Move;
private readonly InputAction m_Combat_Attack;
private readonly InputAction m_Combat_Dash;
public struct CombatActions
{
private @BlueWater m_Wrapper;
public UnitActions(@BlueWater wrapper) { m_Wrapper = wrapper; }
public InputAction @SelectUnit => m_Wrapper.m_Unit_SelectUnit;
public InputAction @CancelSelectedUnit => m_Wrapper.m_Unit_CancelSelectedUnit;
public InputAction @MoveUnit => m_Wrapper.m_Unit_MoveUnit;
public InputActionMap Get() { return m_Wrapper.m_Unit; }
public CombatActions(@BlueWater wrapper) { m_Wrapper = wrapper; }
public InputAction @Move => m_Wrapper.m_Combat_Move;
public InputAction @Attack => m_Wrapper.m_Combat_Attack;
public InputAction @Dash => m_Wrapper.m_Combat_Dash;
public InputActionMap Get() { return m_Wrapper.m_Combat; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(UnitActions set) { return set.Get(); }
public void AddCallbacks(IUnitActions instance)
public static implicit operator InputActionMap(CombatActions set) { return set.Get(); }
public void AddCallbacks(ICombatActions instance)
{
if (instance == null || m_Wrapper.m_UnitActionsCallbackInterfaces.Contains(instance)) return;
m_Wrapper.m_UnitActionsCallbackInterfaces.Add(instance);
@SelectUnit.started += instance.OnSelectUnit;
@SelectUnit.performed += instance.OnSelectUnit;
@SelectUnit.canceled += instance.OnSelectUnit;
@CancelSelectedUnit.started += instance.OnCancelSelectedUnit;
@CancelSelectedUnit.performed += instance.OnCancelSelectedUnit;
@CancelSelectedUnit.canceled += instance.OnCancelSelectedUnit;
@MoveUnit.started += instance.OnMoveUnit;
@MoveUnit.performed += instance.OnMoveUnit;
@MoveUnit.canceled += instance.OnMoveUnit;
if (instance == null || m_Wrapper.m_CombatActionsCallbackInterfaces.Contains(instance)) return;
m_Wrapper.m_CombatActionsCallbackInterfaces.Add(instance);
@Move.started += instance.OnMove;
@Move.performed += instance.OnMove;
@Move.canceled += instance.OnMove;
@Attack.started += instance.OnAttack;
@Attack.performed += instance.OnAttack;
@Attack.canceled += instance.OnAttack;
@Dash.started += instance.OnDash;
@Dash.performed += instance.OnDash;
@Dash.canceled += instance.OnDash;
}
private void UnregisterCallbacks(IUnitActions instance)
private void UnregisterCallbacks(ICombatActions instance)
{
@SelectUnit.started -= instance.OnSelectUnit;
@SelectUnit.performed -= instance.OnSelectUnit;
@SelectUnit.canceled -= instance.OnSelectUnit;
@CancelSelectedUnit.started -= instance.OnCancelSelectedUnit;
@CancelSelectedUnit.performed -= instance.OnCancelSelectedUnit;
@CancelSelectedUnit.canceled -= instance.OnCancelSelectedUnit;
@MoveUnit.started -= instance.OnMoveUnit;
@MoveUnit.performed -= instance.OnMoveUnit;
@MoveUnit.canceled -= instance.OnMoveUnit;
@Move.started -= instance.OnMove;
@Move.performed -= instance.OnMove;
@Move.canceled -= instance.OnMove;
@Attack.started -= instance.OnAttack;
@Attack.performed -= instance.OnAttack;
@Attack.canceled -= instance.OnAttack;
@Dash.started -= instance.OnDash;
@Dash.performed -= instance.OnDash;
@Dash.canceled -= instance.OnDash;
}
public void RemoveCallbacks(IUnitActions instance)
public void RemoveCallbacks(ICombatActions instance)
{
if (m_Wrapper.m_UnitActionsCallbackInterfaces.Remove(instance))
if (m_Wrapper.m_CombatActionsCallbackInterfaces.Remove(instance))
UnregisterCallbacks(instance);
}
public void SetCallbacks(IUnitActions instance)
public void SetCallbacks(ICombatActions instance)
{
foreach (var item in m_Wrapper.m_UnitActionsCallbackInterfaces)
foreach (var item in m_Wrapper.m_CombatActionsCallbackInterfaces)
UnregisterCallbacks(item);
m_Wrapper.m_UnitActionsCallbackInterfaces.Clear();
m_Wrapper.m_CombatActionsCallbackInterfaces.Clear();
AddCallbacks(instance);
}
}
public UnitActions @Unit => new UnitActions(this);
public CombatActions @Combat => new CombatActions(this);
private int m_KeyboardMouseSchemeIndex = -1;
public InputControlScheme KeyboardMouseScheme
{
@ -1078,7 +1104,6 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
void OnSpawnInIsladnPlayer(InputAction.CallbackContext context);
void OnCancelHold(InputAction.CallbackContext context);
void OnAttack(InputAction.CallbackContext context);
void OnDash(InputAction.CallbackContext context);
void OnActivateMainSkill(InputAction.CallbackContext context);
void OnToggleLaunchMode(InputAction.CallbackContext context);
void OnLaunchCannon(InputAction.CallbackContext context);
@ -1092,10 +1117,10 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
void OnZoom(InputAction.CallbackContext context);
void OnRotate(InputAction.CallbackContext context);
}
public interface IUnitActions
public interface ICombatActions
{
void OnSelectUnit(InputAction.CallbackContext context);
void OnCancelSelectedUnit(InputAction.CallbackContext context);
void OnMoveUnit(InputAction.CallbackContext context);
void OnMove(InputAction.CallbackContext context);
void OnAttack(InputAction.CallbackContext context);
void OnDash(InputAction.CallbackContext context);
}
}

View File

@ -113,15 +113,6 @@
"interactions": "",
"initialStateCheck": false
},
{
"name": "Dash",
"type": "Button",
"id": "c68960a5-036f-4304-8d05-25778470ecfd",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "ActivateMainSkill",
"type": "Button",
@ -374,17 +365,6 @@
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "5a134753-6868-4dec-9b0e-5839b48f7417",
"path": "<Keyboard>/space",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Dash",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "f1364876-ede7-4831-b23e-532d6995031e",
@ -524,31 +504,31 @@
]
},
{
"name": "Unit",
"id": "72deb161-83b9-4d14-8bcf-0bd0c122f76f",
"name": "Combat",
"id": "fcad259b-ca44-46e3-b008-1297fa7be828",
"actions": [
{
"name": "SelectUnit",
"name": "Move",
"type": "Value",
"id": "4714fdf1-f399-40c7-b623-660c9bfff052",
"expectedControlType": "Vector2",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "Attack",
"type": "Button",
"id": "2c1978d2-b4be-453a-9413-7b54903dbf38",
"id": "5ff50411-308e-490e-acb2-e1001785169d",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "CancelSelectedUnit",
"name": "Dash",
"type": "Button",
"id": "952be7b5-8952-47b7-a2db-ced6517d161a",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "MoveUnit",
"type": "Button",
"id": "2fe8434e-42e2-4b88-b0b3-0b2b4f8596a8",
"id": "07c70113-456d-4ae6-a273-92bfa09153c2",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
@ -556,36 +536,91 @@
}
],
"bindings": [
{
"name": "WASD",
"id": "362fb18c-8b50-4fcd-9bc9-9fcab5fd2ce5",
"path": "2DVector",
"interactions": "",
"processors": "",
"groups": "",
"action": "Move",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "up",
"id": "36746c9d-eca6-4ff8-bcec-2d658d907744",
"path": "<Keyboard>/w",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "8420a87e-ccc1-4940-addd-1516ac2896af",
"path": "<Keyboard>/s",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "6ac0b570-a29a-40f9-b039-c4085ef669a8",
"path": "<Keyboard>/a",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "right",
"id": "975926ee-895b-4858-b17d-c8ccc3142fb4",
"path": "<Keyboard>/d",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "2daa9903-ce4b-4c8d-9347-5f59b09e8674",
"id": "17f1b73a-900f-477d-b3aa-2cfc0335591f",
"path": "<Mouse>/leftButton",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "SelectUnit",
"action": "Attack",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "76632044-5edc-4dba-97aa-64d5173c78ec",
"path": "<Mouse>/rightButton",
"id": "acdb5d7e-efe0-4c9a-9c7c-c6810fc37c72",
"path": "<Keyboard>/k",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "MoveUnit",
"action": "Attack",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "e768abd0-e04f-4441-b6b3-09f456041cd8",
"path": "<Keyboard>/escape",
"id": "4a22ea68-00e5-46bf-b622-b6ceb0351141",
"path": "<Keyboard>/space",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "CancelSelectedUnit",
"action": "Dash",
"isComposite": false,
"isPartOfComposite": false
}

View File

@ -0,0 +1,21 @@
using Sirenix.OdinInspector;
using UnityEngine;
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
public class CombatAttacker : MonoBehaviour
{
[HideInInspector] public CombatAnimator combatAnimator;
private bool useMouseAttack;
public void HandleAttack()
{
// if (!enableDash || isDashing) return;
//
// StartCoroutine(nameof(DashCoroutine));
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: db1e3c9d88cdfcc47aa88870aa44851f

View File

@ -15,39 +15,50 @@ namespace BlueWaterProject
public delegate void DashInput();
public event DashInput OnDashInputReceived;
public delegate void AttackInput(InputAction.CallbackContext context);
public delegate void AttackInput(bool usedMouse);
public event AttackInput OnAttackInputReceived;
private void OnEnable()
{
playerInput.actions.FindAction("Attack").performed += OnAttackEvent;
}
private void OnDisable()
{
playerInput.actions.FindAction("Attack").performed -= OnAttackEvent;
}
[Button("셋팅 초기화")]
private void InitSetting()
{
playerInput = GetComponent<PlayerInput>();
}
private void OnMove(InputValue value)
public void OnMove(InputAction.CallbackContext context)
{
var movementInput = value.Get<Vector2>();
var movementInput = context.ReadValue<Vector2>();
OnMoveInputReceived?.Invoke(movementInput);
}
private void OnDash()
public void OnDash(InputAction.CallbackContext context)
{
OnDashInputReceived?.Invoke();
if (context.started)
{
OnDashInputReceived?.Invoke();
}
}
private void OnAttackEvent(InputAction.CallbackContext context)
public void OnAttack(InputAction.CallbackContext context)
{
OnAttackInputReceived?.Invoke(context);
if (context.started)
{
var device = context.control.device;
bool usedMouse;
switch (device)
{
case Keyboard:
usedMouse = false;
break;
case Mouse:
usedMouse = true;
break;
default:
return;
}
OnAttackInputReceived?.Invoke(usedMouse);
}
}
private void OnItemInventory()

View File

@ -24,14 +24,6 @@ namespace BlueWaterProject
[Range(0f, 5f), Tooltip("대쉬 쿨타임")]
[SerializeField] private float dashCooldown = 0.5f;
// Ground
[Range(0.1f, 10.0f), Tooltip("지면 감지 거리")]
[SerializeField] private float groundCheckDistance = 2.0f;
[SerializeField] private LayerMask groundLayer;
private Animator Animator => combatAnimator.animator;
private Vector3 currentMoveDirection;
private Vector3 previousMoveDirection = Vector3.back;
private float finalSpeed;
@ -48,12 +40,9 @@ namespace BlueWaterProject
private void FixedUpdate()
{
//CheckGround();
if (isDashing) return;
var finalVelocity = rb.position + currentMoveDirection * (moveSpeed * Time.fixedDeltaTime);
rb.MovePosition(finalVelocity);
HandleMove();
}
[Button("셋팅 초기화")]
@ -72,51 +61,6 @@ namespace BlueWaterProject
}
isMoving = currentMoveDirection != Vector3.zero;
}
public void HandleDash()
{
if (!enableDash || isDashing) return;
StartCoroutine(nameof(DashCoroutine));
}
private IEnumerator DashCoroutine()
{
var dashDirection = previousMoveDirection;
isDashing = true;
enableDash = false;
combatAnimator.SetIsDash(true);
var elapsedTime = 0f;
while (!Animator.GetCurrentAnimatorStateInfo(0).IsName("DashState"))
{
elapsedTime += Time.deltaTime;
if (elapsedTime >= 1f)
{
yield break;
}
yield return null;
}
var animationLength = Animator.GetCurrentAnimatorStateInfo(0).length;
Animator.speed = animationLength / dashTime;
while (Animator.GetCurrentAnimatorStateInfo(0).IsName("DashState") &&
Animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 1f)
{
var finalVelocity = rb.position + dashDirection * (dashSpeed * Time.fixedDeltaTime);
rb.MovePosition(finalVelocity);
yield return new WaitForFixedUpdate();
}
Animator.speed = 1f;
isDashing = false;
combatAnimator.SetIsDash(false);
StartCoroutine(Utils.CoolDown(dashCooldown, () => enableDash = true));
}
private void MoveAnimation()
{
@ -139,6 +83,61 @@ namespace BlueWaterProject
};
visualLook.localScale = localScale;
}
private void HandleMove()
{
var finalVelocity = currentMoveDirection * moveSpeed;
rb.velocity = finalVelocity;
}
// Dash
public void HandleDash()
{
if (!enableDash || isDashing) return;
StartCoroutine(nameof(DashCoroutine));
}
private IEnumerator DashCoroutine()
{
var dashDirection = previousMoveDirection;
isDashing = true;
enableDash = false;
combatAnimator.SetIsDash(true);
var elapsedTime = 0f;
while (!combatAnimator.animator.GetCurrentAnimatorStateInfo(0).IsName("DashState"))
{
elapsedTime += Time.deltaTime;
if (elapsedTime >= 1f)
{
yield break;
}
yield return null;
}
var animationLength = combatAnimator.animator.GetCurrentAnimatorStateInfo(0).length;
combatAnimator.animator.speed = animationLength / dashTime;
while (combatAnimator.animator.GetCurrentAnimatorStateInfo(0).IsName("DashState") &&
combatAnimator.animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 1f)
{
//var finalVelocity = rb.position + dashDirection * (dashSpeed * Time.fixedDeltaTime);
//rb.MovePosition(finalVelocity);
var finalVelocity = dashDirection * dashSpeed;
rb.velocity = finalVelocity;
yield return new WaitForFixedUpdate();
}
combatAnimator.animator.speed = 1f;
isDashing = false;
combatAnimator.SetIsDash(false);
StartCoroutine(Utils.CoolDown(dashCooldown, () => enableDash = true));
}
}
}

View File

@ -15,18 +15,12 @@ namespace BlueWaterProject
movement.combatAnimator = animator;
}
private void OnEnable()
private void Start()
{
input.OnMoveInputReceived += movement.InputMovementValue;
input.OnDashInputReceived += movement.HandleDash;
}
private void OnDisable()
{
input.OnMoveInputReceived -= movement.InputMovementValue;
input.OnDashInputReceived -= movement.HandleDash;
}
[Button("셋팅 초기화")]
private void InitSetting()
{

View File

@ -0,0 +1,71 @@
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
using UnityEngine.InputSystem;
// ReSharper disable once CheckNamespace
namespace BlueWaterProject
{
public class InputKeyManager : Singleton<InputKeyManager>
{
[SerializeField] private InputActionAsset actionAsset;
public Dictionary<string, List<string>> CombatKeyBindings { get; set; } = new();
private void Start()
{
LoadBindings();
}
private void LoadBindings()
{
foreach (var actionMap in actionAsset.actionMaps)
{
switch (actionMap.name)
{
case "Combat":
CombatKeyBindings = LoadActionMapBindings(actionMap);
break;
// 추가 액션 맵에 대해서도 비슷한 패턴으로 처리 가능
}
}
}
private Dictionary<string, List<string>> LoadActionMapBindings(InputActionMap actionMap)
{
var bindings = new Dictionary<string, List<string>>();
foreach (var action in actionMap.actions)
{
var bindingList = new List<string>();
foreach (var binding in action.bindings)
{
var path = !string.IsNullOrEmpty(binding.overridePath) ? binding.overridePath : binding.path;
bindingList.Add(path);
}
if (bindingList.Count > 0)
{
bindings[action.name] = bindingList;
}
}
return bindings;
}
[Button("Dictionary 출력")]
private void PrintBindings()
{
PrintActionMapBindings("Combat", CombatKeyBindings);
}
private void PrintActionMapBindings(string actionMapName, Dictionary<string, List<string>> bindings)
{
Debug.Log($"Action Map: {actionMapName}");
foreach (var entry in bindings)
{
Debug.Log($"Action: {entry.Key}, Bindings: {string.Join(", ", entry.Value)}");
}
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 56df21ea9c4a2754891388a52bc934ec

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

View File

@ -0,0 +1,140 @@
fileFormatVersion: 2
guid: a2c0eba9ac9e3b348a20360173d139e1
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,143 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: land_combat
m_Shader: {fileID: 4800000, guid: 8d2bb70cbf9db8d4da26e15b26e74248, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHATEST_ON
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2450
stringTagMap:
RenderType: TransparentCutout
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: a2c0eba9ac9e3b348a20360173d139e1, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: a2c0eba9ac9e3b348a20360173d139e1, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 1
- _AlphaToMask: 1
- _Blend: 0
- _BlendModePreserveSpecular: 0
- _BlendOp: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossinessSource: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _SampleGI: 0
- _Shininess: 0
- _Smoothness: 0.5
- _SmoothnessSource: 0
- _SmoothnessTextureChannel: 0
- _SpecSource: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &1271948002411579340
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bbf7dcc03516d1645a9ba2cef5d056c4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant: