- 애니메이션 이벤트 기반 스킬 시스템 추가 - 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>
69 lines
2.4 KiB
C#
69 lines
2.4 KiB
C#
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
|
|
}
|
|
}
|