스킬 시스템 구현
- 애니메이션 이벤트 기반 스킬 시스템 추가 - SkillData: 스킬 데이터 (클립, 쿨타임, 효과 목록) - SkillController: 스킬 실행 및 애니메이션 제어 - AnimatorOverrideController로 단일 State에서 다양한 스킬 재생 - 스킬 효과 시스템 - DamageEffect, HealEffect, BuffEffect - KnockbackEffect, SoundEffect, SpawnEffect - 범위 공격 및 팀 구분 지원 - Team 컴포넌트로 아군/적 구분 - 스킬 중 이동 제한 - IsPlayingAnimation으로 애니메이션 종료까지 이동 불가 - OnSkillEnd 호출 시 다음 스킬 시전 가능 - 입력 시스템에 스킬 슬롯 6개 추가 - 애니메이션 에셋 추가 및 정리 - AnimationSwordCombat 패키지 추가 (검 공격 애니메이션) - PlayerAnimationController에 Skill 상태 추가 - External_Used 폴더 구조 정리 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
8
Assets/Scripts/Editor/Skills.meta
Normal file
8
Assets/Scripts/Editor/Skills.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba44fce3757f70c42acd5b75c3ced354
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -2,7 +2,7 @@
|
||||
// <auto-generated>
|
||||
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
||||
// version 1.18.0
|
||||
// from Assets/InputSystem_Actions.inputactions
|
||||
// from Assets/Scripts/InputSystem_Actions.inputactions
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -16,7 +16,7 @@ using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Utilities;
|
||||
|
||||
/// <summary>
|
||||
/// Provides programmatic access to <see cref="InputActionAsset" />, <see cref="InputActionMap" />, <see cref="InputAction" /> and <see cref="InputControlScheme" /> instances defined in asset "Assets/InputSystem_Actions.inputactions".
|
||||
/// Provides programmatic access to <see cref="InputActionAsset" />, <see cref="InputActionMap" />, <see cref="InputAction" /> and <see cref="InputControlScheme" /> instances defined in asset "Assets/Scripts/InputSystem_Actions.inputactions".
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This class is source generated and any manual edits will be discarded if the associated asset is reimported or modified.
|
||||
@@ -110,29 +110,11 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
""name"": ""Attack"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""6c2ab1b8-8984-453a-af3d-a3c78ae1679a"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Interact"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""852140f2-7766-474d-8707-702459ba45f3"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": ""Hold"",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Crouch"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""27c5f898-bc57-4ee1-8800-db469aca5fe3"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
@@ -168,7 +150,61 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
""name"": ""Sprint"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""641cd816-40e6-41b4-8c3d-04687c349290"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Skill 1"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""9452c224-4f16-4c08-81ab-1fd93758655d"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Skill 2"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""c69f22e6-feba-4a7f-b549-363ab436f2e6"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Skill 3"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""b64f129f-8e8c-4912-930e-1e03ccd1c0d3"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Skill 4"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""008e1aea-1560-4e1d-94af-5c00ba3c63f1"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Skill 5"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""6d4ebdf2-855a-42e6-bb28-f59260f3609c"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Skill 6"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""85a08d84-cbdd-41d0-a5da-848c907fe73e"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
@@ -340,72 +376,6 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""143bb1cd-cc10-4eca-a2f0-a3664166fe91"",
|
||||
""path"": ""<Gamepad>/buttonWest"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": "";Gamepad"",
|
||||
""action"": ""Attack"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""05f6913d-c316-48b2-a6bb-e225f14c7960"",
|
||||
""path"": ""<Mouse>/leftButton"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": "";Keyboard&Mouse"",
|
||||
""action"": ""Attack"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""886e731e-7071-4ae4-95c0-e61739dad6fd"",
|
||||
""path"": ""<Touchscreen>/primaryTouch/tap"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": "";Touch"",
|
||||
""action"": ""Attack"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""ee3d0cd2-254e-47a7-a8cb-bc94d9658c54"",
|
||||
""path"": ""<Joystick>/trigger"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Joystick"",
|
||||
""action"": ""Attack"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""8255d333-5683-4943-a58a-ccb207ff1dce"",
|
||||
""path"": ""<XRController>/{PrimaryAction}"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""XR"",
|
||||
""action"": ""Attack"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""b3c1c7f0-bd20-4ee7-a0f1-899b24bca6d7"",
|
||||
""path"": ""<Keyboard>/enter"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard&Mouse"",
|
||||
""action"": ""Attack"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""cbac6039-9c09-46a1-b5f2-4e5124ccb5ed"",
|
||||
@@ -516,28 +486,6 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""1c04ea5f-b012-41d1-a6f7-02e963b52893"",
|
||||
""path"": ""<Keyboard>/e"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard&Mouse"",
|
||||
""action"": ""Interact"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""b3f66d0b-7751-423f-908b-a11c5bd95930"",
|
||||
""path"": ""<Gamepad>/buttonNorth"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Gamepad"",
|
||||
""action"": ""Interact"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""4f4649ac-64a8-4a73-af11-b3faef356a4d"",
|
||||
@@ -559,6 +507,72 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
""action"": ""Crouch"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""c32f06b7-f876-4a00-abde-1dcf2240dce0"",
|
||||
""path"": ""<Mouse>/leftButton"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Skill 1"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""1dd61bb8-f4aa-476d-9dae-740b2dd98c4e"",
|
||||
""path"": ""<Mouse>/rightButton"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Skill 2"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""3ca887ff-6fa6-4c91-b5fa-893c6010b76c"",
|
||||
""path"": ""<Keyboard>/1"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Skill 3"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""ab74c35a-1cdf-43a0-af20-9c63ee3eb6f4"",
|
||||
""path"": ""<Keyboard>/2"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Skill 4"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""0b969e4e-c753-4ee9-ae95-07ee9bc599b0"",
|
||||
""path"": ""<Keyboard>/3"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Skill 5"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""c46de897-5a2b-4f5f-bae7-ba326eb465e8"",
|
||||
""path"": ""<Keyboard>/4"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Skill 6"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1146,13 +1160,17 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
|
||||
m_Player_Move = m_Player.FindAction("Move", throwIfNotFound: true);
|
||||
m_Player_Look = m_Player.FindAction("Look", throwIfNotFound: true);
|
||||
m_Player_Attack = m_Player.FindAction("Attack", throwIfNotFound: true);
|
||||
m_Player_Interact = m_Player.FindAction("Interact", throwIfNotFound: true);
|
||||
m_Player_Crouch = m_Player.FindAction("Crouch", throwIfNotFound: true);
|
||||
m_Player_Jump = m_Player.FindAction("Jump", throwIfNotFound: true);
|
||||
m_Player_Previous = m_Player.FindAction("Previous", throwIfNotFound: true);
|
||||
m_Player_Next = m_Player.FindAction("Next", throwIfNotFound: true);
|
||||
m_Player_Sprint = m_Player.FindAction("Sprint", throwIfNotFound: true);
|
||||
m_Player_Skill1 = m_Player.FindAction("Skill 1", throwIfNotFound: true);
|
||||
m_Player_Skill2 = m_Player.FindAction("Skill 2", throwIfNotFound: true);
|
||||
m_Player_Skill3 = m_Player.FindAction("Skill 3", throwIfNotFound: true);
|
||||
m_Player_Skill4 = m_Player.FindAction("Skill 4", throwIfNotFound: true);
|
||||
m_Player_Skill5 = m_Player.FindAction("Skill 5", throwIfNotFound: true);
|
||||
m_Player_Skill6 = m_Player.FindAction("Skill 6", throwIfNotFound: true);
|
||||
// UI
|
||||
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
|
||||
m_UI_Navigate = m_UI.FindAction("Navigate", throwIfNotFound: true);
|
||||
@@ -1248,13 +1266,17 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
private List<IPlayerActions> m_PlayerActionsCallbackInterfaces = new List<IPlayerActions>();
|
||||
private readonly InputAction m_Player_Move;
|
||||
private readonly InputAction m_Player_Look;
|
||||
private readonly InputAction m_Player_Attack;
|
||||
private readonly InputAction m_Player_Interact;
|
||||
private readonly InputAction m_Player_Crouch;
|
||||
private readonly InputAction m_Player_Jump;
|
||||
private readonly InputAction m_Player_Previous;
|
||||
private readonly InputAction m_Player_Next;
|
||||
private readonly InputAction m_Player_Sprint;
|
||||
private readonly InputAction m_Player_Skill1;
|
||||
private readonly InputAction m_Player_Skill2;
|
||||
private readonly InputAction m_Player_Skill3;
|
||||
private readonly InputAction m_Player_Skill4;
|
||||
private readonly InputAction m_Player_Skill5;
|
||||
private readonly InputAction m_Player_Skill6;
|
||||
/// <summary>
|
||||
/// Provides access to input actions defined in input action map "Player".
|
||||
/// </summary>
|
||||
@@ -1275,14 +1297,6 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
/// </summary>
|
||||
public InputAction @Look => m_Wrapper.m_Player_Look;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Player/Attack".
|
||||
/// </summary>
|
||||
public InputAction @Attack => m_Wrapper.m_Player_Attack;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Player/Interact".
|
||||
/// </summary>
|
||||
public InputAction @Interact => m_Wrapper.m_Player_Interact;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Player/Crouch".
|
||||
/// </summary>
|
||||
public InputAction @Crouch => m_Wrapper.m_Player_Crouch;
|
||||
@@ -1303,6 +1317,30 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
/// </summary>
|
||||
public InputAction @Sprint => m_Wrapper.m_Player_Sprint;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Player/Skill1".
|
||||
/// </summary>
|
||||
public InputAction @Skill1 => m_Wrapper.m_Player_Skill1;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Player/Skill2".
|
||||
/// </summary>
|
||||
public InputAction @Skill2 => m_Wrapper.m_Player_Skill2;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Player/Skill3".
|
||||
/// </summary>
|
||||
public InputAction @Skill3 => m_Wrapper.m_Player_Skill3;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Player/Skill4".
|
||||
/// </summary>
|
||||
public InputAction @Skill4 => m_Wrapper.m_Player_Skill4;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Player/Skill5".
|
||||
/// </summary>
|
||||
public InputAction @Skill5 => m_Wrapper.m_Player_Skill5;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Player/Skill6".
|
||||
/// </summary>
|
||||
public InputAction @Skill6 => m_Wrapper.m_Player_Skill6;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action map instance.
|
||||
/// </summary>
|
||||
public InputActionMap Get() { return m_Wrapper.m_Player; }
|
||||
@@ -1334,12 +1372,6 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
@Look.started += instance.OnLook;
|
||||
@Look.performed += instance.OnLook;
|
||||
@Look.canceled += instance.OnLook;
|
||||
@Attack.started += instance.OnAttack;
|
||||
@Attack.performed += instance.OnAttack;
|
||||
@Attack.canceled += instance.OnAttack;
|
||||
@Interact.started += instance.OnInteract;
|
||||
@Interact.performed += instance.OnInteract;
|
||||
@Interact.canceled += instance.OnInteract;
|
||||
@Crouch.started += instance.OnCrouch;
|
||||
@Crouch.performed += instance.OnCrouch;
|
||||
@Crouch.canceled += instance.OnCrouch;
|
||||
@@ -1355,6 +1387,24 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
@Sprint.started += instance.OnSprint;
|
||||
@Sprint.performed += instance.OnSprint;
|
||||
@Sprint.canceled += instance.OnSprint;
|
||||
@Skill1.started += instance.OnSkill1;
|
||||
@Skill1.performed += instance.OnSkill1;
|
||||
@Skill1.canceled += instance.OnSkill1;
|
||||
@Skill2.started += instance.OnSkill2;
|
||||
@Skill2.performed += instance.OnSkill2;
|
||||
@Skill2.canceled += instance.OnSkill2;
|
||||
@Skill3.started += instance.OnSkill3;
|
||||
@Skill3.performed += instance.OnSkill3;
|
||||
@Skill3.canceled += instance.OnSkill3;
|
||||
@Skill4.started += instance.OnSkill4;
|
||||
@Skill4.performed += instance.OnSkill4;
|
||||
@Skill4.canceled += instance.OnSkill4;
|
||||
@Skill5.started += instance.OnSkill5;
|
||||
@Skill5.performed += instance.OnSkill5;
|
||||
@Skill5.canceled += instance.OnSkill5;
|
||||
@Skill6.started += instance.OnSkill6;
|
||||
@Skill6.performed += instance.OnSkill6;
|
||||
@Skill6.canceled += instance.OnSkill6;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1372,12 +1422,6 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
@Look.started -= instance.OnLook;
|
||||
@Look.performed -= instance.OnLook;
|
||||
@Look.canceled -= instance.OnLook;
|
||||
@Attack.started -= instance.OnAttack;
|
||||
@Attack.performed -= instance.OnAttack;
|
||||
@Attack.canceled -= instance.OnAttack;
|
||||
@Interact.started -= instance.OnInteract;
|
||||
@Interact.performed -= instance.OnInteract;
|
||||
@Interact.canceled -= instance.OnInteract;
|
||||
@Crouch.started -= instance.OnCrouch;
|
||||
@Crouch.performed -= instance.OnCrouch;
|
||||
@Crouch.canceled -= instance.OnCrouch;
|
||||
@@ -1393,6 +1437,24 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
@Sprint.started -= instance.OnSprint;
|
||||
@Sprint.performed -= instance.OnSprint;
|
||||
@Sprint.canceled -= instance.OnSprint;
|
||||
@Skill1.started -= instance.OnSkill1;
|
||||
@Skill1.performed -= instance.OnSkill1;
|
||||
@Skill1.canceled -= instance.OnSkill1;
|
||||
@Skill2.started -= instance.OnSkill2;
|
||||
@Skill2.performed -= instance.OnSkill2;
|
||||
@Skill2.canceled -= instance.OnSkill2;
|
||||
@Skill3.started -= instance.OnSkill3;
|
||||
@Skill3.performed -= instance.OnSkill3;
|
||||
@Skill3.canceled -= instance.OnSkill3;
|
||||
@Skill4.started -= instance.OnSkill4;
|
||||
@Skill4.performed -= instance.OnSkill4;
|
||||
@Skill4.canceled -= instance.OnSkill4;
|
||||
@Skill5.started -= instance.OnSkill5;
|
||||
@Skill5.performed -= instance.OnSkill5;
|
||||
@Skill5.canceled -= instance.OnSkill5;
|
||||
@Skill6.started -= instance.OnSkill6;
|
||||
@Skill6.performed -= instance.OnSkill6;
|
||||
@Skill6.canceled -= instance.OnSkill6;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1708,20 +1770,6 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnLook(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Attack" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnAttack(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Interact" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnInteract(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Crouch" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
@@ -1756,6 +1804,48 @@ public partial class @InputSystem_Actions: IInputActionCollection2, IDisposable
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnSprint(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Skill 1" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnSkill1(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Skill 2" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnSkill2(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Skill 3" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnSkill3(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Skill 4" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnSkill4(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Skill 5" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnSkill5(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Skill 6" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnSkill6(InputAction.CallbackContext context);
|
||||
}
|
||||
/// <summary>
|
||||
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "UI" which allows adding and removing callbacks.
|
||||
|
||||
@@ -24,29 +24,11 @@
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Attack",
|
||||
"type": "Button",
|
||||
"id": "6c2ab1b8-8984-453a-af3d-a3c78ae1679a",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Interact",
|
||||
"type": "Button",
|
||||
"id": "852140f2-7766-474d-8707-702459ba45f3",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": "Hold",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Crouch",
|
||||
"type": "Button",
|
||||
"id": "27c5f898-bc57-4ee1-8800-db469aca5fe3",
|
||||
"expectedControlType": "Button",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
@@ -82,7 +64,61 @@
|
||||
"name": "Sprint",
|
||||
"type": "Button",
|
||||
"id": "641cd816-40e6-41b4-8c3d-04687c349290",
|
||||
"expectedControlType": "Button",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Skill 1",
|
||||
"type": "Button",
|
||||
"id": "9452c224-4f16-4c08-81ab-1fd93758655d",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Skill 2",
|
||||
"type": "Button",
|
||||
"id": "c69f22e6-feba-4a7f-b549-363ab436f2e6",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Skill 3",
|
||||
"type": "Button",
|
||||
"id": "b64f129f-8e8c-4912-930e-1e03ccd1c0d3",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Skill 4",
|
||||
"type": "Button",
|
||||
"id": "008e1aea-1560-4e1d-94af-5c00ba3c63f1",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Skill 5",
|
||||
"type": "Button",
|
||||
"id": "6d4ebdf2-855a-42e6-bb28-f59260f3609c",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Skill 6",
|
||||
"type": "Button",
|
||||
"id": "85a08d84-cbdd-41d0-a5da-848c907fe73e",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
@@ -254,72 +290,6 @@
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "143bb1cd-cc10-4eca-a2f0-a3664166fe91",
|
||||
"path": "<Gamepad>/buttonWest",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Gamepad",
|
||||
"action": "Attack",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "05f6913d-c316-48b2-a6bb-e225f14c7960",
|
||||
"path": "<Mouse>/leftButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Keyboard&Mouse",
|
||||
"action": "Attack",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "886e731e-7071-4ae4-95c0-e61739dad6fd",
|
||||
"path": "<Touchscreen>/primaryTouch/tap",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Touch",
|
||||
"action": "Attack",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "ee3d0cd2-254e-47a7-a8cb-bc94d9658c54",
|
||||
"path": "<Joystick>/trigger",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Joystick",
|
||||
"action": "Attack",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "8255d333-5683-4943-a58a-ccb207ff1dce",
|
||||
"path": "<XRController>/{PrimaryAction}",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "XR",
|
||||
"action": "Attack",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "b3c1c7f0-bd20-4ee7-a0f1-899b24bca6d7",
|
||||
"path": "<Keyboard>/enter",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard&Mouse",
|
||||
"action": "Attack",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "cbac6039-9c09-46a1-b5f2-4e5124ccb5ed",
|
||||
@@ -430,28 +400,6 @@
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "1c04ea5f-b012-41d1-a6f7-02e963b52893",
|
||||
"path": "<Keyboard>/e",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard&Mouse",
|
||||
"action": "Interact",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "b3f66d0b-7751-423f-908b-a11c5bd95930",
|
||||
"path": "<Gamepad>/buttonNorth",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Gamepad",
|
||||
"action": "Interact",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "4f4649ac-64a8-4a73-af11-b3faef356a4d",
|
||||
@@ -473,6 +421,72 @@
|
||||
"action": "Crouch",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "c32f06b7-f876-4a00-abde-1dcf2240dce0",
|
||||
"path": "<Mouse>/leftButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Skill 1",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "1dd61bb8-f4aa-476d-9dae-740b2dd98c4e",
|
||||
"path": "<Mouse>/rightButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Skill 2",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "3ca887ff-6fa6-4c91-b5fa-893c6010b76c",
|
||||
"path": "<Keyboard>/1",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Skill 3",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "ab74c35a-1cdf-43a0-af20-9c63ee3eb6f4",
|
||||
"path": "<Keyboard>/2",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Skill 4",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "0b969e4e-c753-4ee9-ae95-07ee9bc599b0",
|
||||
"path": "<Keyboard>/3",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Skill 5",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "c46de897-5a2b-4f5f-bae7-ba326eb465e8",
|
||||
"path": "<Keyboard>/4",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Skill 6",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@ using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using Unity.Netcode;
|
||||
using Colosseum.Network;
|
||||
using Colosseum.Skills;
|
||||
|
||||
namespace Colosseum.Player
|
||||
{
|
||||
@@ -19,6 +20,9 @@ namespace Colosseum.Player
|
||||
[Header("Jump Settings")]
|
||||
[SerializeField] private float jumpForce = 5f;
|
||||
|
||||
[Header("References")]
|
||||
[SerializeField] private SkillController skillController;
|
||||
|
||||
private CharacterController characterController;
|
||||
private Vector3 velocity;
|
||||
private Vector2 moveInput;
|
||||
@@ -54,6 +58,12 @@ namespace Colosseum.Player
|
||||
|
||||
characterController = GetComponent<CharacterController>();
|
||||
|
||||
// SkillController 참조
|
||||
if (skillController == null)
|
||||
{
|
||||
skillController = GetComponent<SkillController>();
|
||||
}
|
||||
|
||||
// 스폰 포인트에서 위치 설정
|
||||
SetSpawnPosition();
|
||||
|
||||
@@ -164,6 +174,14 @@ namespace Colosseum.Player
|
||||
{
|
||||
if (characterController == null) return;
|
||||
|
||||
// 스킬 애니메이션 재생 중에는 이동 불가
|
||||
if (skillController != null && skillController.IsPlayingAnimation)
|
||||
{
|
||||
// 중력만 적용
|
||||
characterController.Move(velocity * Time.deltaTime);
|
||||
return;
|
||||
}
|
||||
|
||||
// 이동 방향 계산 (카메라 기준)
|
||||
Vector3 moveDirection = new Vector3(moveInput.x, 0f, moveInput.y);
|
||||
moveDirection = TransformDirectionByCamera(moveDirection);
|
||||
|
||||
143
Assets/Scripts/Player/PlayerSkillInput.cs
Normal file
143
Assets/Scripts/Player/PlayerSkillInput.cs
Normal file
@@ -0,0 +1,143 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using Unity.Netcode;
|
||||
using Colosseum.Skills;
|
||||
|
||||
namespace Colosseum.Player
|
||||
{
|
||||
/// <summary>
|
||||
/// 플레이어 스킬 입력 처리.
|
||||
/// 논타겟 방식: 입력 시 즉시 스킬 시전
|
||||
/// </summary>
|
||||
public class PlayerSkillInput : NetworkBehaviour
|
||||
{
|
||||
[Header("Skill Slots")]
|
||||
[Tooltip("각 슬롯에 등록할 스킬 데이터 (6개)")]
|
||||
[SerializeField] private SkillData[] skillSlots = new SkillData[6];
|
||||
|
||||
[Header("References")]
|
||||
[Tooltip("SkillController (없으면 자동 검색)")]
|
||||
[SerializeField] private SkillController skillController;
|
||||
|
||||
private InputSystem_Actions inputActions;
|
||||
|
||||
public SkillData[] SkillSlots => skillSlots;
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
if (!IsOwner)
|
||||
{
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// SkillController 참조 확인
|
||||
if (skillController == null)
|
||||
{
|
||||
skillController = GetComponent<SkillController>();
|
||||
if (skillController == null)
|
||||
{
|
||||
Debug.LogError("PlayerSkillInput: SkillController not found!");
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
InitializeInputActions();
|
||||
}
|
||||
|
||||
private void InitializeInputActions()
|
||||
{
|
||||
inputActions = new InputSystem_Actions();
|
||||
inputActions.Player.Enable();
|
||||
|
||||
// 스킬 액션 콜백 등록
|
||||
inputActions.Player.Skill1.performed += _ => OnSkillInput(0);
|
||||
inputActions.Player.Skill2.performed += _ => OnSkillInput(1);
|
||||
inputActions.Player.Skill3.performed += _ => OnSkillInput(2);
|
||||
inputActions.Player.Skill4.performed += _ => OnSkillInput(3);
|
||||
inputActions.Player.Skill5.performed += _ => OnSkillInput(4);
|
||||
inputActions.Player.Skill6.performed += _ => OnSkillInput(5);
|
||||
}
|
||||
|
||||
public override void OnNetworkDespawn()
|
||||
{
|
||||
if (inputActions != null)
|
||||
{
|
||||
inputActions.Player.Skill1.performed -= _ => OnSkillInput(0);
|
||||
inputActions.Player.Skill2.performed -= _ => OnSkillInput(1);
|
||||
inputActions.Player.Skill3.performed -= _ => OnSkillInput(2);
|
||||
inputActions.Player.Skill4.performed -= _ => OnSkillInput(3);
|
||||
inputActions.Player.Skill5.performed -= _ => OnSkillInput(4);
|
||||
inputActions.Player.Skill6.performed -= _ => OnSkillInput(5);
|
||||
inputActions.Disable();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 스킬 입력 처리
|
||||
/// </summary>
|
||||
private void OnSkillInput(int slotIndex)
|
||||
{
|
||||
if (slotIndex < 0 || slotIndex >= skillSlots.Length)
|
||||
return;
|
||||
|
||||
SkillData skill = skillSlots[slotIndex];
|
||||
if (skill == null)
|
||||
{
|
||||
Debug.Log($"Skill slot {slotIndex + 1} is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
// 논타겟: 타겟 없이 스킬 시전
|
||||
bool success = skillController.ExecuteSkill(skill);
|
||||
if (!success)
|
||||
{
|
||||
Debug.Log($"Cannot execute skill: {skill.SkillName}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 스킬 슬롯 접근자
|
||||
/// </summary>
|
||||
public SkillData GetSkill(int slotIndex)
|
||||
{
|
||||
if (slotIndex < 0 || slotIndex >= skillSlots.Length)
|
||||
return null;
|
||||
return skillSlots[slotIndex];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 스킬 슬롯 변경
|
||||
/// </summary>
|
||||
public void SetSkill(int slotIndex, SkillData skill)
|
||||
{
|
||||
if (slotIndex < 0 || slotIndex >= skillSlots.Length)
|
||||
return;
|
||||
|
||||
skillSlots[slotIndex] = skill;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 남은 쿨타임 조회
|
||||
/// </summary>
|
||||
public float GetRemainingCooldown(int slotIndex)
|
||||
{
|
||||
SkillData skill = GetSkill(slotIndex);
|
||||
if (skill == null) return 0f;
|
||||
|
||||
return skillController.GetRemainingCooldown(skill);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 스킬 사용 가능 여부
|
||||
/// </summary>
|
||||
public bool CanUseSkill(int slotIndex)
|
||||
{
|
||||
SkillData skill = GetSkill(slotIndex);
|
||||
if (skill == null) return false;
|
||||
|
||||
return !skillController.IsOnCooldown(skill) && !skillController.IsExecutingSkill;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Player/PlayerSkillInput.cs.meta
Normal file
2
Assets/Scripts/Player/PlayerSkillInput.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5b5422385dda854cbe61b01950f06da
|
||||
8
Assets/Scripts/Skills.meta
Normal file
8
Assets/Scripts/Skills.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d5453fda75bcc743a40d05357360fa5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/Skills/Effects.meta
Normal file
8
Assets/Scripts/Skills/Effects.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1401ae499769cb64c9eca36823c46714
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/Scripts/Skills/Effects/BuffEffect.cs
Normal file
32
Assets/Scripts/Skills/Effects/BuffEffect.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.Skills.Effects
|
||||
{
|
||||
/// <summary>
|
||||
/// 버프/디버프 효과
|
||||
/// </summary>
|
||||
[CreateAssetMenu(fileName = "BuffEffect", menuName = "Colosseum/Skills/Effects/Buff")]
|
||||
public class BuffEffect : SkillEffect
|
||||
{
|
||||
[Header("Buff Settings")]
|
||||
[SerializeField] private string buffName = "Buff";
|
||||
[Min(0f)] [SerializeField] private float duration = 5f;
|
||||
|
||||
[Header("Stat Modifiers")]
|
||||
[Range(0f, 10f)] [SerializeField] private float moveSpeedMultiplier = 1f;
|
||||
[Range(0f, 10f)] [SerializeField] private float attackPowerMultiplier = 1f;
|
||||
[Range(0f, 10f)] [SerializeField] private float defenseMultiplier = 1f;
|
||||
|
||||
protected override void ApplyEffect(GameObject caster, GameObject target)
|
||||
{
|
||||
if (target == null) return;
|
||||
|
||||
// TODO: 실제 버프 시스템 연동
|
||||
// var buffSystem = target.GetComponent<BuffSystem>();
|
||||
// buffSystem?.ApplyBuff(new BuffData(buffName, duration, moveSpeedMultiplier, attackPowerMultiplier, defenseMultiplier));
|
||||
|
||||
Debug.Log($"[Buff] {buffName} on {target.name} for {duration}s " +
|
||||
$"(Speed: {moveSpeedMultiplier}x, ATK: {attackPowerMultiplier}x, DEF: {defenseMultiplier}x)");
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Skills/Effects/BuffEffect.cs.meta
Normal file
2
Assets/Scripts/Skills/Effects/BuffEffect.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32bab3b586da0d7469f63e03f18ee29f
|
||||
26
Assets/Scripts/Skills/Effects/DamageEffect.cs
Normal file
26
Assets/Scripts/Skills/Effects/DamageEffect.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.Skills.Effects
|
||||
{
|
||||
/// <summary>
|
||||
/// 데미지 효과
|
||||
/// </summary>
|
||||
[CreateAssetMenu(fileName = "DamageEffect", menuName = "Colosseum/Skills/Effects/Damage")]
|
||||
public class DamageEffect : SkillEffect
|
||||
{
|
||||
[Header("Damage Settings")]
|
||||
[Min(0f)] [SerializeField] private float damageAmount = 10f;
|
||||
[SerializeField] private string damageType = "Physical";
|
||||
|
||||
protected override void ApplyEffect(GameObject caster, GameObject target)
|
||||
{
|
||||
if (target == null) return;
|
||||
|
||||
// TODO: 실제 데미지 시스템 연동
|
||||
// var health = target.GetComponent<Health>();
|
||||
// health?.TakeDamage(damageAmount, caster, damageType);
|
||||
|
||||
Debug.Log($"[Damage] {caster.name} -> {target.name}: {damageAmount} ({damageType})");
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Skills/Effects/DamageEffect.cs.meta
Normal file
2
Assets/Scripts/Skills/Effects/DamageEffect.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58efb3c775496fa40b801b21127a011e
|
||||
25
Assets/Scripts/Skills/Effects/HealEffect.cs
Normal file
25
Assets/Scripts/Skills/Effects/HealEffect.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.Skills.Effects
|
||||
{
|
||||
/// <summary>
|
||||
/// 치료 효과
|
||||
/// </summary>
|
||||
[CreateAssetMenu(fileName = "HealEffect", menuName = "Colosseum/Skills/Effects/Heal")]
|
||||
public class HealEffect : SkillEffect
|
||||
{
|
||||
[Header("Heal Settings")]
|
||||
[Min(0f)] [SerializeField] private float healAmount = 10f;
|
||||
|
||||
protected override void ApplyEffect(GameObject caster, GameObject target)
|
||||
{
|
||||
if (target == null) return;
|
||||
|
||||
// TODO: 실제 체력 시스템 연동
|
||||
// var health = target.GetComponent<Health>();
|
||||
// health?.Heal(healAmount);
|
||||
|
||||
Debug.Log($"[Heal] {caster.name} -> {target.name}: {healAmount}");
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Skills/Effects/HealEffect.cs.meta
Normal file
2
Assets/Scripts/Skills/Effects/HealEffect.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: abc224c01f587d447bc8df723ef522ba
|
||||
32
Assets/Scripts/Skills/Effects/KnockbackEffect.cs
Normal file
32
Assets/Scripts/Skills/Effects/KnockbackEffect.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.Skills.Effects
|
||||
{
|
||||
/// <summary>
|
||||
/// 넉백 효과
|
||||
/// </summary>
|
||||
[CreateAssetMenu(fileName = "KnockbackEffect", menuName = "Colosseum/Skills/Effects/Knockback")]
|
||||
public class KnockbackEffect : SkillEffect
|
||||
{
|
||||
[Header("Knockback Settings")]
|
||||
[Min(0f)] [SerializeField] private float force = 5f;
|
||||
[SerializeField] private float upwardForce = 2f;
|
||||
|
||||
protected override void ApplyEffect(GameObject caster, GameObject target)
|
||||
{
|
||||
if (target == null || caster == null) return;
|
||||
|
||||
Vector3 direction = target.transform.position - caster.transform.position;
|
||||
direction.y = 0f;
|
||||
direction.Normalize();
|
||||
|
||||
Vector3 knockback = direction * force + Vector3.up * upwardForce;
|
||||
|
||||
// TODO: 실제 물리 시스템 연동
|
||||
// if (target.TryGetComponent<Rigidbody>(out var rb))
|
||||
// rb.AddForce(knockback, ForceMode.Impulse);
|
||||
|
||||
Debug.Log($"[Knockback] {target.name}: {knockback}");
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Skills/Effects/KnockbackEffect.cs.meta
Normal file
2
Assets/Scripts/Skills/Effects/KnockbackEffect.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27cd4e4eb6a485845953db2a108a37f8
|
||||
22
Assets/Scripts/Skills/Effects/SoundEffect.cs
Normal file
22
Assets/Scripts/Skills/Effects/SoundEffect.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.Skills.Effects
|
||||
{
|
||||
/// <summary>
|
||||
/// 사운드 재생 효과
|
||||
/// </summary>
|
||||
[CreateAssetMenu(fileName = "SoundEffect", menuName = "Colosseum/Skills/Effects/Sound")]
|
||||
public class SoundEffect : SkillEffect
|
||||
{
|
||||
[Header("Sound Settings")]
|
||||
[SerializeField] private AudioClip clip;
|
||||
[Range(0f, 1f)] [SerializeField] private float volume = 1f;
|
||||
|
||||
protected override void ApplyEffect(GameObject caster, GameObject target)
|
||||
{
|
||||
if (clip == null || caster == null) return;
|
||||
|
||||
AudioSource.PlayClipAtPoint(clip, caster.transform.position, volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Skills/Effects/SoundEffect.cs.meta
Normal file
2
Assets/Scripts/Skills/Effects/SoundEffect.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 052c59e9f6bf6864da0248beab125037
|
||||
68
Assets/Scripts/Skills/Effects/SpawnEffect.cs
Normal file
68
Assets/Scripts/Skills/Effects/SpawnEffect.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.Skills.Effects
|
||||
{
|
||||
/// <summary>
|
||||
/// 프리팹 스폰 효과 (투사체, 파티클 등)
|
||||
/// </summary>
|
||||
[CreateAssetMenu(fileName = "SpawnEffect", menuName = "Colosseum/Skills/Effects/Spawn")]
|
||||
public class SpawnEffect : SkillEffect
|
||||
{
|
||||
[Header("Spawn Settings")]
|
||||
[SerializeField] private GameObject prefab;
|
||||
[SerializeField] private SpawnLocation spawnLocation = SpawnLocation.Caster;
|
||||
[SerializeField] private Vector3 spawnOffset = Vector3.zero;
|
||||
[SerializeField] private bool parentToCaster = false;
|
||||
[Min(0f)] [SerializeField] private float autoDestroyTime = 3f;
|
||||
|
||||
protected override void ApplyEffect(GameObject caster, GameObject target)
|
||||
{
|
||||
if (prefab == null || caster == null) return;
|
||||
|
||||
Vector3 spawnPos = GetSpawnPosition(caster, target) + spawnOffset;
|
||||
Quaternion spawnRot = GetSpawnRotation(caster, target);
|
||||
Transform parent = parentToCaster ? caster.transform : null;
|
||||
|
||||
GameObject instance = Object.Instantiate(prefab, spawnPos, spawnRot, parent);
|
||||
|
||||
// SkillProjectile 컴포넌트가 있으면 초기화
|
||||
var projectile = instance.GetComponent<SkillProjectile>();
|
||||
if (projectile != null)
|
||||
{
|
||||
projectile.Initialize(caster, this);
|
||||
}
|
||||
|
||||
if (autoDestroyTime > 0f)
|
||||
{
|
||||
Object.Destroy(instance, autoDestroyTime);
|
||||
}
|
||||
}
|
||||
|
||||
private Vector3 GetSpawnPosition(GameObject caster, GameObject target)
|
||||
{
|
||||
return spawnLocation switch
|
||||
{
|
||||
SpawnLocation.Caster => caster.transform.position,
|
||||
SpawnLocation.CasterForward => caster.transform.position + caster.transform.forward * 2f,
|
||||
SpawnLocation.Target => target != null ? target.transform.position : caster.transform.position,
|
||||
_ => caster.transform.position
|
||||
};
|
||||
}
|
||||
|
||||
private Quaternion GetSpawnRotation(GameObject caster, GameObject target)
|
||||
{
|
||||
if (spawnLocation == SpawnLocation.Target && target != null)
|
||||
{
|
||||
return Quaternion.LookRotation(target.transform.position - caster.transform.position);
|
||||
}
|
||||
return caster.transform.rotation;
|
||||
}
|
||||
}
|
||||
|
||||
public enum SpawnLocation
|
||||
{
|
||||
Caster,
|
||||
CasterForward,
|
||||
Target
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Skills/Effects/SpawnEffect.cs.meta
Normal file
2
Assets/Scripts/Skills/Effects/SpawnEffect.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3139ddf07cfe324fa692a88cd565e24
|
||||
272
Assets/Scripts/Skills/SkillController.cs
Normal file
272
Assets/Scripts/Skills/SkillController.cs
Normal file
@@ -0,0 +1,272 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Colosseum.Skills
|
||||
{
|
||||
/// <summary>
|
||||
/// 스킬 실행을 관리하는 컴포넌트.
|
||||
/// 애니메이션 이벤트 기반으로 효과가 발동됩니다.
|
||||
/// </summary>
|
||||
public class SkillController : MonoBehaviour
|
||||
{
|
||||
private const string SKILL_STATE_NAME = "Skill";
|
||||
private const string END_STATE_NAME = "SkillEnd";
|
||||
|
||||
[Header("애니메이션")]
|
||||
[SerializeField] private Animator animator;
|
||||
[Tooltip("기본 Animator Controller (스킬 종료 후 복원용)")]
|
||||
[SerializeField] private RuntimeAnimatorController baseController;
|
||||
[Tooltip("Skill 상태에 연결된 기본 클립 (Override용)")]
|
||||
[SerializeField] private AnimationClip baseSkillClip;
|
||||
|
||||
[Header("설정")]
|
||||
[SerializeField] private bool debugMode = false;
|
||||
|
||||
// 현재 실행 중인 스킬
|
||||
private SkillData currentSkill;
|
||||
private bool skillEndRequested; // OnSkillEnd 이벤트 호출 여부
|
||||
private bool waitingForEndAnimation; // EndAnimation 종료 대기 중
|
||||
|
||||
// 쿨타임 추적
|
||||
private Dictionary<SkillData, float> cooldownTracker = new Dictionary<SkillData, float>();
|
||||
|
||||
public bool IsExecutingSkill => currentSkill != null && !skillEndRequested;
|
||||
public bool IsPlayingAnimation => currentSkill != null;
|
||||
public SkillData CurrentSkill => currentSkill;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (animator == null)
|
||||
{
|
||||
animator = GetComponentInChildren<Animator>();
|
||||
}
|
||||
|
||||
// 기본 컨트롤러 저장
|
||||
if (baseController == null && animator != null)
|
||||
{
|
||||
baseController = animator.runtimeAnimatorController;
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (currentSkill == null || animator == null) return;
|
||||
|
||||
var stateInfo = animator.GetCurrentAnimatorStateInfo(0);
|
||||
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"[Skill] State: {stateInfo.shortNameHash}, NormalizedTime: {stateInfo.normalizedTime:F2}, IsSkill: {stateInfo.IsName(SKILL_STATE_NAME)}");
|
||||
}
|
||||
|
||||
// EndAnimation 종료 감지
|
||||
if (waitingForEndAnimation)
|
||||
{
|
||||
if (stateInfo.normalizedTime >= 1f)
|
||||
{
|
||||
if (debugMode) Debug.Log($"[Skill] EndAnimation complete: {currentSkill.SkillName}");
|
||||
RestoreBaseController();
|
||||
currentSkill = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 애니메이션 종료 시 처리 (OnSkillEnd 여부와 관계없이 애니메이션 끝까지 재생)
|
||||
if (stateInfo.normalizedTime >= 1f)
|
||||
{
|
||||
if (currentSkill.EndClip != null)
|
||||
{
|
||||
// EndAnimation 재생 후 종료 대기
|
||||
if (debugMode) Debug.Log($"[Skill] SkillAnimation done, playing EndAnimation: {currentSkill.SkillName}");
|
||||
PlayEndClip(currentSkill.EndClip);
|
||||
waitingForEndAnimation = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// EndAnimation 없으면 바로 종료
|
||||
if (debugMode) Debug.Log($"[Skill] Animation complete: {currentSkill.SkillName}");
|
||||
RestoreBaseController();
|
||||
currentSkill = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 스킬 시전
|
||||
/// </summary>
|
||||
public bool ExecuteSkill(SkillData skill)
|
||||
{
|
||||
if (skill == null)
|
||||
{
|
||||
Debug.LogWarning("Skill is null!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsExecutingSkill)
|
||||
{
|
||||
if (debugMode) Debug.Log($"Already executing skill: {currentSkill.SkillName}");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsOnCooldown(skill))
|
||||
{
|
||||
if (debugMode) Debug.Log($"Skill {skill.SkillName} is on cooldown");
|
||||
return false;
|
||||
}
|
||||
|
||||
currentSkill = skill;
|
||||
skillEndRequested = false;
|
||||
waitingForEndAnimation = false;
|
||||
|
||||
if (debugMode) Debug.Log($"[Skill] Cast: {skill.SkillName}");
|
||||
|
||||
// 쿨타임 시작
|
||||
StartCooldown(skill);
|
||||
|
||||
// 스킬 애니메이션 재생
|
||||
if (skill.SkillClip != null && animator != null)
|
||||
{
|
||||
PlaySkillClip(skill.SkillClip);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 스킬 클립으로 Override Controller 생성 후 재생
|
||||
/// </summary>
|
||||
private void PlaySkillClip(AnimationClip clip)
|
||||
{
|
||||
if (baseSkillClip == null)
|
||||
{
|
||||
Debug.LogError("[SkillController] Base Skill Clip is not assigned!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"[Skill] PlaySkillClip: {clip.name}, BaseClip: {baseSkillClip.name}");
|
||||
}
|
||||
|
||||
var overrideController = new AnimatorOverrideController(baseController);
|
||||
overrideController[baseSkillClip] = clip;
|
||||
animator.runtimeAnimatorController = overrideController;
|
||||
animator.Play(SKILL_STATE_NAME, 0, 0f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 종료 클립 재생
|
||||
/// </summary>
|
||||
private void PlayEndClip(AnimationClip clip)
|
||||
{
|
||||
if (baseSkillClip == null)
|
||||
{
|
||||
Debug.LogError("[SkillController] Base Skill Clip is not assigned!");
|
||||
return;
|
||||
}
|
||||
|
||||
var overrideController = new AnimatorOverrideController(baseController);
|
||||
overrideController[baseSkillClip] = clip;
|
||||
animator.runtimeAnimatorController = overrideController;
|
||||
animator.Play(SKILL_STATE_NAME, 0, 0f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 기본 컨트롤러로 복원
|
||||
/// </summary>
|
||||
private void RestoreBaseController()
|
||||
{
|
||||
if (animator != null && baseController != null)
|
||||
{
|
||||
animator.runtimeAnimatorController = baseController;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 애니메이션 이벤트에서 호출. Effect 리스트의 index번째 효과를 발동합니다.
|
||||
/// Animation Event: Function = OnEffect, Int Parameter = effect index (0-based)
|
||||
/// </summary>
|
||||
public void OnEffect(int index)
|
||||
{
|
||||
if (currentSkill == null)
|
||||
{
|
||||
if (debugMode) Debug.LogWarning("[Effect] No skill executing");
|
||||
return;
|
||||
}
|
||||
|
||||
var effects = currentSkill.Effects;
|
||||
if (index < 0 || index >= effects.Count)
|
||||
{
|
||||
if (debugMode) Debug.LogWarning($"[Effect] Invalid index: {index}");
|
||||
return;
|
||||
}
|
||||
|
||||
var effect = effects[index];
|
||||
if (debugMode) Debug.Log($"[Effect] {effect.name} (index {index})");
|
||||
|
||||
effect.ExecuteOnCast(gameObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 애니메이션 이벤트에서 호출. 스킬 종료를 요청합니다.
|
||||
/// 애니메이션은 끝까지 재생된 후 종료됩니다.
|
||||
/// Animation Event: Function = OnSkillEnd
|
||||
/// </summary>
|
||||
public void OnSkillEnd()
|
||||
{
|
||||
if (currentSkill == null)
|
||||
{
|
||||
if (debugMode) Debug.LogWarning("[SkillEnd] No skill executing");
|
||||
return;
|
||||
}
|
||||
|
||||
skillEndRequested = true;
|
||||
|
||||
if (debugMode) Debug.Log($"[Skill] End requested: {currentSkill.SkillName} (will complete after animation)");
|
||||
}
|
||||
|
||||
public void CancelSkill()
|
||||
{
|
||||
if (currentSkill != null)
|
||||
{
|
||||
if (debugMode) Debug.Log($"Skill cancelled: {currentSkill.SkillName}");
|
||||
RestoreBaseController();
|
||||
currentSkill = null;
|
||||
skillEndRequested = false;
|
||||
waitingForEndAnimation = false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsOnCooldown(SkillData skill)
|
||||
{
|
||||
if (!cooldownTracker.ContainsKey(skill))
|
||||
return false;
|
||||
|
||||
return Time.time < cooldownTracker[skill];
|
||||
}
|
||||
|
||||
public float GetRemainingCooldown(SkillData skill)
|
||||
{
|
||||
if (!cooldownTracker.ContainsKey(skill))
|
||||
return 0f;
|
||||
|
||||
float remaining = cooldownTracker[skill] - Time.time;
|
||||
return Mathf.Max(0f, remaining);
|
||||
}
|
||||
|
||||
private void StartCooldown(SkillData skill)
|
||||
{
|
||||
cooldownTracker[skill] = Time.time + skill.Cooldown;
|
||||
}
|
||||
|
||||
public void ResetCooldown(SkillData skill)
|
||||
{
|
||||
cooldownTracker.Remove(skill);
|
||||
}
|
||||
|
||||
public void ResetAllCooldowns()
|
||||
{
|
||||
cooldownTracker.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Skills/SkillController.cs.meta
Normal file
2
Assets/Scripts/Skills/SkillController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59b4feaa06ce4c74f97ed5b57ddd74d1
|
||||
42
Assets/Scripts/Skills/SkillData.cs
Normal file
42
Assets/Scripts/Skills/SkillData.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Colosseum.Skills
|
||||
{
|
||||
/// <summary>
|
||||
/// 스킬 데이터. 스킬의 기본 정보와 효과 목록을 관리합니다.
|
||||
/// </summary>
|
||||
[CreateAssetMenu(fileName = "NewSkill", menuName = "Colosseum/Skill")]
|
||||
public class SkillData : ScriptableObject
|
||||
{
|
||||
[Header("기본 정보")]
|
||||
[SerializeField] private string skillName;
|
||||
[TextArea(2, 4)]
|
||||
[SerializeField] private string description;
|
||||
[SerializeField] private Sprite icon;
|
||||
|
||||
[Header("애니메이션")]
|
||||
[Tooltip("기본 Animator Controller의 'Skill' 상태에 덮어씌워질 클립")]
|
||||
[SerializeField] private AnimationClip skillClip;
|
||||
[Tooltip("종료 애니메이션 (선택)")]
|
||||
[SerializeField] private AnimationClip endClip;
|
||||
|
||||
[Header("쿨타임 & 비용")]
|
||||
[Min(0f)] [SerializeField] private float cooldown = 1f;
|
||||
[Min(0f)] [SerializeField] private float manaCost = 0f;
|
||||
|
||||
[Header("효과 목록")]
|
||||
[Tooltip("애니메이션 이벤트 OnEffect(index)로 발동. 리스트 순서 = 이벤트 인덱스")]
|
||||
[SerializeField] private List<SkillEffect> effects = new List<SkillEffect>();
|
||||
|
||||
// Properties
|
||||
public string SkillName => skillName;
|
||||
public string Description => description;
|
||||
public Sprite Icon => icon;
|
||||
public AnimationClip SkillClip => skillClip;
|
||||
public AnimationClip EndClip => endClip;
|
||||
public float Cooldown => cooldown;
|
||||
public float ManaCost => manaCost;
|
||||
public IReadOnlyList<SkillEffect> Effects => effects;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Skills/SkillData.cs.meta
Normal file
2
Assets/Scripts/Skills/SkillData.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94f0a76cebcac2f4fb5daf1b675fd79f
|
||||
134
Assets/Scripts/Skills/SkillEffect.cs
Normal file
134
Assets/Scripts/Skills/SkillEffect.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
using UnityEngine;
|
||||
using Colosseum;
|
||||
|
||||
namespace Colosseum.Skills
|
||||
{
|
||||
/// <summary>
|
||||
/// 스킬 효과의 기본 클래스.
|
||||
/// 모든 효과는 이 클래스를 상속받아 구현합니다.
|
||||
/// 효과 발동 타이밍은 애니메이션 이벤트(OnEffect)로 제어합니다.
|
||||
/// </summary>
|
||||
public abstract class SkillEffect : ScriptableObject
|
||||
{
|
||||
[Header("대상 설정")]
|
||||
[Tooltip("Self: 시전자, Area: 범위 내 대상")]
|
||||
[SerializeField] protected TargetType targetType = TargetType.Self;
|
||||
|
||||
[Header("Area Settings (TargetType이 Area일 때)")]
|
||||
[Tooltip("범위 내에서 공격할 대상 필터")]
|
||||
[SerializeField] protected TargetTeam targetTeam = TargetTeam.Enemy;
|
||||
[SerializeField] protected AreaCenterType areaCenter = AreaCenterType.Caster;
|
||||
[Min(0.1f)] [SerializeField] protected float areaRadius = 3f;
|
||||
[SerializeField] protected LayerMask targetLayers;
|
||||
|
||||
// Properties
|
||||
public TargetType TargetType => targetType;
|
||||
public TargetTeam TargetTeam => targetTeam;
|
||||
|
||||
/// <summary>
|
||||
/// 스킬 시전 시 호출
|
||||
/// </summary>
|
||||
public void ExecuteOnCast(GameObject caster)
|
||||
{
|
||||
switch (targetType)
|
||||
{
|
||||
case TargetType.Self:
|
||||
ApplyEffect(caster, caster);
|
||||
break;
|
||||
|
||||
case TargetType.Area:
|
||||
ExecuteArea(caster);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 투사체 충돌 시 호출
|
||||
/// </summary>
|
||||
public void ExecuteOnHit(GameObject caster, GameObject hitTarget)
|
||||
{
|
||||
if (IsValidTarget(caster, hitTarget))
|
||||
{
|
||||
ApplyEffect(caster, hitTarget);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 실제 효과 적용 (상속받은 클래스에서 구현)
|
||||
/// </summary>
|
||||
protected abstract void ApplyEffect(GameObject caster, GameObject target);
|
||||
|
||||
/// <summary>
|
||||
/// 충돌한 대상이 유효한 타겟인지 확인
|
||||
/// </summary>
|
||||
public bool IsValidTarget(GameObject caster, GameObject target)
|
||||
{
|
||||
if (target == null) return false;
|
||||
|
||||
// 레이어 체크
|
||||
if (targetLayers.value != 0 && (targetLayers.value & (1 << target.layer)) == 0)
|
||||
return false;
|
||||
|
||||
// 팀 체크
|
||||
return IsCorrectTeam(caster, target);
|
||||
}
|
||||
|
||||
private bool IsCorrectTeam(GameObject caster, GameObject target)
|
||||
{
|
||||
bool isSameTeam = Team.IsSameTeam(caster, target);
|
||||
|
||||
return targetTeam switch
|
||||
{
|
||||
TargetTeam.Enemy => !isSameTeam,
|
||||
TargetTeam.Ally => isSameTeam,
|
||||
TargetTeam.All => true,
|
||||
_ => true
|
||||
};
|
||||
}
|
||||
|
||||
private void ExecuteArea(GameObject caster)
|
||||
{
|
||||
Vector3 center = GetAreaCenter(caster);
|
||||
Collider[] hits = Physics.OverlapSphere(center, areaRadius, targetLayers);
|
||||
|
||||
foreach (var hit in hits)
|
||||
{
|
||||
if (hit.gameObject == caster) continue;
|
||||
if (!IsCorrectTeam(caster, hit.gameObject)) continue;
|
||||
|
||||
ApplyEffect(caster, hit.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private Vector3 GetAreaCenter(GameObject caster)
|
||||
{
|
||||
if (caster == null) return Vector3.zero;
|
||||
|
||||
return areaCenter switch
|
||||
{
|
||||
AreaCenterType.Caster => caster.transform.position,
|
||||
AreaCenterType.CasterForward => caster.transform.position + caster.transform.forward * areaRadius,
|
||||
_ => caster.transform.position
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public enum TargetType
|
||||
{
|
||||
Self,
|
||||
Area
|
||||
}
|
||||
|
||||
public enum TargetTeam
|
||||
{
|
||||
Enemy,
|
||||
Ally,
|
||||
All
|
||||
}
|
||||
|
||||
public enum AreaCenterType
|
||||
{
|
||||
Caster,
|
||||
CasterForward
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Skills/SkillEffect.cs.meta
Normal file
2
Assets/Scripts/Skills/SkillEffect.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd8fab5faadbfff49ae5117890787807
|
||||
89
Assets/Scripts/Skills/SkillProjectile.cs
Normal file
89
Assets/Scripts/Skills/SkillProjectile.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum.Skills
|
||||
{
|
||||
/// <summary>
|
||||
/// 스킬 투사체. 충돌 시 연결된 효과를 적용합니다.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Rigidbody))]
|
||||
public class SkillProjectile : MonoBehaviour
|
||||
{
|
||||
[Header("이동 설정")]
|
||||
[Min(0f)] [SerializeField] private float speed = 15f;
|
||||
[Min(0f)] [SerializeField] private float lifetime = 5f;
|
||||
|
||||
[Header("관통 설정")]
|
||||
[SerializeField] private bool penetrate = false;
|
||||
[SerializeField] private int maxPenetration = 1;
|
||||
|
||||
[Header("충돌 이펙트")]
|
||||
[SerializeField] private GameObject hitEffect;
|
||||
[SerializeField] private float hitEffectDuration = 2f;
|
||||
|
||||
private GameObject caster;
|
||||
private SkillEffect sourceEffect;
|
||||
private int penetrationCount;
|
||||
private Rigidbody rb;
|
||||
private bool initialized;
|
||||
|
||||
/// <summary>
|
||||
/// 투사체 초기화
|
||||
/// </summary>
|
||||
public void Initialize(GameObject caster, SkillEffect sourceEffect)
|
||||
{
|
||||
this.caster = caster;
|
||||
this.sourceEffect = sourceEffect;
|
||||
initialized = true;
|
||||
|
||||
rb = GetComponent<Rigidbody>();
|
||||
if (rb != null)
|
||||
{
|
||||
rb.useGravity = false;
|
||||
rb.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Destroy(gameObject, lifetime);
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (!initialized || rb == null) return;
|
||||
rb.linearVelocity = transform.forward * speed;
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (!initialized || sourceEffect == null) return;
|
||||
if (other.gameObject == caster) return;
|
||||
|
||||
// 유효한 타겟인지 확인
|
||||
if (!sourceEffect.IsValidTarget(caster, other.gameObject))
|
||||
return;
|
||||
|
||||
// 충돌 이펙트
|
||||
if (hitEffect != null)
|
||||
{
|
||||
var effect = Instantiate(hitEffect, transform.position, transform.rotation);
|
||||
Destroy(effect, hitEffectDuration);
|
||||
}
|
||||
|
||||
// 효과 적용
|
||||
sourceEffect.ExecuteOnHit(caster, other.gameObject);
|
||||
|
||||
penetrationCount++;
|
||||
|
||||
if (!penetrate || penetrationCount >= maxPenetration)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDirection(Vector3 direction)
|
||||
{
|
||||
transform.rotation = Quaternion.LookRotation(direction.normalized);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Skills/SkillProjectile.cs.meta
Normal file
2
Assets/Scripts/Skills/SkillProjectile.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e2a203fbf7bc39449b13bec67e94150
|
||||
33
Assets/Scripts/Team.cs
Normal file
33
Assets/Scripts/Team.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Colosseum
|
||||
{
|
||||
/// <summary>
|
||||
/// 팀 정보를 관리하는 컴포넌트.
|
||||
/// 캐릭터나 엔티티에 추가하여 팀 구분에 사용합니다.
|
||||
/// </summary>
|
||||
public class Team : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private int teamId = 0;
|
||||
|
||||
public int TeamId => teamId;
|
||||
|
||||
/// <summary>
|
||||
/// 같은 팀인지 확인
|
||||
/// </summary>
|
||||
public static bool IsSameTeam(GameObject a, GameObject b)
|
||||
{
|
||||
if (a == null || b == null) return false;
|
||||
|
||||
var teamA = a.GetComponent<Team>();
|
||||
var teamB = b.GetComponent<Team>();
|
||||
|
||||
// 둘 다 팀이 없으면 같은 팀으로 처리
|
||||
if (teamA == null && teamB == null) return true;
|
||||
// 한쪽만 팀이 없으면 다른 팀
|
||||
if (teamA == null || teamB == null) return false;
|
||||
|
||||
return teamA.TeamId == teamB.TeamId;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Team.cs.meta
Normal file
2
Assets/Scripts/Team.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1f7d13276f272b428bddd4d9aa5b3d8
|
||||
Reference in New Issue
Block a user