Difference between revisions of "API:PartModule"
From Kerbal Space Program Wiki
(+use Fields and Methods; +Typing;) |
|||
Line 3: | Line 3: | ||
|name=PartModule | |name=PartModule | ||
|summary=The PartModule class allows you to override its functions to intuitively control your parts. | |summary=The PartModule class allows you to override its functions to intuitively control your parts. | ||
+ | |||
+ | '''The properties of this class have not been added.''' | ||
}} | }} | ||
− | === | + | === Example === |
− | |||
Called during the main menu loading stage. | Called during the main menu loading stage. | ||
<syntaxhighlight> | <syntaxhighlight> | ||
Line 19: | Line 20: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | {{ | + | |
+ | {{Fields| | ||
{{Field | {{Field | ||
|name=snapshot | |name=snapshot | ||
Line 37: | Line 39: | ||
|desc=The part state. | |desc=The part state. | ||
}} | }} | ||
− | + | }} | |
− | |||
+ | {{Methods| | ||
{{Method | {{Method | ||
|name=OnStart | |name=OnStart | ||
|returntype=void | |returntype=void | ||
− | |args=PartModule.StartState state | + | |args={{Type/Text|PartModule}}.{{Type|StartState}} state |
|desc=Called during the part startup. | |desc=Called during the part startup. | ||
}} | }} | ||
Line 52: | Line 54: | ||
|desc=Called when OnUpdate is called on the part. | |desc=Called when OnUpdate is called on the part. | ||
}} | }} | ||
− | |||
{{Method | {{Method | ||
Line 81: | Line 82: | ||
|name=OnLoad | |name=OnLoad | ||
|returntype=void | |returntype=void | ||
− | |args=ConfigNode node | + | |args={{Type|ConfigNode}} node |
|desc=Called when the object is loaded from a save. | |desc=Called when the object is loaded from a save. | ||
}} | }} | ||
Line 88: | Line 89: | ||
|name=OnSave | |name=OnSave | ||
|returntype=void | |returntype=void | ||
− | |args=ConfigNode node | + | |args={{Type|ConfigNode}} node |
|desc=Called when the object is saved. | |desc=Called when the object is saved. | ||
}} | }} | ||
Line 97: | Line 98: | ||
|desc=Get the part information. | |desc=Get the part information. | ||
}} | }} | ||
− | + | }} | |
[[Category:Community API Documentation]] | [[Category:Community API Documentation]] |
Revision as of 23:23, 24 April 2013
Contents
PartModule Class
Inherits | Implements |
---|---|
|
The PartModule class allows you to override its functions to intuitively control your parts.
The properties of this class have not been added.
Example
Called during the main menu loading stage.
using System; using UnityEngine; public class RandomPart : PartModule { public override void OnAwake() { Debug.Log("Hello World"); } }
Fields
The following is a list of fields in PartModule.
Signature | Description |
---|---|
ProtoPartModuleSnapshot snapshot | Unknown |
string moduleName | The modules name |
bool isEnabled | The part state. |
Methods
The following are methods included in PartModule.
Signature | Description |
---|---|
void OnStart(PartModule.StartState state) | Called during the part startup. |
void OnUpdate() | Called when OnUpdate is called on the part. |
void OnAwake() | Called when the part is loaded, this can be more than once. |
void OnFixedUpdate() | Per-PhysX frame update, Called only when the part is active! |
void OnActive() | Unknown |
void OnInactive() | Get the part information. |
void OnLoad(ConfigNode node) | Called when the object is loaded from a save. |
void OnSave(ConfigNode node) | Called when the object is saved. |
string GetInfo() | Get the part information. |