SimpleScript.OnTimerOptionsAttribute

SimpleScript.OnTimerOptionsAttribute Class

Set options for OnTimer() overrides, or use to create more simple timers.

Syntax

[Sansar.Script.Interface]
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false)]
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)]
protected class SimpleScript.OnTimerOptionsAttribute : SimpleScript.SimpleScriptOptionsAttribute

See Also

Remarks

This attribute is optional when overriding OnTimer which by default will run once per second.

Add this attribute to any method that matches Action<> to create extra timers.
C# Example
[OnTimerOptions(Rate=5)]
            void TimerEvery5()
            {
               // run every 5 seconds
            }
              
            void OnTimer()
            {
               // run every 1 second
            }

Example

C# Example
            // Run this timer every 5 seconds
            [OnTimerOptions(Rate=5)]
            protected override OnTimer()
            

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Members

See Also: Inherited members from SimpleScript.SimpleScriptOptionsAttribute.

Public Constructors

Public Fields

readonly
MinimumRate double . Minimum value for Rate is 0.025, which is 40 times per second.

Public Properties

 
Rate double . Set the rate in seconds between events.

Member Details

SimpleScript.OnTimerOptionsAttribute Constructor

 

Syntax

public SimpleScript.OnTimerOptionsAttribute ()

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

MinimumRate Field

Minimum value for Rate is 0.025, which is 40 times per second.

Syntax

[Sansar.Script.Interface]
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)]
public readonly double MinimumRate

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Rate Property

Set the rate in seconds between events.

Syntax

[Sansar.Script.Interface]
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)]
[get: Sansar.Script.Interface]
[set: Sansar.Script.Interface]
public double Rate { get; set; }

Value

The value in seconds between OnTimer events.

Remarks

A Rate of 1 would call OnTimer once every second, 0.1 would call OnTimer 10 times every second, and 10 would call OnTimer once every 10 seconds. Minimum value for Rate is 0.025, which is 40 times per second.

Example

C# Example
            // Set OnTimer to happen every 0.2 seconds.
            [OnTimerOptions(Rate=0.2)]
            protected override void OnTimer(Int64 frame)
            

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0


Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.