+ 주인공 스킬(검의 왈츠)가 추가되었습니다. ㄴ 검의 왈츠 애니메이션이 추가되었습니다. ㄴ 스킬에 맞게 UI를 표시합니다. + 주인공이 더 이상 공격 중에 이동할 수 없습니다. + 새로운 스킬 시스템으로 변경하였습니다. + Combat씬에서 사용할 Camera, Ui를 추가하였습니다. + Input Action이 변경 되었습니다. (UseSkill => ActivateMainSkill) + Idamameable 인터페이스에 GetCurrentHp() 기능이 추가되었습니다. ㄴ 변경에 따라 기존 스크립트들에 추가되었습니다.
73 lines
2.0 KiB
C#
73 lines
2.0 KiB
C#
using System;
|
|
using System.Collections;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace BlueWaterProject
|
|
{
|
|
[Serializable]
|
|
public class SkillInputData
|
|
{
|
|
[Title("초기화 데이터")]
|
|
public Collider playerCollider;
|
|
public Rigidbody playerRb;
|
|
public Transform playerVisualLook;
|
|
public LayerMask targetLayer;
|
|
public SkillUi skillUi;
|
|
|
|
[Title("실시간 데이터")]
|
|
public Vector3 startPosition;
|
|
|
|
public void InitInputData(Collider collider, Rigidbody rb, Transform visualLook, LayerMask target, SkillUi ui)
|
|
{
|
|
playerCollider = collider;
|
|
playerRb = rb;
|
|
playerVisualLook = visualLook;
|
|
targetLayer = target;
|
|
skillUi = ui;
|
|
}
|
|
|
|
public void UpdateInputData(Vector3 start)
|
|
{
|
|
startPosition = start;
|
|
}
|
|
}
|
|
|
|
public abstract class SkillBase : MonoBehaviour, ISkill
|
|
{
|
|
[Title("기본 설정")]
|
|
public string skillName;
|
|
public bool enableSkill = true;
|
|
public float damage;
|
|
public float cooldown;
|
|
public float range;
|
|
public float castingTime;
|
|
public float skillDuration;
|
|
|
|
[field: DisableIf("@true")]
|
|
[field: SerializeField] public SkillInputData SkillInputData { get; set; }
|
|
|
|
public abstract void ActivateSkill();
|
|
|
|
public virtual bool EnableSkill() => enableSkill;
|
|
|
|
public void CoolDown(float waitTime, Action onCooldownComplete = null)
|
|
{
|
|
StartCoroutine(CoolDownCoroutine(waitTime, onCooldownComplete));
|
|
}
|
|
|
|
private IEnumerator CoolDownCoroutine(float waitTime, Action onCooldownComplete = null)
|
|
{
|
|
var time = 0f;
|
|
|
|
while (time <= waitTime)
|
|
{
|
|
time += Time.deltaTime;
|
|
yield return null;
|
|
}
|
|
|
|
onCooldownComplete?.Invoke();
|
|
}
|
|
}
|
|
} |