Files
3DBlobici-WorkingTitle/3D blobici/Assets/Scripts/Player/PlayerSkillHandler.cs

35 lines
1.1 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerSkillHandler
{
private float dashSpeed;
private float dashDuration;
private bool isDashing = false;
public bool IsDashing() { return isDashing; }
public PlayerSkillHandler(float dashSpeed, float dashDuration)
{
this.dashSpeed = dashSpeed;
this.dashDuration = dashDuration;
}
public IEnumerator DashCoroutine(CharacterController controller, Vector3 direction)
{
Physics.IgnoreLayerCollision(6, 7, true); // disable collisions between player and enemies
float startTime = Time.time;
isDashing = true; // just for now. maybe will be removed
while (Time.time - startTime < dashDuration)
{
controller.Move(dashSpeed * Time.deltaTime * direction);
yield return null; // wait one frame
}
isDashing = false; // just for now. maybe will be removed
Physics.IgnoreLayerCollision(6, 7, false); // enable collisions between player and enemies
}
}