Documentation for the Unity C# Library
Loading...
Searching...
No Matches
SetTimer.cs
Go to the documentation of this file.
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using UnityEngine;
5
6namespace PixoVR.Event
7{
11 public class SetTimer : IStep
12 {
13 public event Action OnFunctionFinished;
14
15 public void StartStep(StepItem stepItem, StepFunction function, List<InteractableClass> interactables = null,
16 Action onStepSkipped = null)
17 {
18 if (interactables == null) return;
19
20 foreach (var interactable in interactables)
21 {
22 if (string.IsNullOrEmpty(function.value))
23 {
24 Debug.LogError("seconds value is empty");
25
26 return;
27 }
28
29 var seconds = float.Parse(function.value, System.Globalization.CultureInfo.InvariantCulture);
30
31 interactable.SetTimer(seconds);
32 }
33
35 }
36
37 public void FunctionFinished()
38 {
39 OnFunctionFinished?.Invoke();
40 }
41 }
42}
Function of cyclically launching the method after some time specified in the steplist.
Definition SetTimer.cs:12
void StartStep(StepItem stepItem, StepFunction function, List< InteractableClass > interactables=null, Action onStepSkipped=null)
Definition SetTimer.cs:15
void FunctionFinished()
Called to end current step and start a next one.
Definition SetTimer.cs:37
Action OnFunctionFinished
Definition SetTimer.cs:13
[Serializable]
Definition StepItem.cs:12
Basic interface of functions. (Please note that iStep is a wrong name)
Definition IStep.cs:10