Modular First Person Player 1.0.2.7
Loading...
Searching...
No Matches
MFPP.Player Class Reference

Classes

class  CameraSettings
 
class  CollisionSettings
 Player collision settings. More...
 
class  ControlSettings
 Player input controls settings. More...
 
class  FootstepSettings
 Player footstep settings. More...
 
class  MainSettings
 Main player settings. More...
 
class  MovementSettings
 Player movement settings. More...
 
class  Settings
 Base class for player settings. More...
 

Public Member Functions

delegate void OnAiredHandler ()
 Event delegate when the character just aired.
 
delegate void OnLandedHandler (Vector3 velocity)
 Event delegate when the character just landed.
 
delegate void OnFootstepHandler (AudioClip footstep, float volume, float pitch)
 Event delegate when the character just emitted a footstep.
 
delegate void BeforeFinalMovementHandler (Vector3 finalMovement)
 Event delegate just before applying the final movement.
 
delegate void AfterFinalMovementHandler (Vector3 finalMovement)
 Event delegate just after applying the final movement.
 
delegate void CollisionDetectedHandler (ControllerColliderHit hit)
 Event delegate when a collision with this Player is detected.
 
void AddForce (Vector3 force)
 Adds a force to this Player.
 
void AddImpulse (Vector3 impulse)
 Adds an impulse to this Player.
 
void TeleportTo (Vector3 position, bool resetVelocity=true)
 Teleports the player to a specified position.
 
void EmitFootstepSound ()
 Emits a footstep sound.
 
void EmitJumpSound ()
 Emits a jumping sound.
 
void EmitLandSound (float velocityMagnitude)
 Emits a landing sound.
 

Protected Member Functions

virtual void BeforeUpdate ()
 Executed before the Update.
 
virtual void AfterUpdate ()
 Executed after the Update.
 
void DoMouse ()
 Mouse movement.
 
void DoMovement ()
 Character movement.
 
void UpdateHeight ()
 Update the height of the Player.
 
void DoMisc ()
 
void DoFootsteps ()
 Footstep updating.
 
float GetAxis (string axisName)
 Similar to Input.GetAxis(string) but also taking into account ControlSettings.ControlsEnabled.
 
float GetAxisRaw (string axisName)
 Similar to Input.GetAxisRaw(string) but also taking into account ControlSettings.ControlsEnabled.
 
float GetCurrentAxis (string axisName)
 Returns the current axis value, based on whetever we use ControlSettings.RawInput and also taking into account ControlSettings.ControlsEnabled.
 
bool GetButton (string buttonName)
 Similar to Input.GetButton(string) but also taking into account ControlSettings.ControlsEnabled.
 
bool GetButtonDown (string buttonName)
 Similar to Input.GetButtonDown(string) but also taking into account ControlSettings.ControlsEnabled.
 
bool GetButtonUp (string buttonName)
 Similar to Input.GetButtonUp(string) but also taking into account ControlSettings.ControlsEnabled.
 
Vector3 AirAccelerate (Vector3 wishDir, Vector3 velocity, float accelerate)
 Applies air accelerate for a certain wished direction and the current velocity we're going at.
 

Properties

IEnumerable< PlayerModuleModules [get]
 All of the modules attached to this Player.
 
MainSettings Main [get, set]
 Main settings.
 
CameraSettings CameraExtras [get, set]
 Extra camera settings.
 
ControlSettings Controls [get, set]
 Control input settings.
 
CollisionSettings Collisions [get, set]
 Collision settings.
 
MovementSettings Movement [get, set]
 Character movement settings.
 
FootstepSettings Footstep [get, set]
 Footstep sounds settings.
 
CharacterController CharacterController [get]
 The attached UnityEngine.CharacterController to this Player.
 
float MinMoveDistance [get, set]
 The minimum move distance of this CharacterController, same as UnityEngine.CharacterController.minMoveDistance
 
float Radius [get, set]
 The radius of this CharacterController, same as UnityEngine.CharacterController.radius
 
float RadiusWithSkinWidth [get]
 The radius combined with the skin width of this CharacterController
 
float SkinWidth [get, set]
 The skin width of this CharacterController, same as UnityEngine.CharacterController.skinWidth
 
float SlopeLimit [get, set]
 The slope limit in degrees of this CharacterController, same as UnityEngine.CharacterController.slopeLimit
 
float StepOffset [get, set]
 The step offset in meters of this CharacterController, same as UnityEngine.CharacterController.stepOffset
 
Vector2 LookAngles [get, set]
 The look angles of the Player.
 
Vector2 LookAnglesDelta [get, set]
 The look angles delta of the Player.
 
Vector2 TargetLookAngles [get, set]
 The target look angles of the Player unaffected by mouse smoothing.
 
Vector3 DesiredMovement [get, protected set]
 The desired movement of the Player in local space.
 
Vector3 DesiredWorldMovement [get, protected set]
 The desired movement of the Player in world space.
 
Vector3 NormalizedDesiredMovement [get, protected set]
 The normalized desired movement of the Player in local space.
 
Vector3 NormalizedDesiredWorldMovement [get, protected set]
 The normalized desired movement of the Player in world space.
 
Vector3 FinalMovement [get, set]
 The final movement of the Player when calling UnityEngine.CharacterController.Move(Vector3)
 
Vector3 Velocity [get]
 The velocity of this CharacterController. Does not include additional speeds like kinematic movement.
 
Vector3 PlanarVelocity [get]
 The planar velocity (X and Z only) of this CharacterController. Does not include additional speeds like kinematic movement.
 
Vector3 TotalVelocity [get, protected set]
 The total velocity of this CharacterController, kinematic movement included.
 
float TargetSpeed [get]
 The target speed magnitude of this Player.
 
bool IsGrounded [get]
 Is this Player grounded?
 
bool IsFalling [get]
 Is this Player falling?
 
bool IsStepOffsetting [get, protected set]
 Is this Player applying a step offset?
 
bool OldIsStepOffsetting [get, protected set]
 Was this Player applying a step offset in the previous frame?
 
bool JustLanded [get]
 Did this Player just land?
 
bool JustAired [get]
 Did this Player just air?
 
bool IsSprinting [get]
 Is this Player sprinting?
 
bool IsJumping [get]
 Is this Player jumping?
 
bool IsCrouching [get]
 Is this Player crouching?
 
bool CrouchToggled [get]
 Has this Player toggled crouch?
 
bool Jumped [get, protected set]
 Has this Player jumped?
 
float MovementDetectionThreshold [get, set]
 Movement detection threshold for IsMoving, WantsToMove, IsAscending, IsDescending (By default 0.001).
 
bool IsMoving [get]
 Is this Player moving? (Excluding kinematic movement)
 
bool WantsToMove [get]
 Does this Player want to move? (Excluding kinematic movement, jumping and crouching)
 
bool IsAscending [get]
 Is this Player ascending? (Excluding kinematic movement)
 
bool IsDescending [get]
 Is this Player descending? (Excluding kinematic movement)
 
float SlopeRadiusMultiplier [get]
 The radius multiplier of the slope limit of this CharacterController.
 
virtual FootstepAsset.Data CurrentFootstepData [get]
 The current footstep data activated based on the Material or Texture we're standing on.
 
bool OldIsGrounded [get, protected set]
 Was this Player grounded in the previous frame?
 
Vector3 OldVelocity [get, protected set]
 The velocity of this Player in the previous frame.
 
Vector3 ForceBuffer [get, set]
 The force buffer that awaits execution for the next frame.
 
Vector3 ImpulseBuffer [get, set]
 The impulse buffer that awaits execution for the next frame.
 
float CurrentHeight [get, protected set]
 The current height of this Player.
 
float CurrentCameraHeight [get, protected set]
 The current camera height of this Player.
 
float CurrentSpeedMultiplier [get, protected set]
 The current speed multiplier of this Player (CurrentSlopeSpeedMultiplier not included).
 
float CurrentSlopeSpeedMultiplier [get, protected set]
 The current slope speed multiplier of this Player.
 
int CollisionLayers [get]
 The collision layers that this Player collides into, see Physics window to change collision layers.
 
float FootstepTimer [get, set]
 The footstep timer interval left before emitting a footstep.
 
Vector3 KinematicMovement [get, protected set]
 The kinematic movement of this Player, also known as the pushing/pulling force of other kinematic Rigidbody(ies).
 
Vector3 OldKinematicMovement [get, protected set]
 The kinematic movement of this Player performed in the previous frame.
 
Vector3 KinematicAngles [get, protected set]
 The kinematic angular movement, useful for rotating the Player as we rotate along a kinematic body.
 
List< Collider > CollidingColliders [get, protected set]
 The list of colliders that are colliding with this Player in this frame.
 
List< ControllerColliderHit > ColliderHits [get, protected set]
 The list of collider hit info of this Player in this frame.
 

Events

OnAiredHandler OnAired
 Event when the character just aired.
 
OnLandedHandler OnLanded
 Event when the character just landed.
 
OnFootstepHandler OnFootstep
 Event when the character just emitted a footstep.
 
BeforeFinalMovementHandler BeforeFinalMovement
 Event just before applying the final movement.
 
AfterFinalMovementHandler AfterFinalMovement
 Event just after applying the final movement.
 
CollisionDetectedHandler CollisionDetected
 Event when a collision with this Player is detected.
 

Member Function Documentation

◆ AddForce()

void MFPP.Player.AddForce ( Vector3 force)

Adds a force to this Player.

Parameters
forceThe force.

◆ AddImpulse()

void MFPP.Player.AddImpulse ( Vector3 impulse)

Adds an impulse to this Player.

Parameters
impulseThe impulse.

◆ AfterFinalMovementHandler()

delegate void MFPP.Player.AfterFinalMovementHandler ( Vector3 finalMovement)

Event delegate just after applying the final movement.

Parameters
finalMovementThe final movement vector.

◆ AirAccelerate()

Vector3 MFPP.Player.AirAccelerate ( Vector3 wishDir,
Vector3 velocity,
float accelerate )
protected

Applies air accelerate for a certain wished direction and the current velocity we're going at.

Parameters
wishDirThe wished direction.
velocityThe current velocity.
accelerateThe accelerate amount we want to apply.
Returns
The corrected air accelerated velocity.

◆ BeforeFinalMovementHandler()

delegate void MFPP.Player.BeforeFinalMovementHandler ( Vector3 finalMovement)

Event delegate just before applying the final movement.

Parameters
finalMovementThe final movement vector.

◆ CollisionDetectedHandler()

delegate void MFPP.Player.CollisionDetectedHandler ( ControllerColliderHit hit)

Event delegate when a collision with this Player is detected.

Parameters
hitThe collision hit info.

◆ EmitLandSound()

void MFPP.Player.EmitLandSound ( float velocityMagnitude)

Emits a landing sound.

Parameters
velocityMagnitudeThe velocity magnitude.

◆ GetAxis()

float MFPP.Player.GetAxis ( string axisName)
protected

Similar to Input.GetAxis(string) but also taking into account ControlSettings.ControlsEnabled.

Parameters
axisNameThe name of the axis.
Returns
The value of the virtual axis identified by axisName.

◆ GetAxisRaw()

float MFPP.Player.GetAxisRaw ( string axisName)
protected

Similar to Input.GetAxisRaw(string) but also taking into account ControlSettings.ControlsEnabled.

Parameters
axisNameThe name of the axis.
Returns
The value of the virtual axis identified by axisName.

◆ GetButton()

bool MFPP.Player.GetButton ( string buttonName)
protected

Similar to Input.GetButton(string) but also taking into account ControlSettings.ControlsEnabled.

Parameters
buttonNameThe name of the button.
Returns
Returns true while the virtual button identified by buttonName is held down.

◆ GetButtonDown()

bool MFPP.Player.GetButtonDown ( string buttonName)
protected

Similar to Input.GetButtonDown(string) but also taking into account ControlSettings.ControlsEnabled.

Parameters
buttonNameThe name of the button.
Returns
Returns true during the frame the user pressed down the virtual button identified by buttonName.

◆ GetButtonUp()

bool MFPP.Player.GetButtonUp ( string buttonName)
protected

Similar to Input.GetButtonUp(string) but also taking into account ControlSettings.ControlsEnabled.

Parameters
buttonNameThe name of the button.
Returns
Returns true the first frame the user releases the virtual button identified by buttonName.

◆ GetCurrentAxis()

float MFPP.Player.GetCurrentAxis ( string axisName)
protected

Returns the current axis value, based on whetever we use ControlSettings.RawInput and also taking into account ControlSettings.ControlsEnabled.

Parameters
axisNameThe axis name.
Returns
The value of the virtual axis identified by axisName.

◆ OnFootstepHandler()

delegate void MFPP.Player.OnFootstepHandler ( AudioClip footstep,
float volume,
float pitch )

Event delegate when the character just emitted a footstep.

Parameters
footstepThe footstep sound.
volumeThe volume of the footstep.
pitchThe pitch of the footstep.

◆ OnLandedHandler()

delegate void MFPP.Player.OnLandedHandler ( Vector3 velocity)

Event delegate when the character just landed.

Parameters
velocityThe velocity at which the character just landed.

◆ TeleportTo()

void MFPP.Player.TeleportTo ( Vector3 position,
bool resetVelocity = true )

Teleports the player to a specified position.

Parameters
positionThe position.
resetVelocityShould we reset the velocity of the player?

The documentation for this class was generated from the following file: