Feat: Dash
Implemented basic dash logic WITHOUT cooldowns. Needs more changes down the line
This commit is contained in:
27
3D blobici/Assets/Scripts/Player/PlayerSkillHandler.cs
Normal file
27
3D blobici/Assets/Scripts/Player/PlayerSkillHandler.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerSkillHandler
|
||||
{
|
||||
private float dashSpeed = 15f;
|
||||
private float dashDuration = 0.2f;
|
||||
|
||||
private bool isDashing = false;
|
||||
|
||||
public bool IsDashing() { return isDashing; }
|
||||
|
||||
public IEnumerator DashCoroutine(CharacterController controller, Vector3 direction)
|
||||
{
|
||||
|
||||
float startTime = Time.time;
|
||||
isDashing = true;
|
||||
while (Time.time - startTime < dashDuration)
|
||||
{
|
||||
controller.Move(direction * dashSpeed * Time.deltaTime);
|
||||
yield return null;
|
||||
}
|
||||
isDashing = false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user