Attack까지 완성..?

This commit is contained in:
김도환
2026-05-04 00:19:01 +09:00
parent b39116e734
commit 66d48537f7
9 changed files with 692 additions and 19 deletions

View File

@@ -0,0 +1,23 @@
using UnityEngine;
public partial class LivingEntity : MonoBehaviour
{
public float health = 20.0f;
public void Damage(float damage, Collider2D cause)
{
health -= damage;
OnDamaged(damage, cause);
if (health <= 0.0f) OnDeath();
}
private void OnDamaged(float damage, Collider2D cause)
{
throw new System.NotImplementedException();
}
private void OnDeath()
{
throw new System.NotImplementedException();
}
}

View File

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

4
Assets/Scripts/Player.cs Normal file
View File

@@ -0,0 +1,4 @@
public class Player: LivingEntity
{
}

View File

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

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.InputSystem;
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