// Update is called once per frame void Update() { if (!initialized) { return; } // Check for delayed commands int i = 0; while (i < delayedCommands.Count) { AuroraCommand cmd = delayedCommands[i]; cmd.curTime += Time.deltaTime; if (cmd.curTime >= cmd.delay) { // Show time delayedCommands.RemoveAt(i); ExecuteCommand(cmd); } else { i++; } } }
public void DelayCommand(AuroraObject owner, float delay, NCSContext context) { AuroraCommand cmd = new AuroraCommand(); cmd.obj = owner; cmd.context = context; cmd.delay = delay; if (owner == null) { throw new Exception("Cannot delay command on a null object"); } delayedCommands.Add(cmd); }
public void ExecuteCommand(AuroraCommand cmd) { // Run the script with context = cmd.context //Debug.Log("Running command from script " + cmd.context.script.scriptName + " on " + cmd.obj); Execute(cmd.obj, cmd.context.script, cmd.context, -1); }