스킬 시스템 구현
- 애니메이션 이벤트 기반 스킬 시스템 추가 - 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:
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
|
||||
Reference in New Issue
Block a user