TigerProject/Assets/Scripts/Player/PlayerController.cs

65 lines
1.2 KiB
C#
Raw Normal View History

2026-01-20 10:06:03 +00:00
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
2026-01-20 10:06:03 +00:00
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerController : MonoBehaviour
{
private Player player;
2026-01-20 10:06:03 +00:00
private void Start()
{
player = GetComponent<Player>();
2026-01-20 10:06:03 +00:00
}
2026-01-20 10:06:03 +00:00
private void FixedUpdate()
{
player.AddGravityForceOnJump();
player.MoveHorizontal();
2026-01-20 10:06:03 +00:00
}
private void OnMove(InputValue value)
{
player.SetInputVector(value);
}
2026-01-27 10:20:36 +00:00
private void OnDash(InputValue value)
{
if (value.isPressed)
{
player.Dash();
2026-01-27 10:20:36 +00:00
}
}
2026-01-20 10:06:03 +00:00
private void OnJump(InputValue value)
{
player._isJumping = value.isPressed;
2026-01-26 09:08:38 +00:00
if(value.isPressed)
{
player.Jump();
}
}
private void OnAttack(InputValue value)
{
if (player.IsDashing)
{
return;
}
if (value.isPressed)
{
player.Attack();
}
}
// private void OnTriggerEnter2D(Collider2D collision)
// {
// if (player.IsDashing())
// {
// player.AttackOnDash(collision);
// }
// }
2026-01-20 10:06:03 +00:00
}