-
Notifications
You must be signed in to change notification settings - Fork 17
Trigger
Namespace: TommoJProductions.ModApi.Attachable
Represents a trigger for a part.
public class Trigger : IHasBolts
Inheritance Object → Trigger
Implements IHasBolts
Represents all loaded/created triggers. in GAME
public static List<Trigger> loadedTriggers;
Represents All Triggers that are in game. by trigger type (TriggerData) then by key (Trigger.triggerID)
public static Dictionary<TriggerData, Dictionary<string, Trigger>> triggerDictionary;
Represents the triggers name.
public string triggerID { get; }
Represents the trigger game object.
public GameObject gameObject { get; }
GameObject
Represents the trigger callback reference on the triggers gameobject.
public TriggerCallback callback { get; }
Represents the install point gameobject. the trigger and part pivot are children of this gameobject.
public GameObject installPoint { get; }
GameObject
Represents the parts pivot. parts that are installed to this trigger will be parented here when installed.
public GameObject partPivot { get; }
GameObject
Represents the triggers bolt parent. all bolts on the part that are only relevant to this trigger are parented to this gameobject. Null if no bolts are assigned to this trigger.
public GameObject boltParent { get; }
GameObject
Represents all for the trigger.
public virtual Bolt[] bolts { get; }
Represents if this trigger has any bolts!
public virtual bool hasBolts { get; }
Represents the triggers position.
public Vector3 triggerPosition { get; }
Vector3
Represents the triggers rotation.
public Vector3 triggerEuler { get; }
Vector3
Represents the triggers scale.
public Vector3 triggerSize { get; }
Vector3
Represents the pivot position.
public Vector3 pivotPosition { get; }
Vector3
Represents the pivot rotation.
public Vector3 pivotEuler { get; }
Vector3
Represents the triggers collider.
public SphereCollider collider { get; }
SphereCollider
Represents settings for the trigger.
public TriggerSettings settings { get; }
Initializes a new instance of trigger. Note, Make sure to set up the trigger! Trigger.initTrigger(GameObject, TriggerSettings)
public Trigger()
Initializes a new instance and creates a trigger at the provided position, rotation and scale.
public Trigger(GameObject parent, TriggerSettings settings, Bolt[] boltRefs)
parent
GameObject
The parent transform of the install point (part pivot and trigger).
settings
TriggerSettings
boltRefs
Bolt[]
Initializes the trigger.
public void initTrigger(GameObject parent, TriggerSettings settings)
parent
GameObject
The parent transform of the install point (part pivot and trigger).
settings
TriggerSettings
Trigger settings.
Gets trigger save info
public virtual TriggerSaveInfo getSaveInfo()
Changes . ()
public void enableTriggerCollider(bool enabled)
enabled
Boolean
Set enabled or not
Enables / Disables disassembly logic.
public void enableDisassemblyLogic(bool enabled)
enabled
Boolean
Set enabled or not
initializes bolts.
public virtual void initBolts(Bolt[] bolts)
bolts
Bolt[]
Exposes Trigger.onPartAssembledToTrigger's Action.Invoke() method.
internal void invokeAssembledEvent(Part assembledPart)
assembledPart
Part
Exposes Trigger.onPartDisassembledFromTrigger's Action.Invoke() method.
internal void invokeDisassembledEvent(Part disassembledPart)
disassembledPart
Part
Exposes Trigger.onPartPreAssembledToTrigger's Action.Invoke() method.
internal void invokePreAssembledEvent(Part assembledPart)
assembledPart
Part
Exposes Trigger.onPartPreDisassembledFromTrigger's Action.Invoke() method.
internal void invokePreDisassembledEvent(Part disassembledPart)
disassembledPart
Part
internal static void refreshCache()
Represents the on part assembled event. occurs when a part is assembled to this trigger (instance). occurs after assembly logic executes
public event Action<Trigger, Part> onPartAssembledToTrigger;
Represents the on part disassembled event. occurs when a part is disassembled from this trigger (instance). occurs after disassembly logic executes
public event Action<Trigger, Part> onPartDisassembledFromTrigger;
Represents the on part pre assembled event. occurs when a part is assembled to this trigger (instance). occurs after index of trigger is evaluated but before any assembly logic executes.
public event Action<Trigger, Part> onPartPreAssembledToTrigger;
Represents the on part pre disassembled event. occurs when a part is disassembled from this trigger (instance). occurs before any disassembly logic executes.
public event Action<Trigger, Part> onPartPreDisassembledFromTrigger;