Class PlayerSpeedChanger
Inheritance
PlayerSpeedChanger
Assembly: Assembly-CSharp.dll
Syntax
[RequireComponent(typeof(PlayerMotor))]
public class PlayerSpeedChanger : MonoBehaviour
Fields
|
Improve this Doc
View Source
classicToUnitySpeedUnitRatio
Declaration
public const float classicToUnitySpeedUnitRatio = 39.5F
Field Value
|
Improve this Doc
View Source
dfWalkBase
Declaration
public const float dfWalkBase = 150F
Field Value
|
Improve this Doc
View Source
isRunning
Declaration
Field Value
|
Improve this Doc
View Source
isSneaking
Declaration
Field Value
|
Improve this Doc
View Source
runningMode
Declaration
Field Value
|
Improve this Doc
View Source
runSpeedOverride
Declaration
public bool runSpeedOverride
Field Value
|
Improve this Doc
View Source
sneakingMode
Declaration
Field Value
|
Improve this Doc
View Source
updateRunSpeed
Declaration
public bool updateRunSpeed
Field Value
|
Improve this Doc
View Source
updateWalkSpeed
Declaration
public bool updateWalkSpeed
Field Value
|
Improve this Doc
View Source
walkSpeedOverride
Declaration
public bool walkSpeedOverride
Field Value
Properties
|
Improve this Doc
View Source
CanRun
Declaration
public PlayerSpeedChanger.CanPlayerRun CanRun { get; set; }
Property Value
|
Improve this Doc
View Source
ToggleRun
Declaration
public bool ToggleRun { get; set; }
Property Value
|
Improve this Doc
View Source
ToggleSneak
Declaration
public bool ToggleSneak { get; set; }
Property Value
Methods
|
Improve this Doc
View Source
AddRunSpeedMod(out String, Single, Boolean)
Add custom walk speed modifier to speed modifer dictionary. Returns unique ID for referencing of custom speedModifier for future manipulation.
Declaration
public bool AddRunSpeedMod(out string UID, float speedModifier = 0F, bool refreshRunSpeed = true)
Parameters
Type |
Name |
Description |
String |
UID |
The Unique Universal ID created and provided when original value was added to dictionary. Store this value to reference your speed modifier later.
|
Single |
speedModifier |
the amount to change players base walk speed by percentages. AKA, .75 will lower player movement by 25%. Using 0 or negatives will do nothing but return null.
|
Boolean |
refreshRunSpeed |
|
Returns
|
Improve this Doc
View Source
AddWalkSpeedMod(out String, Single, Boolean)
Add custom walk speed modifier to speed modifer dictionary. Returns unique ID for referencing of custom speedModifier for future manipulation.
Declaration
public bool AddWalkSpeedMod(out string UID, float walkSpeedModifier = 0F, bool refreshWalkSpeed = true)
Parameters
Type |
Name |
Description |
String |
UID |
The Unique Universal ID created and provided when original value was added to dictionary. Store this value to reference your speed modifier later.
|
Single |
walkSpeedModifier |
|
Boolean |
refreshWalkSpeed |
will cause routine to also update the player speed using the list to sequentially multiply the current base value by the list modifier values.
|
Returns
|
Improve this Doc
View Source
Determines how speed should be changed based on player's input
Declaration
public void ApplyInputSpeedAdjustment(ref float speed)
Parameters
Type |
Name |
Description |
Single |
speed |
|
|
Improve this Doc
View Source
CanRunUnlessRiding()
Declaration
public bool CanRunUnlessRiding()
Returns
|
Improve this Doc
View Source
Record player input for speed adjustment
Declaration
public void CaptureInputSpeedAdjustment()
|
Improve this Doc
View Source
GetBaseSpeed()
Get LiveSpeed adjusted for swimming, walking, crouching or riding
Declaration
public float GetBaseSpeed()
Returns
Type |
Description |
Single |
Speed based on player.Stats.LiveSpeed
|
|
Improve this Doc
View Source
GetClimbingSpeed(Single)
Declaration
public float GetClimbingSpeed(float baseSpeed)
Parameters
Type |
Name |
Description |
Single |
baseSpeed |
|
Returns
|
Improve this Doc
View Source
GetRunSpeed()
Get LiveSpeed adjusted for running
Declaration
public float GetRunSpeed()
Returns
|
Improve this Doc
View Source
GetSwimSpeed(Single)
Get LiveSpeed adjusted for swimming
Declaration
public float GetSwimSpeed(float baseSpeed)
Parameters
Type |
Name |
Description |
Single |
baseSpeed |
|
Returns
|
Improve this Doc
View Source
GetWalkSpeed(PlayerEntity)
Get LiveSpeed adjusted for walking
Declaration
public float GetWalkSpeed(PlayerEntity player)
Parameters
Type |
Name |
Description |
PlayerEntity |
player |
the PlayerEntity to use
|
Returns
|
Improve this Doc
View Source
RefreshRunSpeed()
Updates the players walk speed using for loop and dictionary values to ensure proper sequential processing to get proper end speed.
Processing of modifiers is processed by their addition order. First added by modder is multiplied first, and so on.
Declaration
public float RefreshRunSpeed()
Returns
|
Improve this Doc
View Source
RefreshWalkSpeed()
Updates the players walk speed using for loop and dictionary values to ensure proper sequential processing to get proper end speed.
Processing of modifiers is processed by their addition order. First added by modder is multiplied first, and so on.
Declaration
public float RefreshWalkSpeed()
Returns
|
Improve this Doc
View Source
RemoveSpeedMod(String, Boolean, Boolean)
Remove custom speed modifier from speed modifer dictionary using stored UID. Returns true if removed, false if not found. Ensure to set if it is a run or walk speed modifier being removed.
Declaration
public bool RemoveSpeedMod(string UID, bool removeRunSpeed = false, bool refreshSpeed = true)
Parameters
Type |
Name |
Description |
String |
UID |
The Unique Universal ID created and provided when original value was added to dictionary. Store this value to reference your speed modifier later.
|
Boolean |
removeRunSpeed |
|
Boolean |
refreshSpeed |
|
Returns
|
Improve this Doc
View Source
ResetSpeed(Boolean, Boolean)
Clears our associated modifier list of all values. default to clearing out both run and walk speed modifier list.
Declaration
public bool ResetSpeed(bool walkSpeedReset = true, bool runSpeedReset = true)
Parameters
Type |
Name |
Description |
Boolean |
walkSpeedReset |
clear out walk speed modifier list.
|
Boolean |
runSpeedReset |
clear out run speed modifier list
|
Returns
Extension Methods
MBExtensions.Invoke<T1, T2, T3, T4>(MonoBehaviour, Action<T1, T2, T3, T4>, T1, T2, T3, T4, Single)