씬 정리
This commit is contained in:
11
Assets/Scripts/Unicorn/Hitbox/DamageInfo.cs
Normal file
11
Assets/Scripts/Unicorn/Hitbox/DamageInfo.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unicorn.Game.Hitbox
|
||||
{
|
||||
public struct DamageInfo
|
||||
{
|
||||
public float damage;
|
||||
public float knockbackForce;
|
||||
public Vector3 hitPoint; // 넉백 방향 계산을 위해 필요
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Unicorn/Hitbox/DamageInfo.cs.meta
Normal file
3
Assets/Scripts/Unicorn/Hitbox/DamageInfo.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d01fae1e974b477591fb12d00e8c10ba
|
||||
timeCreated: 1777908924
|
||||
8
Assets/Scripts/Unicorn/Hitbox/SO.meta
Normal file
8
Assets/Scripts/Unicorn/Hitbox/SO.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64fa6e6de39c4aa418339d93d6f9c418
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/Scripts/Unicorn/Hitbox/SO/ExampleAD.asset
Normal file
16
Assets/Scripts/Unicorn/Hitbox/SO/ExampleAD.asset
Normal file
@@ -0,0 +1,16 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
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: 4de4d4a74d5b4258863a8173560a93ab, type: 3}
|
||||
m_Name: ExampleAD
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Unicorn.Game.Hitbox.UnicornAttackDataSO
|
||||
damage: 3
|
||||
knockbackForce: 15
|
||||
8
Assets/Scripts/Unicorn/Hitbox/SO/ExampleAD.asset.meta
Normal file
8
Assets/Scripts/Unicorn/Hitbox/SO/ExampleAD.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67ddb0901f4c7754a9e47e5cf5cac286
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
Assets/Scripts/Unicorn/Hitbox/UnicornAttackDataSO.cs
Normal file
11
Assets/Scripts/Unicorn/Hitbox/UnicornAttackDataSO.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unicorn.Game.Hitbox
|
||||
{
|
||||
[CreateAssetMenu(fileName = "NewAttackData", menuName = "Unicorn/AttackData")]
|
||||
public class UnicornAttackDataSO: ScriptableObject
|
||||
{
|
||||
public float damage;
|
||||
public float knockbackForce;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4de4d4a74d5b4258863a8173560a93ab
|
||||
timeCreated: 1777908942
|
||||
22
Assets/Scripts/Unicorn/Hitbox/UnicornHitbox.cs
Normal file
22
Assets/Scripts/Unicorn/Hitbox/UnicornHitbox.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unicorn.Game.Hitbox
|
||||
{
|
||||
public class UnicornHitbox : MonoBehaviour
|
||||
{
|
||||
public UnicornAttackDataSO attackData;
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (!other.TryGetComponent(out LivingEntity target)) return;
|
||||
var info = new DamageInfo
|
||||
{
|
||||
damage = attackData.damage,
|
||||
knockbackForce = attackData.knockbackForce,
|
||||
hitPoint = transform.position
|
||||
};
|
||||
|
||||
target.Damage(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Unicorn/Hitbox/UnicornHitbox.cs.meta
Normal file
2
Assets/Scripts/Unicorn/Hitbox/UnicornHitbox.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bdb9c585da578ee408fc4177ce2010e1
|
||||
Reference in New Issue
Block a user