씬 정리

This commit is contained in:
김도환
2026-05-08 22:45:22 +09:00
parent d4cb3c5f39
commit f1213cd247
26 changed files with 120 additions and 255 deletions

View File

@@ -0,0 +1,18 @@
using Unicorn.Game.Hitbox;
using UnityEngine;
namespace Unicorn.Game.Player
{
public class Player: LivingEntity
{
protected override void OnDamaged(DamageInfo info)
{
Debug.Log(health);
}
protected override void OnDeath()
{
Debug.Log("주것서영.");
}
}
}

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