Cease v0.5
This commit is contained in:
@@ -1,29 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts.Utilities
|
||||
{
|
||||
public class WaitForKeyDown : CustomYieldInstruction
|
||||
{
|
||||
private List<string> _inputOptions;
|
||||
private InputAction _inputAction;
|
||||
|
||||
public override bool keepWaiting => !ShouldContinue();
|
||||
|
||||
public WaitForKeyDown(params string[] inputOptions)
|
||||
public WaitForKeyDown(InputAction inputAction)
|
||||
{
|
||||
_inputOptions = inputOptions.ToList();
|
||||
_inputAction = inputAction;
|
||||
}
|
||||
|
||||
private bool ShouldContinue()
|
||||
{
|
||||
foreach (var input in _inputOptions)
|
||||
{
|
||||
if (Input.GetButtonDown(input))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return _inputAction.triggered;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user