1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-14 22:15:41 +00:00
X10D/X10D.Unity.Tests/Assets/Tests/YieldInstructionIntegrationTests.cs

37 lines
1.1 KiB
C#

using System.Collections;
using UnityEngine;
namespace X10D.Unity.Tests
{
public class YieldInstructionIntegrationTests : MonoBehaviour
{
private void Start()
{
StartCoroutine(CO_WaitForAnyKeyDown());
StartCoroutine(CO_WaitForSpaceKeyDown());
StartCoroutine(CO_WaitForSpaceKeyUp());
}
private IEnumerator CO_WaitForAnyKeyDown()
{
Debug.Log("Waiting for any key to be pressed...");
yield return new WaitForKeyDown();
Debug.Log("Key was pressed!");
}
private IEnumerator CO_WaitForSpaceKeyDown()
{
Debug.Log("Waiting for Space key to be pressed...");
yield return new WaitForKeyDown(KeyCode.Space);
Debug.Log("Space key was pressed!");
}
private IEnumerator CO_WaitForSpaceKeyUp()
{
Debug.Log("Waiting for Space key to be released...");
yield return new WaitForKeyUp(KeyCode.Space);
Debug.Log("Space key was released!");
}
}
}