How To: Create an Updated, Repeated, or Timed Activity

Original Source CaptainCheerios

To create a method that is run at a set interval of time you need to use the RepeatedSimpleMethodCommand class.

So first is Using Visual3D.Activities; so you can get access to this class

now create a new class
so (public/private) Activities.RepeatedSimpleMethodCommand UpdatedMethod;
you also need a TimeInterval, a simple class that contains the interval time.
so i used: public TimeInterval MyTimeInterval = new TimeInterval(1000);
this way the method occurs every second.

Now for a test class
public void HelloWorld()
{
SSystem.ShowCaption("Hello World");
}

you then need to setup the UpdatedMethod. So do this:
public void StartTheRepeat()
{
UpdatedMethod = new Activities.RepeatedSimpleMethodCommand("UpdatedMethod", MyTimeInterval, HelloWorld);
UpdatedMethod.Initialize();
UpdatedMethod.Activate();
}
now call StartTheRepeat() and every second you will display hello world.
new Activities.RepeatedSimpleMethodCommand( String Name, TimeInterval Interval, method)

you also have methods for the RepeatedSimplestMethodCommand such as:
Deactivate - This will stop the method from repeating
Dispose - Removes a prior repeated event if stored
Note: if UpdatedMethod is empty and you try to dispose you will encounter bugs in the editor.

There are other activity classes found in the Visual3D.Activities namespace for different times of time-based (delayed, countdown, update, etc.) activities, and which with different delegate types (method parameters) or interfaces (like IUpdated).

Entity and derived classes like SceneObject, Actor, Scene, Control, GuiForm, etc. have a Scheduler property which also provides other methods for scheduling delayed, repeated, etc. commands and activities.