MW UNITY NAMESPACE








































public partial class : MonoBehaviour

FABRIK


Forward and Backward Reaching Inverse Kinematics.

This class is marked 'partial' and can have its functionality extended.

Alternatively, this class can have its functionality extended.



[SerializeField] protected bool

bShowJoints

Should FABRIKLeg connections shown?



[SerializeField] protected float

JointGizmosRadius

How large should FABRIKLeg Joints be displayed?



[SerializeField] protected bool

bShowBiasPoint

Should the FABRIK bias points be shown?


BiasGizmosRadius

How large should the Bias Point be displayed?



[SerializeField] protected bool

bShowRays

Should the Rays that determine the FABRIK Target be shown?



[SerializeField] protected int

MaximumPasses

The maximum number of times FABRIK should run.

Higher increases accuracy, but is slower to compute.



[SerializeField] protected float

Tolerance

How close should the FABRIK Leg be to be considered reached?

This controls the accuracy for all Legs.



[SerializeField] protected float

MinLegUpHeight

The minimum height for the upward motion of the FABRIKLeg.

This functionality was purpose built for procedural Crawling Animations.



[SerializeField] protected float

MaxLegUpHeight

The maximum height for the upward motion of the FABRIKLeg.

This functionality was purpose built for procedural Crawling Animations.



[SerializeField] protected float

LegUpSpeed

How fast should the FABRIKLeg go upwards?

This functionality was purpose built for procedural Crawling Animations.



public List<FABRIKLeg>

Legs

The FABRIKLegs affected and controlled by FABRIK.



[SerializeField] protected float

SpringArmThreshold

The maximum SpringArm.Distance before FABRIK turns off.



[SerializeField] protected float

CameraDistanceThreshold

The maximum distance the Camera can be before FABRIK turns off.

Assumes that the MSpringArm objet is a Camera.
Will not work otherwise!



[SerializeField] protected bool

bLimitWithFramerate

Should FABRIK automatically turn off when the Frame Rate is too low?



[SerializeField] protected int

FrameCutoff

The minimum amount of Frames per Second FABRIK needs to run.



[SerializeField] protected bool

bAlwaysRunRegardless

Should FABRIK ignore optimisations?



protected virtual void

Start ()

Summary:

Initialises MainSpringArmComponent.

Remarks:

Assumes that Camera.main has a SpringArm attached to it.



protected virtual void

Update ()

Summary:

Runs FABRIK logic every frame, accounting for optimisations.



protected bool

HasRotatedSinceLastFrame ()

Summary:

Checks whether this transform has rotated since the last frame.

Returns:

True if this transform has rotated by at least .1 on any axis since the last frame.



protected bool

HasMovedSinceLastFrame ()

Summary:

Checks whether this transform has rotated since the last frame.

Returns:

True if this transform has moved kEpsilon since the last frame.



protected virtual void

GetCrawlingHeights (float& Height, float& ClampedSine, float& ClampedCosine)

Summary:

Calculates how high Limbs, Knees or Toes should go.

Params:

Height:

        The maximum height Limbs, Knee or Toes can go.

ClampedSine:

        [Default] Height from Sine function.

ClampedCosine:

        [Default] Height from Cosine function.



protected virtual void

AssignLegHeights ()

Summary:

Assigns the height of the maximum height of the legs randomly.

Remarks:

This functionality was purpose built for procedural Crawling Animations.

It controls the random heights in GetCrawlingHeights() to mimic crawling legs.



protected void

ExecuteFABRIKLogic (bool bSnapToTarget)

Summary:

Computes FABRIK logic according to predefined settings and assigns Legs to their FABRIK-solved positions and rotations.

Params:

bSnapToTarget:

        Should the FABRIK solver snap to the final position?



protected void

RunFABRIK (Vector3[] Joints, Vector3 Root, Vector3 Target, Vector3 RelativeBias)

Summary:

The implementation of the FABRIK Solver.

Params:

Joints:

        The Joints to consider when adjusting positions and rotations.

Root:

        The position of the Joint that is directly conneected to the rest of the body.

Target:

        The positions of Joints that FABRIK should solve towards.

RelativeBias:

        THe Joints' Bias point. (Vector3.zero for no bias)



protected virtual void

RaySettings (FABRIKLeg Leg, Vector3& Origin, Vector3& Direction)

Summary:

Calculates how rays should be shot to determine FABRIK Targets.

Params:

Leg:

        The relative position to calculate the Origin of the Ray.

Origin:

        The Origin of the ray to determine the FABRIK Target.

Direction:

        The Direction the ray will travel to determine the FABRIK Target.



protected Vector3

GetRelativeXYZ (Vector3 V)

Summary:

Gets the relative position of V whilst considering rotations.

Params:

V:

        The vector to convert to local space.

Returns:

The coordinates of V, relative to this transform.



protected Vector3

GetRelativeXYZ (float X, float Y, float Z)

Summary:

Gets the relative position of X, Y, and Z whilst considering rotations.

Params:

X:

        The X-Axis value to convert to local space.

Y:

        The Y-Axis value to convert to local space.

Z:

        The Z-Axis value to convert to local space.

Returns:

The coordinates of X, Y, and Z, relative to this transform.



protected virtual void

IsTooFarFromCamera ()

Summary:

Determines how far is too far for the Camera.

Returns:

True if the distance between this and the Camera exceeds CameraDistanceThreshold.


[Serializable] public struct

FABRIKLeg


Relevant information referencing how and what will be affected by FABRIK.



public Vector3

TargetRayOrigin

The position FABRIK should begin to searching for a FABRIK Target.



public List<Transform>

Limbs

Straight and unbendable transforms affected by FABRIK.



public List<Transform>

KneeOrToe

The Joints/positions between the Limbs for FABRIK Target angle corrections.



public float

Height

The random Height assigned by AssignLegHeights().



public Vector3

Bias

The positoin where Limbs, Knees, Toes should aim towards while adjusting to FABRIK.



public Vector3[]

GetJointPositions ()

Summary:

Gets the positions of all the Joints.

Returns:

The positions of all the Joints.


public struct

IntervalInformation


Inter-frame information recording utility.



public void

Record (PlayerBase Player)

Summary:

Records an Interval.

Remarks:

Call before Mark.

Params:

Player:

        The Player to record.



public void

Mark (PlayerBase Player)

Summary:

Marks the end of an Interval.

Params:

Player:

        The Player to get interval information.



public void

Mark (PlayerBase Player, LastIntervalInformation& LastInterval, ThisIntervalInformation& ThisInterval)

Summary:

Marks the end of an interval.

Params:

Player:

        The Player to get interval information.

LastInterval:

        Outs the last interval information.

ThisInterval:

        Outs the current interval information.



public LastIntervalInformation

GetLast ()

Summary:

Get the information at the last recorded interval.

Returns:

The Last Interval Information from the last recorded interval.


public struct

LastIntervalInformation


Information about this Player on the previous record.



public MVector

Position

The Position of this Player on the previous record.



public MRotator

Rotation

The Rotation of this Player on the previous record.


public struct

ThisIntervalInformation


Information about this Player on the current record.



public MVector

Position

The Position of this Player on the current record.



public MRotator

Rotation

The Position of this Player on the current record.



public MVector

DeltaPosition (LastIntervalInformation Last)

Summary:

The difference in positions of This and Last.

Params:

Last:

        The Last position.

Returns:

This.Position - Last.Position.



public MRotator

DeltaRotation (LastIntervalInformation Last)

Summary:

The difference in rotations of This and Last.

Params:

Last:

        The Last rotation.

Returns:

This.Rotation - Last.Rotation.



public float

TimeSinceLast (LastIntervalInformation Last)

Summary:

The time between the Last Interval and This Interval.

Params:

Last:

        The Last recorded time.

Returns:

This.Time - Last.Time.



public void

GetDeltas (LastIntervalInformation Last, MVector& DeltaPosition, MRotator& DeltaRotation, float& DeltaTime)

Summary:

Get Deltas in all respects.

Params:

Last:

        The Last recorded interval.


public class : MonoBehaviour

MBehaviour




public MVector

Position

The world position of this player.



public MRotator

Rotation

The rotation of this player.



public MArray<Collider>

SetObjectPosition3D (MVector NewPosition, bool bTeleportToPosition, bool bDoSweep, SweepInteraction Interactions)

Summary:

Sets this transform's position to NewPosition or the first SweepInteraction if bDoSweep and bTeleportToPosition are true.

Params:

NewPosition:

        The target destination to go to, or go towards in a straight-line.

bTeleportToPosition:

        True to immediately teleport to the location, regardless of Sweep Interactions.

bDoSweep:

         True to teleport to the first Sweeped interaction, rather than NewPosition, if this transform intercepted another GameObject within the referenced SweepInteraction's Radius.

Interactions:

        Data containing how this transform interacts with other objects during Sweep.

Returns:

An MArray of GameObjects that were interacted with during sweeping, or null if bDoSweep is false.



public MArray<Collider2D>

SetObjectPosition2D (MVector NewPosition, bool bTeleportToPosition, bool bDoSweep, SweepInteraction Interactions)

Summary:

Sets this transform's position to NewPosition or the first SweepInteraction if bDoSweep and bTeleportToPosition are true.

Params:

NewPosition:

        The target destination to go to, or go towards in a straight-line.

bTeleportToPosition:

        True to immediately teleport to the location, regardless of Sweep Interactions.

bDoSweep:

         True to teleport to the first Sweeped interaction, rather than NewPosition, if this transform intercepted another GameObject within the referenced SweepInteraction's Radius.

Interactions:

        Data containing how this transform interacts with other objects during Sweep.

Returns:

An MArray of GameObjects that were interacted with during sweeping, or null if bDoSweep is false.


[RequireComponent<Rigidbody>] public class : PlayerBase

MPlayer


The base class of a Player in a three-dimensional world.



public override void

MovementInput (float ForwardThrow, float RightThrow)

Summary:

The default implementation for movement input.

Params:

ForwardThrow:

        Forward input. Default is Z axis.

RightThrow:

        Right input. Default is X axis.



public virtual void

Jump (float Force)

Summary:

Adds force upwards to this player. Default direction is MVector.Up.

Remarks:

Uses Rigidbody.AddForce(Vector3) to enforce jumping, by default.

Params:

Force:

        The amount of force to apply.



public float

GetSpeed ()

Summary:

The velocity of this Player, respective to attached Rigidbody.

Returns:

The speed in Unity-units per second.



public void

GetSpeedAndDirection (float& Speed, MVector& Direction)

Summary:

Gets the speed and direction of this Player.

Params:

Speed:

        Out float speed in Unity-units per second.

Direction:

        Out MVector normalised direction this player is moving. Relative to the attached Rigidbody.


[RequireComponent<Rigidbody2D>, <SpriteRenderer>] public class : PlayerBase

MPlayer2D


The base class of a Player in a two-dimensional world. Extends PlayerBase.



[SerializeField] bool

bFlipSpriteOnInput

True to flip this Sprite Renderer over X when moving horizontally.



[SerializeField] bool

bSpriteIsFacingNegativeX

True if this sprite is defaulted to facing -X.



public override void

FixedUpdate ()

Summary:

Must call base.FixedUpdate().

Remarks:

Must call base.FixedUpdate().



public override void

MovementInput (float UpwardThrow, float ForwardThrow)

Summary:

The default implementation for movement input.

Params:

UpwardThrow:

        Upward input. Default is Y axis.

ForwardThrow:

        Forward input. Default is X axis.



public void

FlipOnInput (float FlipIndependentInput)

Summary:

Flips SpriteRenderer according to a float.

Remarks:

bFlipOnSpriteInput needs to be true to execute.

Params:

FlipIndependentInput:

        The input throw to determine a flip of the Sprite Renderer.



public SpriteRenderer

GetSpriteRenderer ()

Summary:

This Player's SpriteRenderer.

Returns:

The SpriteRenderer attached to this Player.



public Rigidbody2D

GetRigidbody ()

Summary:

This Player's Rigidbody2D.

Returns:

The Rigidbody2D attached to this Player.



public static RaycastHit2D?

RayUnderMouse (Camera ReferenceCamera, float Distance, int LayerMask)

Summary:

Performs a raycast under the mouse.

Remarks:

ReferenceCamera must be orthographic, otherwise null is returned.

Params:

ReferenceCamera:

        The Camera to shoot a ray from, screen-wise.

Distance:

        The maximum distance of the ray to shoot.

LayerMask:

        The layers this raycast will intercept.

Returns:

RaycastHit2D information about the raycast. Null if ReferenceCamera is not orthographic.


public class <T> where T : MonoBehaviour

MUniqueT


Base class for any unique MonoBehaviour in a game.



public static T

Instance

A unique reference to T.



[SerializeField] bool

bMakePersistent

Sets this gameObject to DontDestroyOnLoad.



[SerializeField] bool

bSpawnNewOnDestroy

True to spawn a new unique instance when this is destroyed.



public virtual void

Awake ()

Summary:

Automatically sets the instance to this.



protected virtual void

SetInstance (T UniqueInstance)

Summary:

Sets the unique instance.

Params:

UniqueInstance:

        The component to mark as the unique instance.



protected virtual void

OnDestroy ()

Summary:

Will spawn a new GameObject if bSpawnNewOnDestroy is true.


public class : MonoBehaviour

PlayerBase


The base class for MPlayer and MPlayer2D.



public Action<float, float>

OnTakeDamage

Called when damage is taken. First float is new Health, second is the inflicting damage.



public float

MovementSpeed

The movement speed of this Player.



public void

InitialisePlayer ()

Summary:

Initialises this player's settings.



public void

SetMovementSpeed (float NewMovementSpeed)

Summary:

Sets MovementSpeed to NewMovementSpeed.

Remarks:

Also updates the default, InitialMovementSpeed. TemporaryMovementSpeed will revert to NewMovementSpeed.

Params:

NewMovementSpeed:

        The new Movement Speed of this player.



public IEnumerator

TemporaryMovementSpeed (float TemporaryMovementSpeed, float Duration)

Summary:

Temporarily modifies this player's MovementSpeed.

Remarks:

Calling StopCoroutine on the returned IEnumerator will not reset the player's MovementSpeed.

Params:

TemporaryMovementSpeed:

        The temporary MovementSpeed.

Duration:

        The time in seconds in which TemporaryMovementSpeed will be in effect.

Returns:

The IEnumerator that handles timing.



public void

ResetMovementSpeed ()

Summary:

Set this player's MovementSpeed to InitialMovementSpeed.



public virtual void

MovementInput (float ForwardThrow, float RightThrow)

Summary:

Registers movement from input.

Remarks:

Needs to be overridden from

Params:

ForwardThrow:

        Horizontal input.

RightThrow:

        Vertical input.



public void

ReceiveMovementInput (bool bStopReceivingInput)

Summary:

Set this Player's ability to receive MovementInput(float, float).

Params:

bStopReceivingInput:

        True if this Player should stop receiving input.



public bool

HasStoppedReceivingMovementInput ()

Summary:

Whether or not this Player is allowed to receive MovementInput(float, float).

Returns:

True if this Player is not allowed to receive MovementInput(float, float).



public void

RecordInterval ()

Summary:

Records this Player on this frame.



public MVector

GetVelocity ()

Summary:

Gets the velocity of the Player, relative to the previous interval.

Returns:

The velocity of this Player, relative to the previous interval.



public float

GetAccelerationRate ()

Summary:

The rate of acceleration of this Player between FixedUpdate intervals.

Returns:

The rate of acceleration in metres per second, as per Time.fixedDeltaTime.



public MVector

V_ComputeGForce (MVector Gravity)

Summary:

The G Force experienced by this Player between FixedUpdate intervals.

Params:

Gravity:

        The force of gravity this Player experiences at a standstill.

Returns:

The G Force experience by this Player as an MVector.



public float

F_ComputeGForce (MVector Gravity)

Summary:

The G Force experienced by this Player between FixedUpdate intervals.

Params:

Gravity:

        The force of gravity this Player experiences at a standstill.

Returns:

The G Force experienced by this player.



public float

GetHealth ()

Summary:

Get this Player's Health.

Returns:

Current health.



public bool

TakeDamage (float InDamage)

Summary:

Deduct InDamage from this Player's Health.

Params:

InDamage:

        The damage to inflict on this Player.

Returns:

True if this Player IsDead.



public bool

TakeDamage (float InDamage, float& HealthPercentageRemaining)

Summary:

Deduct InDamage from this Player's Health.

Params:

InDamage:

        The damage to inflict on this Player.

HealthPercentageRemaining:

        The percentage of health remaining after taking InDamage.

Returns:

True if this Player IsDead.



public bool

IsDead ()

Summary:

If this Player's is considered dead.

Returns:

True if GetHealth <= 0.



public virtual void

OnDestroy ()

Summary:

What should happen when this Player is removed from the game?


[Serializable] public class

SweepInteraction


A class defining how MBehaviours do Sweeps.



public const SweepInteraction

kNoInteraction

Constant null reference to mark No Interaction.



public static readonly SweepInteraction

Default

Default Sweep Interaction parameters.



public float

InteractingRadius

The radius of this Sweep's check for interactions.



public LayerMask

InteractingLayers

The layers this Sweep will consider for interactions.



public UnityEvent<GameObject>

Broadcast

What happens when the Sweep makes an interaction?


CONSTRUCTOR ()

Summary:

Default Sweep Interaction parameters.


CONSTRUCTOR (float InteractingRadius)

Summary:

Initialise Sweep Interaction parameters with a Radius only.

Params:

InteractingRadius:

        The radius of this Sweep's check for interactions.


CONSTRUCTOR (float InteractingRadius, LayerMask InteractingLayers)

Summary:

Initialise Sweep Interaction parameters with a Radius and the interaction layer/s.

Params:

InteractingRadius:

        The radius of this Sweep's check for interactions.

InteractingLayers:

        The layers this Sweep will consider for interactions.


CONSTRUCTOR (float InteractingRadius, LayerMask InteractingLayers, Action<GameObject> OnObjectsInteraction)

Summary:

Fully initialise a Sweep Interaction.

Params:

InteractingRadius:

        The radius of this Sweep's check for interactions.

InteractingLayers:

        The layers this Sweep will consider for interactions.

OnObjectsInteraction:

        What happens when the Sweep makes an interaction?


public class <T> : MonoBehaviour

TickT


Generates a separate Tick function.


CONSTRUCTOR (EEquation Equation, float DurationInSeconds, Action<T OnTick)

Summary:

Creates a new separate update loop.

Params:

Equation:

        The Equation to use to Tick.

DurationInSeconds:

        The duration of this update loop in seconds.

OnTick:

        The method to call every tick. The executed T and interpolated Time is passed as a parameter.


CONSTRUCTOR (EEquation Equation, float DurationInSeconds, Action<T OnTick, Single> StartInterpolation, float EndInterpolation)

StartInterpolation:

        Where to begin interpolation.

EndInterpolation:

        Where to end interpolation.



public void

SetData (MArray<T> Data)

Summary:

Sets the data for the next execution of OnTick.

Remarks:

All entries in Data will be executed linearly.

Params:

Data:

        The data to set for the next OnTick.



public void

TogglePauseTick ()

Summary:

Pauses this Tick from executing until this (TogglePauseTick) is called again.

Remarks:

This is a toggle.



public void

Terminate ()

Summary:

Stop executing this Tick.



public TickInformation

GetTickInfo ()

Summary:

Information about the time and percentage complete on this Tick function.

Returns:

Information about the time and percentage complete on this Tick function.


public class : MUnique<VisualDebugger>

VisualDebugger


A custom utility class that assists in debugging game data.



public bool

bDisableGUI

True to disable GUI draws to the game screen.



public bool

bDisableLogs

True to disable VDebug Logs to the console.



[SerializeField] [Min(0)] float

GUIUpdateInterval

How often should GUI be updated in seconds?

0 is evert frame.



public void

Log (Object Content, string HexColour, EVerbosity Verbosity)

Summary:

Log.Auto() Content with Verbosity in HexColour.

Params:

Content:

        The string to log to the console.

HexColour:

        The Colour to display Content in the console.

Verbosity:

        The level of the log.



public void

DrawLine (DrawParams Params)

Summary:

Draws a line to the editor screen.

Params:

Params:

        Draw Parameters.



public void

DrawGUIText (string Content, int Width, int Height)

Summary:

Draws text onto the game screen with OnGUI().

Params:

Content:

        The string to display to the game screen.

Width:

        The width of the Rect that will be drawn onto the screen.

Height:

        The height of the Rect that will be drawn onto the screen.



public void

DrawGUIText (string Content, Color Colour, int Width, int Height)

Summary:

Draws text onto the game screen with OnGUI().

Params:

Content:

        The string to display to the game screen.

Colour:

        The colour of Content.

Width:

        The width of the Rect that will be drawn onto the screen.

Height:

        The height of the Rect that will be drawn onto the screen.


public struct

DrawParams


Parameters controlling how lines are drawn to the screen.



public MVector

From

Where the line will originate.



public MVector

To

Where the line will terminate.



public Color

Colour

The colour of the line.



public float

Duration

How long the line will remain on screen in seconds.


CONSTRUCTOR (MVector From, MVector To)

Summary:

Define only From and To. Default Colour is white and Duration is a single frame.


CONSTRUCTOR (MVector From, MVector To, Color Colour)

Summary:

Define From, To and Colour. Default Duration is a single frame.


CONSTRUCTOR (MVector From, MVector To, Color Colour, float Duration)

Summary:

Fully construct Draw Parameters.