Show / Hide Table of Contents

Class PlayerSpeedChanger

Inheritance
Object
Object
Component
Behaviour
MonoBehaviour
PlayerSpeedChanger
Namespace: DaggerfallWorkshop.Game
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
Type Description
Single
| Improve this Doc View Source

dfWalkBase

Declaration
public const float dfWalkBase = 150F
Field Value
Type Description
Single
| Improve this Doc View Source

isRunning

Declaration
public bool isRunning
Field Value
Type Description
Boolean
| Improve this Doc View Source

isSneaking

Declaration
public bool isSneaking
Field Value
Type Description
Boolean
| Improve this Doc View Source

runningMode

Declaration
public bool runningMode
Field Value
Type Description
Boolean
| Improve this Doc View Source

runSpeedOverride

Declaration
public bool runSpeedOverride
Field Value
Type Description
Boolean
| Improve this Doc View Source

sneakingMode

Declaration
public bool sneakingMode
Field Value
Type Description
Boolean
| Improve this Doc View Source

updateRunSpeed

Declaration
public bool updateRunSpeed
Field Value
Type Description
Boolean
| Improve this Doc View Source

updateWalkSpeed

Declaration
public bool updateWalkSpeed
Field Value
Type Description
Boolean
| Improve this Doc View Source

walkSpeedOverride

Declaration
public bool walkSpeedOverride
Field Value
Type Description
Boolean

Properties

| Improve this Doc View Source

CanRun

Declaration
public PlayerSpeedChanger.CanPlayerRun CanRun { get; set; }
Property Value
Type Description
PlayerSpeedChanger.CanPlayerRun
| Improve this Doc View Source

ToggleRun

Declaration
public bool ToggleRun { get; set; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

ToggleSneak

Declaration
public bool ToggleSneak { get; set; }
Property Value
Type Description
Boolean

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
Type Description
Boolean
| 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
Type Description
Boolean
| Improve this Doc View Source

ApplyInputSpeedAdjustment(ref Single)

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
Type Description
Boolean
| Improve this Doc View Source

CaptureInputSpeedAdjustment()

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
Type Description
Single
| Improve this Doc View Source

GetRunSpeed()

Get LiveSpeed adjusted for running

Declaration
public float GetRunSpeed()
Returns
Type Description
Single
| 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
Type Description
Single
| 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
Type Description
Single
| 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
Type Description
Single
| 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
Type Description
Single
| 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
Type Description
Boolean
| 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
Type Description
Boolean

Extension Methods

MBExtensions.Invoke(MonoBehaviour, Action, Single)
MBExtensions.Invoke<T>(MonoBehaviour, Action<T>, T, Single)
MBExtensions.Invoke<T1, T2>(MonoBehaviour, Action<T1, T2>, T1, T2, Single)
MBExtensions.Invoke<T1, T2, T3>(MonoBehaviour, Action<T1, T2, T3>, T1, T2, T3, Single)
MBExtensions.Invoke<T1, T2, T3, T4>(MonoBehaviour, Action<T1, T2, T3, T4>, T1, T2, T3, T4, Single)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX