C# Class FreeFlight, Unity-Free-Flight

Inheritance: MonoBehaviour
Datei anzeigen Open project: NickolausDS/Unity-Free-Flight Class Usage Examples

Public Properties

Property Type Description
applyFlightPhysicsOnGround bool
crashSoundClip UnityEngine.AudioClip
crashSpeed float
directionalSensitivity float
divingSoundClip UnityEngine.AudioClip
enabledCrashing bool
enabledDiving bool
enabledFlapping bool
enabledFlaring bool
enabledGliding bool
enabledGround bool
enabledJumping bool
enabledLanding bool
enabledLaunchIfAirborn bool
enabledTakeoff bool
enabledWindNoise bool
flapSoundClip UnityEngine.AudioClip
flapStrength float
flareAngle float
flareSoundClip UnityEngine.AudioClip
flareSpeed float
groundDrag float
jumpHeight float
jumpingNoiseClip UnityEngine.AudioClip
landingSoundClip UnityEngine.AudioClip
launchTime float
maxGroundForwardSpeed float
maxGroundTurningDegreesSecond float
maxPitch float
maxStandUpTime float
maxTurnBank float
minHeightToLaunchIfAirborn float
standUpSpeed float
takeoffSoundClip UnityEngine.AudioClip
walkingNoiseClip UnityEngine.AudioClip
windNoiseClip UnityEngine.AudioClip
windNoiseMaxSpeed float
windNoiseStartSpeed float

Protected Properties

Property Type Description
_inputDiving bool
_inputFlap bool
_inputFlaring bool
_inputInvertedSetting int
_inputJump bool
_inputTakeoff bool

Private Properties

Property Type Description
applyGroundInputs void
getFlightInputs void
getGroundInputs void
groundMove void
jump void
land void
launchIfAirborn void
timedLaunch void

Public Methods

Method Description
Awake ( ) : void
FixedUpdate ( ) : void

In relation to Update() this is where we decide how to act on the user input, then compute the physics and animation accordingly

Start ( ) : void
Update ( ) : void

Get input from the player

applyFlightInputs ( ) : void
isFlying ( ) : bool
isGrounded ( ) : bool

Protected Methods

Method Description
OnCollisionEnter ( Collision col ) : void
applyWindNoise ( ) : void
dive ( ) : void
flap ( ) : void
flare ( ) : void
getBank ( ) : float
getPitch ( bool flare ) : float

Calculates pitch, based on user input and configured pitch parameters.

playSound ( AudioSource source ) : void
setupSound ( AudioClip sound, AudioSource &source ) : AudioSource

Sets up the audio component for the sound source. Does nothing if the source already exists and has a clip.

standUp ( ) : IEnumerator

Straightenes the flight object on landing, by rotating the roll and pitch to zero over time. Public vars "standUpSpeed" and "maxStandUpTime" can be used to tweak behaviour.

takeoff ( bool flapLaunch = false ) : void

Set the state to flying and enable flight physics. Optionally, flapLaunch can be set to true to apply a "flap" to help get the object off the ground.

Private Methods

Method Description
applyGroundInputs ( ) : void
getFlightInputs ( ) : void
getGroundInputs ( ) : void
groundMove ( ) : void
jump ( ) : void
land ( ) : void
launchIfAirborn ( float minHeight ) : void

Launchs if airborn.

timedLaunch ( bool triggerSet ) : void

Calls takeoff() after "triggerSet" has been true for "launchTime". This method needs to be called in Update or FixedUpdate to work properly.

Method Details

Awake() public method

public Awake ( ) : void
return void

FixedUpdate() public method

In relation to Update() this is where we decide how to act on the user input, then compute the physics and animation accordingly
public FixedUpdate ( ) : void
return void

OnCollisionEnter() protected method

protected OnCollisionEnter ( Collision col ) : void
col Collision
return void

Start() public method

public Start ( ) : void
return void

Update() public method

Get input from the player
public Update ( ) : void
return void

applyFlightInputs() public method

public applyFlightInputs ( ) : void
return void

applyWindNoise() protected method

protected applyWindNoise ( ) : void
return void

dive() protected method

protected dive ( ) : void
return void

flap() protected method

protected flap ( ) : void
return void

flare() protected method

protected flare ( ) : void
return void

getBank() protected method

protected getBank ( ) : float
return float

getPitch() protected method

Calculates pitch, based on user input and configured pitch parameters.
protected getPitch ( bool flare ) : float
flare bool If set to true calculates pitch of a flare angle.
return float

isFlying() public method

public isFlying ( ) : bool
return bool

isGrounded() public method

public isGrounded ( ) : bool
return bool

playSound() protected method

protected playSound ( AudioSource source ) : void
source UnityEngine.AudioSource
return void

setupSound() protected method

Sets up the audio component for the sound source. Does nothing if the source already exists and has a clip.
protected setupSound ( AudioClip sound, AudioSource &source ) : AudioSource
sound UnityEngine.AudioClip Sound.
source UnityEngine.AudioSource Source.
return UnityEngine.AudioSource

standUp() protected method

Straightenes the flight object on landing, by rotating the roll and pitch to zero over time. Public vars "standUpSpeed" and "maxStandUpTime" can be used to tweak behaviour.
protected standUp ( ) : IEnumerator
return IEnumerator

takeoff() protected method

Set the state to flying and enable flight physics. Optionally, flapLaunch can be set to true to apply a "flap" to help get the object off the ground.
protected takeoff ( bool flapLaunch = false ) : void
flapLaunch bool If set to true flap launch.
return void

Property Details

_inputDiving protected_oe property

protected bool _inputDiving
return bool

_inputFlap protected_oe property

protected bool _inputFlap
return bool

_inputFlaring protected_oe property

protected bool _inputFlaring
return bool

_inputInvertedSetting protected_oe property

protected int _inputInvertedSetting
return int

_inputJump protected_oe property

protected bool _inputJump
return bool

_inputTakeoff protected_oe property

protected bool _inputTakeoff
return bool

applyFlightPhysicsOnGround public_oe property

public bool applyFlightPhysicsOnGround
return bool

crashSoundClip public_oe property

public AudioClip,UnityEngine crashSoundClip
return UnityEngine.AudioClip

crashSpeed public_oe property

public float crashSpeed
return float

directionalSensitivity public_oe property

public float directionalSensitivity
return float

divingSoundClip public_oe property

public AudioClip,UnityEngine divingSoundClip
return UnityEngine.AudioClip

enabledCrashing public_oe property

public bool enabledCrashing
return bool

enabledDiving public_oe property

public bool enabledDiving
return bool

enabledFlapping public_oe property

public bool enabledFlapping
return bool

enabledFlaring public_oe property

public bool enabledFlaring
return bool

enabledGliding public_oe property

public bool enabledGliding
return bool

enabledGround public_oe property

public bool enabledGround
return bool

enabledJumping public_oe property

public bool enabledJumping
return bool

enabledLanding public_oe property

public bool enabledLanding
return bool

enabledLaunchIfAirborn public_oe property

public bool enabledLaunchIfAirborn
return bool

enabledTakeoff public_oe property

public bool enabledTakeoff
return bool

enabledWindNoise public_oe property

public bool enabledWindNoise
return bool

flapSoundClip public_oe property

public AudioClip,UnityEngine flapSoundClip
return UnityEngine.AudioClip

flapStrength public_oe property

public float flapStrength
return float

flareAngle public_oe property

public float flareAngle
return float

flareSoundClip public_oe property

public AudioClip,UnityEngine flareSoundClip
return UnityEngine.AudioClip

flareSpeed public_oe property

public float flareSpeed
return float

groundDrag public_oe property

public float groundDrag
return float

jumpHeight public_oe property

public float jumpHeight
return float

jumpingNoiseClip public_oe property

public AudioClip,UnityEngine jumpingNoiseClip
return UnityEngine.AudioClip

landingSoundClip public_oe property

public AudioClip,UnityEngine landingSoundClip
return UnityEngine.AudioClip

launchTime public_oe property

public float launchTime
return float

maxGroundForwardSpeed public_oe property

public float maxGroundForwardSpeed
return float

maxGroundTurningDegreesSecond public_oe property

public float maxGroundTurningDegreesSecond
return float

maxPitch public_oe property

public float maxPitch
return float

maxStandUpTime public_oe property

public float maxStandUpTime
return float

maxTurnBank public_oe property

public float maxTurnBank
return float

minHeightToLaunchIfAirborn public_oe property

public float minHeightToLaunchIfAirborn
return float

standUpSpeed public_oe property

public float standUpSpeed
return float

takeoffSoundClip public_oe property

public AudioClip,UnityEngine takeoffSoundClip
return UnityEngine.AudioClip

walkingNoiseClip public_oe property

public AudioClip,UnityEngine walkingNoiseClip
return UnityEngine.AudioClip

windNoiseClip public_oe property

public AudioClip,UnityEngine windNoiseClip
return UnityEngine.AudioClip

windNoiseMaxSpeed public_oe property

public float windNoiseMaxSpeed
return float

windNoiseStartSpeed public_oe property

public float windNoiseStartSpeed
return float