30 lines
597 B
C#
30 lines
597 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
namespace Scampz.GameJam.Assets.Scripts.Utilities
|
|
{
|
|
public class WaitForKeyDown : CustomYieldInstruction
|
|
{
|
|
private List<string> _inputOptions;
|
|
|
|
public override bool keepWaiting => !ShouldContinue();
|
|
|
|
public WaitForKeyDown(params string[] inputOptions)
|
|
{
|
|
_inputOptions = inputOptions.ToList();
|
|
}
|
|
|
|
private bool ShouldContinue()
|
|
{
|
|
foreach (var input in _inputOptions)
|
|
{
|
|
if (Input.GetButtonDown(input))
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|