Demo Overhaul
This commit is contained in:
@@ -19,14 +19,21 @@ public class Punch : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (actions.FindAction("Punch").ReadValue<float>() == 1f)
|
||||
if (actions.FindAction("Punch").WasPressedThisFrame())
|
||||
{
|
||||
if (!cancelable) return;
|
||||
GetComponent<AnimationPlayer>().Punch();
|
||||
DisableCancellation();
|
||||
ExecutePunch();
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecutePunch()
|
||||
{
|
||||
print("Execution");
|
||||
GetComponent<AnimationPlayer>().Punch();
|
||||
DisableCancellation();
|
||||
GetComponent<PlayerMovement>().maxSpeedOverride = 1f;
|
||||
}
|
||||
|
||||
public void EnableHurtbox()
|
||||
{
|
||||
hurtbox.enabled = true;
|
||||
@@ -46,4 +53,9 @@ public class Punch : MonoBehaviour
|
||||
{
|
||||
cancelable = true;
|
||||
}
|
||||
|
||||
public void ReturnToMaxSpeed()
|
||||
{
|
||||
GetComponent<PlayerMovement>().maxSpeedOverride = GetComponent<PlayerMovement>().maxSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user