TMP 임포트해서 뭐가 엄청 많아졌구나

This commit is contained in:
김도환
2026-05-05 01:07:00 +09:00
parent 66d48537f7
commit ec7dd33126
391 changed files with 114302 additions and 131 deletions

View File

@@ -0,0 +1,14 @@
using Unicorn.Game.Hitbox;
using UnityEngine;
namespace Unicorn.Game
{
public class Enemy : LivingEntity
{
protected override void OnDamaged(DamageInfo info)
{
var dir = transform.position - info.hitPoint;
Rb.linearVelocity = dir.normalized * info.knockbackForce;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 63fc82d3df1a3164584e678e0f04f817

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 271b8726c0e0470bbe992a207e5da700
timeCreated: 1777908913

View File

@@ -0,0 +1,11 @@
using UnityEngine;
namespace Unicorn.Game.Hitbox
{
public struct DamageInfo
{
public float damage;
public float knockbackForce;
public Vector3 hitPoint; // 넉백 방향 계산을 위해 필요
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d01fae1e974b477591fb12d00e8c10ba
timeCreated: 1777908924

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 64fa6e6de39c4aa418339d93d6f9c418
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View 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: 5
knockbackForce: 15

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 67ddb0901f4c7754a9e47e5cf5cac286
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4de4d4a74d5b4258863a8173560a93ab
timeCreated: 1777908942

View 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);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: bdb9c585da578ee408fc4177ce2010e1

View File

@@ -0,0 +1,45 @@
using Unicorn.Game.Hitbox;
using UnityEngine;
using NotImplementedException = System.NotImplementedException;
namespace Unicorn.Game
{
public partial class LivingEntity : MonoBehaviour
{
private Rigidbody2D _rb;
public float health = 20.0f;
private void Start()
{
_rb = TryGetComponent(out Rigidbody2D rb) ? rb : null;
}
private void OnTriggerEnter2D(Collider2D other)
{
if (_rb == null) return;
var transformPosition = other.transform.position - transform.position;
_rb.linearVelocity = Vector2.zero;
_rb.AddForce(transformPosition.normalized * health, ForceMode2D.Impulse);
}
public void Damage(DamageInfo info)
{
health -= info.damage;
OnDamaged(info);
if (health <= 0.0f) OnDeath();
}
protected virtual void OnDeath()
{
throw new NotImplementedException();
}
public Rigidbody2D Rb => _rb;
protected virtual void OnDamaged(DamageInfo info)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: fe858eccb62e2294f91ad1a4291f2b10

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5614445efa7d41dc8cc9af23def94c20
timeCreated: 1777908834

View File

@@ -0,0 +1,7 @@
namespace Unicorn.Game.Player
{
public class Player: LivingEntity
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 28098bcb033145e7aed508aa64877be6
timeCreated: 1777820261

View File

@@ -0,0 +1,35 @@
using System.Collections;
using Unicorn.System;
using UnityEngine;
using UnityEngine.InputSystem;
namespace Unicorn.Game.Player
{
public class PlayerAttack: MonoBehaviour
{
public GameObject attackHitbox;
private UnicornInputSystem _unicornInput;
private void Start()
{
_unicornInput = UnicornInput.Unicorn;
_unicornInput.Player.Attack.performed += Attack;
}
private void OnDisable()
{
_unicornInput.Player.Attack.performed -= Attack;
}
private void Attack(InputAction.CallbackContext obj)
{
StartCoroutine(OnAttack());
}
private IEnumerator OnAttack()
{
attackHitbox.SetActive(true);
yield return new WaitForSeconds(0.5f);
attackHitbox.SetActive(false);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 54eed17cf1e34c79b343bc0642ca8797
timeCreated: 1777820778

View File

@@ -0,0 +1,42 @@
using System;
using Unicorn.System;
using UnityEngine;
using UnityEngine.InputSystem;
namespace Unicorn.Game.Player
{
public class PlayerMovement : MonoBehaviour
{
public float moveSpeed;
public float jumpForce;
private Rigidbody2D _rb;
private UnicornInputSystem _unicorn;
private void OnDisable()
{
_unicorn.Player.Jump.performed -= Jump;
}
void Start()
{
_rb = GetComponent<Rigidbody2D>();
_unicorn = UnicornInput.Unicorn;
_unicorn.Player.Jump.performed += Jump;
}
private void Jump(InputAction.CallbackContext obj)
{
_rb.linearVelocityY = jumpForce;
}
private void FixedUpdate()
{
var readValue = _unicorn.Player.Horizontal.ReadValue<float>();
_rb.linearVelocityX = readValue * moveSpeed;
if (_unicorn.Player.Down.IsPressed() && _rb.linearVelocityY < jumpForce/1.5)
_rb.linearVelocityY = Math.Min(0, _rb.linearVelocityY);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: db8b3864bdcf65d40b42ee58c17e87aa