-
Notifications
You must be signed in to change notification settings - Fork 16
Bolt
Namespace: TommoJProductions.ModApi.Attachable
The Base Bolt. All basic bolt function of a bolt. Overridable.
public class Boltif , scrolling on this bolt will do nothing.
public bool ignoreInput;The spanner wait time.
public static float spannerWaitTime;The rachet wait time.
public static float rachetWaitTime;The bolts settings.
public virtual BoltSettings settings { get; protected set; }The bolt waiting value. when true, the bolt has been tightened/loosened and is waiting for x amount of time base on the tool used before continuing to update the model transform, play the bolt audio, invoke events bolt tighten/loosen events.
public virtual bool wait { get; set; }The last scroll input.
public virtual int scrollInput { get; set; }The bolts tightness (0 - 8)
public virtual int tightness { get; set; }Returns true if this bolt is tight.
public virtual bool isTight { get; }Returns true if this bolt is loose.
public virtual bool isLoose { get; }The start position of the bolt.
public virtual Vector3 startPosition { get; set; }Vector3
The start rotation of the bolt.
public virtual Vector3 startEulerAngles { get; set; }Vector3
The position vector step (direction * step). How much and in what direction does the bolt move per tightness step.
public virtual Vector3 positionVectorStep { get; }Vector3
The rotation vector (direction * step). How much and in what direction does the bolt rotate per tightness step.
public virtual Vector3 rotationVectorStep { get; }Vector3
The max tightness of the bolt.
public virtual int maxTightness { get; }The Bolts ID
public string boltID { get; }The bolt model
public GameObject model { get; }GameObject
The callback
public BoltCallback callback { get; }the bolt func routine.
public Coroutine routine { get; }Coroutine
public Bolt()Assigns bolt values.
public Bolt(BoltSettings settings, Vector3 position, Vector3 eulerAngles)settings BoltSettings
the settings for the bolt.
position Vector3
the position of the bolt
eulerAngles Vector3
the rotation of the bolt.
Assigns bolt values.
public Bolt(int tightness, BoltSettings settings, Vector3 position, Vector3 eulerAngles)tightness Int32
The the tightness of the bolt.
settings BoltSettings
the settings for the bolt.
position Vector3
the position of the bolt
eulerAngles Vector3
the rotation of the bolt.
Waits specified time then updates model transform, invokes events, plays bolt sound.
virtual IEnumerator updateTightness(float waitTime, int tightness)waitTime Single
the wait time.
tightness Int32
the tightness.
IEnumerator
USAGE:
The bolt logic. runs continuously while looking at the bolt. Stops every bolt from having a UnityEngine Update call.
virtual IEnumerator boltFunction(BoltCallback bcb)bcb BoltCallback
The callback that invoked this.
IEnumerator
USAGE:
Steps the current step by 1 in either direction and returns the value. clamped between 0 - 8.
public virtual int stepTightness(int direction)direction Int32
Increase or decrease the tightness.
Assigns bolt values. (tightness, settings, start (initial) transform.
public virtual void init(int tightness, BoltSettings baseSettings, Vector3 position, Vector3 eulerAngles)tightness Int32
The tightness of the bolt.
baseSettings BoltSettings
the bolt settings.
position Vector3
the position of the bolt.
eulerAngles Vector3
the rotation of the bolt.
Sets up the bolt model base on the settings. (model type, transform)
protected virtual void setupBoltModel()Sets tightness and updates the model postion.
public virtual void setTightnessAndUpdateModel(int tightnessValue)tightnessValue Int32
bolt tightness
Updates the model position and rotation based on start and tightness values.
public virtual void updateModelPosition()Initializes this bolt. setups model and sets the parent to param, .
public virtual void createBolt(int tightness, Transform parent)tightness Int32
bolt tightness
parent Transform
The parent of the bolt.
Destorys the bolt.
public virtual void destoryBolt()De/Activates the model.
public virtual void activateBolt(bool active)active Boolean
activate or not.
Enables / Disables bolt logic.
public virtual void enableBoltLogic(bool enabled)enabled Boolean
Set enabled or not
On mouse enter. Starts the bolt coroutine and sets Bolt.routine to that coroutine.
public virtual void bcb_mouseEnter(BoltCallback bcb)bcb BoltCallback
The callback that invoked the bolt mouse enter event.
On mouse exit. Stops the bolt coroutine and sets Bolt.routine to .
public virtual void bcb_mouseExit(BoltCallback bcb)bcb BoltCallback
The callback that invoked the mouse exit event.
Invokes the Bolt.onScrew event.
public virtual void invokeOnScrew()Invokes the Bolt.onTight event.
public virtual void invokeOnTight()Invokes the Bolt.onLoose event.
public virtual void invokeOnLoose()Invokes the Bolt.outTight event.
public virtual void invokeOutTight()Invokes the Bolt.outLoose event.
public virtual void invokeOutLoose()Vaildiates bolts after bolts have been initialized.
public static bool validateBolts(Bolt[] bolts)bolts Bolt[]
Boolean
returns true if no errors were detected with the bolts.
Exception
Throws an exception is any issues were detected. to prevent part from initializing.
Gets bolt save info in an array.
public static Int32[] getBoltSaveInfo(Bolt[] bolts, bool hasBolts)bolts Bolt[]
hasBolts Boolean
Int32[]
All tightness values in an int array.
Represents the post onscrew event. occurs when this bolt is screwed in or out. called after all other bolt events are called. Bolt.onLoose, Bolt.onTight.
public event Action onScrew;Represents the on tight event. occurs when this bolt becomes tight (screwed to tight state)
public event Action onTight;Represents the on loose event. occurs when this bolt becomes loose (screwed to loose state)
public event Action onLoose;Represents the out tight event. occurs when this bolt was tight but was screw out. (screwed from tight state)
public event Action outTight;Represents the out loose event. occurs when this bolt was loose but was screw in (screwed from loose state)
public event Action outLoose;