Simple Script
SimpleScript Class
Extend SimpleScript to create a script that can be used on content that is natively in the scene. This is the primary script type in Sansar.
Syntax
[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", true)] public abstract class SimpleScript : Sansar.Script.ScriptBase
Member Details
SimpleScript Constructor
This constructor is called before any properties have been set. Override Sansar.Script.SimpleScript.SimpleInit() to initialize the script after properties have been set and events setup.
Syntax[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected SimpleScript ()
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
GetSubscription Method
Get the IEventSubscription for any of the registered event subscription methods
SyntaxParameters
methodName
The n
Returns
An IEventSubscription interface that can be used to unsubscribe from a registered event.
Remarks
Example
C# Example
|
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
Init Method
Init() initializes all event subscriptions for the overridable methods in SimpleScript
Syntax[Sansar.Script.Api] public override sealed void Init ()
See Also
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
ObjectPrivate Property
The ObjectPrivate this script is attached to if it is attached to an object.
Syntax[Sansar.Script.NonReflective] [get: Sansar.Script.Interface] public ObjectPrivate ObjectPrivate { protected get; set; }
Value
The scene object this script is attached to if it is attached to an object, null otherwise.
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
OnAddUser Method
Code in OnAddUser will run whenever a user enters the scene.
Syntax[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual void OnAddUser (AgentPrivate agent)
See Also
Parameters
agent
The AgentPrivate for the user that has joined the scene.
Remarks
Example
C# Example
|
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
OnChat Method
Code in OnChat will run whenever chat is heard.
Syntax[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual void OnChat (ChatData data)
See Also
Parameters
data
ChatData for the message.
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
OnCollision Method
Receive events whenever the object this script is on collides with something or someone.
Syntax[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual void OnCollision (CollisionData data)
See Also
Parameters
data
The CollisionData about the collision.
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
OnRemoveUser Method
Code in OnRemoveUser will run whenever a user leaves the scene.
Syntax[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual void OnRemoveUser (AgentInfo data)
See Also
Parameters
data
UserData for the user that has left the scene.
Remarks
Example
C# Example
|
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
OnScriptEvent Method
Receive events from other scripts.
Syntax[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual void OnScriptEvent (Sansar.Script.ScriptId sourceScriptId, object data)
See Also
Parameters
sourceScriptId
The Sansar.Script.ScriptId of the script that sent the message
data
The data sent by another script, as an object.
Remarks
Example
C# Example
|
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
OnTimer Method
Code in OnTimer will run at regular intervals.
Syntax[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual void OnTimer ()
Remarks
Example
C# Example
|
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
RigidBodyComponent Property
The first RigidBodyComponent on ObjectPrivate
Syntax[get: Sansar.Script.Interface] protected RigidBodyComponent RigidBodyComponent { get; }
Value
The first SimpleScript.RigidBodyComponent on the object this script is attached to.
RemarksThis is a convenience for:
C# Example
|
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
ScenePrivate Property
The Scene API for the Scene this script is a part of if the script is attached to scene content.
Syntax[Sansar.Script.NonReflective] [get: Sansar.Script.Interface] public ScenePrivate ScenePrivate { protected get; set; }
Value
The Scene API for this scene if this script was attached to scene content, null otherwise.
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
SimpleInit Method
Override SimpleInit for script setup, such as subscribing to other events or
Syntax[Sansar.Script.Interface] [System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] protected virtual void SimpleInit ()
Remarks
RequirementsNamespace: Sansar.Simulation Assembly: Sansar.Simulation (in Sansar.Simulation.dll) Assembly Versions: 1.1.0.0
Last updated