C# Class ProjectStorms.AirshipControlBehaviour

This is the basic airship control. It manages pitch, yaw, and roll. Syncs up to ship animations. In time this script will probably be changed a lot. Many of the movement features here were expanded upon and derived from the Unity Standard Vehicle Assets - Plane Controller. Unlike the old Storms Project, this game moves Non-Kinematic Rigidbodies through Physics (unlike Kinematic Rigidbody via direct control).
Inheritance: UnityEngine.MonoBehaviour
Mostra file Open project: patferguson/Storms-Project Class Usage Examples

Public Properties

Property Type Description
adjustableMass float
airshipMainCam AirshipCamBehaviour
animLowThrottleMult float
animThrottleMult float
audioControl AirshipAudio
engineAudioControl EngineAudio
generalSpeed float
highControlMult float
highControlSpeedThreshold float
killY float
pitchForce float
pitchLimitMult float
reverseSpeedMult float
rollForce float
rollLimitMult float
rudderJoint HingeJointScript
shipPartConns ShipPartInputConnection[]
stallY float
trapdoorRumbleCooldown float
yawForce float

Public Methods

Method Description
Awake ( ) : void
ClearPropellerAnim ( ) : void
FixedUpdate ( ) : void
OnTriggerStay ( Collider a_other ) : void

Called each physics tick that other objects are colliding with this trigger.

PlayerInputs ( float a_Vertical, float a_Horizontal, float a_camVertical, float a_camHorizontal, float a_triggers, bool a_bumperLeft, bool a_bumperRight, bool a_faceUp, bool a_faceDown, bool a_faceLeft, bool a_faceRight, float a_dPadHorizontal, float a_dPadVertical ) : void
Start ( ) : void
TrapdoorRumblePulse ( ) : void

Executes a pulse of rumble, repeats if button is still held down.

Update ( ) : void
Vibrate ( ) : void

Private Methods

Method Description
CalcHandlingMassMult ( ) : float

Calculates the multiplier for ship handling values (throttle, roll, pitch, yaw, etc.).

CalculateRightingForce ( ) : void

Attempts to auto-level the player's ship. Counters roll more-so than pitch, ignores yaw.

CalculateTorque ( ) : void

Calculates the rotation forces on the ship, see the standard assets example for more.

ClampInputs ( ) : void

Clamps the input values into the [-1, 1] range.

GetPartInputMults ( ShipPartDestroy a_partType, float &ao_primMult, float &ao_auxMult ) : bool

Returns the part input multipliers for the input ship part type.

TestVerticalLimits ( ) : void
ThrottleMovement ( ) : void

Moves the player's ship forward with either their constant movement speed or their inputted throttle.

Method Details

Awake() public method

public Awake ( ) : void
return void

ClearPropellerAnim() public method

public ClearPropellerAnim ( ) : void
return void

FixedUpdate() public method

public FixedUpdate ( ) : void
return void

OnTriggerStay() public method

Called each physics tick that other objects are colliding with this trigger.
public OnTriggerStay ( Collider a_other ) : void
a_other UnityEngine.Collider
return void

PlayerInputs() public method

public PlayerInputs ( float a_Vertical, float a_Horizontal, float a_camVertical, float a_camHorizontal, float a_triggers, bool a_bumperLeft, bool a_bumperRight, bool a_faceUp, bool a_faceDown, bool a_faceLeft, bool a_faceRight, float a_dPadHorizontal, float a_dPadVertical ) : void
a_Vertical float
a_Horizontal float
a_camVertical float
a_camHorizontal float
a_triggers float
a_bumperLeft bool
a_bumperRight bool
a_faceUp bool
a_faceDown bool
a_faceLeft bool
a_faceRight bool
a_dPadHorizontal float
a_dPadVertical float
return void

Start() public method

public Start ( ) : void
return void

TrapdoorRumblePulse() public method

Executes a pulse of rumble, repeats if button is still held down.
public TrapdoorRumblePulse ( ) : void
return void

Update() public method

public Update ( ) : void
return void

Vibrate() public method

public Vibrate ( ) : void
return void

Property Details

adjustableMass public_oe property

Change the mass of the Airship in editor here
public float adjustableMass
return float

airshipMainCam public_oe property

Handle to the airship camera script.
public AirshipCamBehaviour,ProjectStorms airshipMainCam
return AirshipCamBehaviour

animLowThrottleMult public_oe property

Percentage of the base propeller animation speed to apply when braking.
public float animLowThrottleMult
return float

animThrottleMult public_oe property

Percentage of the base propeller animation speed to apply when moving.
public float animThrottleMult
return float

audioControl public_oe property

Bounce the input variables to the Audio Controller script under 'Particles and Effects' hierarchy branch.
public AirshipAudio,ProjectStorms audioControl
return AirshipAudio

engineAudioControl public_oe property

public EngineAudio,ProjectStorms engineAudioControl
return EngineAudio

generalSpeed public_oe property

Movement speed of the airship. Try 50 here and see how we go.
public float generalSpeed
return float

highControlMult public_oe property

Multiplier for each contro axis when moving slowly.
public float highControlMult
return float

highControlSpeedThreshold public_oe property

Speed threshold to consider for high control multipliers.
public float highControlSpeedThreshold
return float

killY public_oe property

If the player ship goes below this, they will die.
public float killY
return float

pitchForce public_oe property

How much pitching the vehicle will affect its facing.
public float pitchForce
return float

pitchLimitMult public_oe property

Multiplier for the pitch auto-level force.
public float pitchLimitMult
return float

reverseSpeedMult public_oe property

Speed multiplier for the reverse throttle value.
public float reverseSpeedMult
return float

rollForce public_oe property

How much rolling the vehicle will affect its facing.
public float rollForce
return float

rollLimitMult public_oe property

Multiplier for the pitch auto-level force.
public float rollLimitMult
return float

rudderJoint public_oe property

Reference to rudder joint script, for inversing rudder rotation while reversing.
public HingeJointScript,ProjectStorms rudderJoint
return HingeJointScript

shipPartConns public_oe property

Multiplier values for when various ship parts get destroyed.
public ShipPartInputConnection[] shipPartConns
return ShipPartInputConnection[]

stallY public_oe property

If the player ship goes above this, they will stall.
public float stallY
return float

trapdoorRumbleCooldown public_oe property

Time to wait between each drop rumble pulse.
public float trapdoorRumbleCooldown
return float

yawForce public_oe property

How much yawing the vehicle will affect its facing.
public float yawForce
return float