Detailed Description
The base thruster that contains all common functionalities. All helpers and controllers work only with this class, this way are compatible with all thruster types.
Common features are:
- ignition state (on/off)
- throttle (current and min/max)
- faults (states that disable the engine)
- common helper functions
Member Data Documentation
◆ accelerationThrottlePerFrame
float BArtisan.Thrusters.BThrusterBase.accelerationThrottlePerFrame = 1f |
Default throttle update value for each time the Accelerate() function is called. Save value is used for Decelerate() but with a negative sign.
◆ debugLog
|
inherited |
Enable to debug this component. Warning: it may result in CPU intensive debug messages (each frame).
Property Documentation
◆ MinThrottle
|
getset |
Minimum value (inclusive) of the throttle/engine power. Non-zero if you want the object never to be still.
◆ MaxThrottle
|
getset |
Maximum value (inclusive) of the throttle/engine power.
◆ IgnitionOn
|
getset |
Ignition state of the thruster. If on means the throttle can be applied (if no faults are present).
◆ NormalizedThrottle
|
getset |
Get the current throttle value as a value between 0-1 (based on the min/max/current throttle).
◆ Normalized100Throttle
|
getset |
Get the current throttle value as a value between 0-100 (based on min/max/current throttle).
◆ Throttle
|
getset |
The current raw value of the throttle. It is always clamped between min/max.
◆ acceleratedThisFrame
|
get |
Flag used to keep track if any controller accelerated (at least once) during the current frame.
Member Function Documentation
◆ TurnOn()
|
virtual |
Turn on the thruster (set the ignition on).
Referenced by BArtisan.Thrusters.Helpers.Controllers.BThrusterKeyController.Accelerate().
◆ TurnOff()
|
virtual |
Turn off the thruster (set the ignition off).
Referenced by BArtisan.Thrusters.Helpers.Controllers.BThrusterKeyController.Accelerate().
◆ ToggleOnOff()
|
virtual |
Toggle the ignition, if it is On it will turn it off and viceversa.
Referenced by BArtisan.Thrusters.Helpers.Controllers.BThrusterKeyController.Accelerate().
◆ IsTurnedOnAndHasNoFaults()
|
virtual |
Checks if the engine is actually running. The ignition must be on and free of problems.
- Returns
- true if the engine is working and there are no faults
◆ IsTurnedOn()
|
virtual |
The ignition is on, thruster is powered. It does NOT guarantee the thruster is working, see faults.
- Returns
◆ IsTurnedOff()
|
virtual |
The ignition is off, thruster is not powered on.
- Returns
◆ HasFaults()
|
virtual |
Checks if the thruster has any problems/faults.
- Returns
- true if the thruster is temporarily broken.
◆ IsFreeOfFaults()
|
virtual |
Checks if the engine is free of problems/faults.
- Returns
◆ AddFault()
|
virtual |
Add a new problem to this engine. It disables the engine until all the problems are removed.
- Parameters
-
faultUniqueID Each problem must have an unique string id.
Referenced by BArtisan.Thrusters.Helpers.Faults.BThrusterHelperFault.AddFault().
◆ RemoveFault()
|
virtual |
Remove a fault (problem). If the fault was the last one (in the list), and the ignition is on the thruster will resume it's effect.
- Parameters
-
faultUniqueID Each problem must have an unique string id.
Referenced by BArtisan.Thrusters.Helpers.Faults.BThrusterHelperFault.RemoveFault().
◆ RemoveAllFaults()
|
virtual |
Remove all current faults, restoring the thruster to its original state.
◆ GetFaults()
|
virtual |
Get a list of all current fault ID's.
- Returns
- fault list clone with ID's.
◆ Accelerate()
|
virtual |
Increase the thruster throttle with the accelerationThrottlePerFrame. To modify the throttle with a specific value use AddThrottle(); The new value is always clamped between min and max throttle values.
Referenced by BArtisan.Thrusters.Helpers.Controllers.BThrusterKeyController.Accelerate().
◆ AddThrottle()
|
virtual |
Add (positive value) or substract (negative value) the throttle value. The new value is always clamped between min and max throttle values.
- Parameters
-
addValue Positive to increase, negative to decrease the throttle.
◆ Decelerate()
|
virtual |
Decrease the thruster throttle with the accelerationThrottlePerFrame. To modify the throttle with a specific value use AddThrottle();
Referenced by BArtisan.Thrusters.Helpers.Controllers.BThrusterKeyController.Accelerate().
◆ SetThrottle()
|
virtual |
Set a new value of the throttle. The new value is always clamped between min and max throttle values.
- Parameters
-
newValue
◆ SetThrottleNormalizedValue()
|
virtual |
Set a new value of the throttle, based on a percent unit interval 0-1. The throttle value will be relative of min/max.
- Parameters
-
newNormalized 0 will set the throttle to the minimum value, 0.5f at half and 1f at maximum.
◆ SetThrottle100Value()
|
virtual |
Set a new value of the throttle, based on a percent interval 0-100. /// The throttle value will be relative of min/max.
- Parameters
-
newNormalized 0 to set the minimum value, 50 to half and 100 to maximum.
◆ SetMinimumThrottle()
|
virtual |
Set the throttle to it's minimum value (see MinThrottle). Usually min is 0 and this command is used for Stop.
Referenced by BArtisan.Thrusters.Helpers.Controllers.BThrusterKeyController.Accelerate(), and BArtisan.Thrusters.Helpers.Controllers.BThrusterContinuousController.RestartCoroutine().
◆ SetMaximumThrottle()
|
virtual |
Set the throttle to it's maximum value (see MaxThrottle). Full speed ahead!
Referenced by BArtisan.Thrusters.Helpers.Controllers.BThrusterKeyController.Accelerate(), and BArtisan.Thrusters.Helpers.Controllers.BThrusterContinuousController.RestartCoroutine().
◆ GetThrottle()
|
virtual |
Get the throttle raw value (absolute).
- Returns
◆ IsAtMinimumThrottle()
|
virtual |
Easy check if the throttle value is equal to MinThrottle.
- Returns
- boolean
◆ IsAtMaximumThrottle()
|
virtual |
Easy check if the throttle value is equal to MaxThrottle.
- Returns
- boolean