Class TrainzGameObject
From TrainzOnline
- API Hierarchy
- GSObject
- GameObject
- Class TrainzGameObject
- GameObject
- GSObject
- Base class for a GameObject that is an instance of a Trainz asset.
Init
public void Init(void)
public void Init(Asset asset)
public void Init(Asset asset)
- Parameters
- asset = Reference to the script's associated asset.
- Returned Value
- None
- Syntax
- None, method is automatically called by the game.
- Notes
- Initialisation method which is called by Trainz when the object is first created.
- It is up to the script programmer to do any initialization tasks required here.
- This may include starting monitor threads, adding message handlers, and so on.
- Some derived classes have both an Init() and Init(Asset) method. It is recommended that you use the Init(Asset) version whenever you can.
- Uses the 'mandatory' keyword, meaning you must call inherited() when overriding this function.
- Since Init() is called from native Trainz code, you cannot use Sleep() or wait(). However, Init() can start threaded methods that are allowed to sleep and process messages.
GetAsset
public Asset GetAsset(void)
- Parameters
- None
- Returned Value
- A reference to the owning asset.
- Syntax
Asset asset = GetAsset();
- Notes
- The returned Asset reference can be used to retrieve the KUID, StringTable or configuration data of the Asset.