Wait for Seconds#
Control / Wait for Seconds
Description#
Waits for the specified amount of seconds
Parameters#
| Name | Description |
|---|---|
| Seconds | The time to wait in seconds |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Wait for Seconds")]
[Image(typeof(IconTimer), ColorTheme.Type.Blue)]
[Description("Waits for the specified amount of seconds")]
[Category("Control/Wait for Seconds")]
[Parameter("Seconds", "The time to wait in seconds")]
[Keywords("Hold", "Pause", "Idle")]
[Serializable]
public class InstructionCoreWaitForSeconds : Instruction
{
[SerializeField] private GetNumber m_Seconds = new GetNumber(1);
[SerializeField] private TimeMode m_Mode = TimeMode.GameTime;
protected override string GetTitle(GameObject source) => $"Wait {this.m_Seconds} seconds";
protected override async Awaitable Run(Args args)
{
float seconds = (float) this.m_Seconds.Get(args);
await this.WaitForSeconds(seconds, this.m_Mode);
}
}
}