Methods and Properties

Public Methods and Properties you can use via script and Unity Events.

If you are using visual studio the best way to see all the methods, properties and variables is to use the Object Browser:

Below is a list of the most commonly used variables and methods - use the above method in the video to view ALL of the available variables and methods in Animal Controller and HAP!

Public Variables

public List<State> states;

List of the States of the animal. Locomotion, Idle, Fall etc

public List<Mode> modes;

List of the Modes of the animal. Attack, Actions, Hits etc

public List<Stance> Stances;

List of the Stances of the animal. Sneak,Crouch, Alert, Wounded etc

public List<EnterExitEvent> OnEnterExitStates;

List of Events to used on the States. Invoked when a State Enters or Exit.

public List<EnterExitEvent> OnEnterExitStances;

List of Events to Use on when entering on exiting a Stance. Invoked when a StanceEnters or Exit.

public StateID OverrideStartState;

Use this method to override the starting state of the Animal. Use it if you need the Character to be on a different state On Enabled.

public FloatReference AnimatorSpeed

Global Animator Speed for the Animal in FloatReference type. Use it to change the speed of the Animator.

Properties

public static List<MAnimal> Animals

Returns a list of all the active animals on the scene

public static MAnimal MainAnimal

Returns the Animal that has the Player parameter set to true

public State LastState {get}

Return the Last state the animal played

public State ActiveState {get}

Return the Current State the animal is

public StateID ActiveStateID {get}

Return the Current State ID the animal is

public bool AlwaysForward {get set}

The animal will always move forward

public bool UseCameraInput {get set}

The Animal uses the Camera Forward Direction to Move

public bool UseCameraUp {get set}

Use the Camera Up Vector to Move while Flying or Swimming Underwater (When Grounded = false)

General Methods

void SetMainPlayer()

Set an Animal as the Main Player and set to false the current Player Animal, if it were one.

void DisableMainPlayer()

Disables the animal as the Main Player in case it was.

void Teleport(Transform newPos)

Teleports the Animal to a new position using a transform as a reference

void Teleport(Vector3 newPos)

Teleports the Animal to a new position using a vector position

void TeleportRot(Transform newPos)

Teleports the Animal to a new position using a transform as a reference and also orients the animal to the Transform reference rotation

void ResetGravityDirection()

Resets the gravity to the default Vector.Down value

void GroundChangesGravity(bool value)

If the value is true, the ground negative Normal will be the Gravity Direction

Stance Methods

void Stance_Toggle(int NewStance)

Toggle the New Stance with the Default Stance using and Int ID. If the active Stance is the same, then it will activate the default Stance

void StanceToggle(StanceID NewStance)

Toggle the New Stance with the Default Stance using and StanceID

void Stance_Set(int ID) || void Stance_Set(StanceID ID)

Set a new Stance using the ID Value.

void Stance_RestoreDefault()

Restore the Default Stance to its original value.

void Stance_SetDefault(StanceID id)

Changes the value of the Default Stance.

void GroundChangesGravity(bool value)

If the is true, the ground negative Normal will be the Gravity Direction

State Methods

void State_SetFloat(float value)

Set the StateFloat value and pass it to the StateFloat parameter on the Animator

void State_Replace(State NewState)

Find an old State and replace it for a new one at Runtime

void State_Force(StateID ID) || void State_Force(int ID)

Force the Activation of an state regarding if is enable or not

bool HasState(StateID ID) || bool HasState(int ID)

Returns if the Animal has a state by its ID

void State_SetStatus(int status)

Set the StateStatus value and pass it to the StateStatus parameter on the Animator

void State_Enable(StateID ID) || void State_Enable(int ID)

Enable a State by its ID

void State_Disable(StateID ID) || void State_Disable(int ID)

Disable a State by its ID

State_AllowExit(StateID ID)

Allow Lower States on the states list to be activated

State_InputTrue(StateID ID)

Find a State by its ID and set its Input value to true

State_InputFalse(StateID ID)

Find a State by its ID and set its Input value to false

void State_Activate(StateID ID)

Activates an State by its ID. If the State is Disabled it won't be activated

State_TryActivate(int ID)

Try to Activate a State by its ID, Checking the necessary conditions for activation

State State_Get(int ID) || State State_Get(StateID ID)

Return a State by its ID value

Mode Methods

Mode Mode_Get(ModeID ModeID) || Mode Mode_Get(int ModeID)

Returns a Mode using its ID value.

void Mode_Activate(ModeID ModeID)

Activates a mode using its ID value and plays a Random Animation

void Mode_Activate(ModeID ID, int AbilityIndex)

Activates a mode using its ID value and plays an specific Ability by its Index

void Mode_Activate(Int ID, int AbilityIndex)

Activates a mode using its ID integer value and plays an specific Ability by its Index

bool Mode_TryActivate(int ModeID, int AbilityIndex)

Tries to activate a mode by checking all the conditions to activate a mode. Returns true if success and false if it could not activated

void Mode_Activate(Int Combined)

This is a special way to activate a mode and an ability all at once.

E.g. To Activate any Action Mode simply call Mode_Activate(4).

But if you want to play an specific Ability inside the Action mode, E.g. Sleep; call instead Mode_Activate(4006) which is the Mode ID (4)*1000 + Ability Index(6).

void Mode_Stop()

Stop All Modes

void Mode_Interrupt()

Set IntID to -2 to exit the playing Mode Animation. IntID = -2 is the Interrupt Condition for all modes

void Mode_Pin(ModeID ID)

Pin a mode to activate later. Store the Mode in the Pin_Mode variable

void Mode_Pin_Ability(int AbilityIndex)

Pin an Ability on the Pin_Mode to Activate later

void Mode_Pin_Status(int status)

Changes the Pin_Mode Status

void Mode_Pin_Time(float time)

Changes the Pin_Mode time when using Hold by time Status

void Mode_Pin_Input(bool input)

Changes the Input Value of the Pin_Mode

void Mode_Pin_Activate()

Tries to Activate the Pin_Mode

void Mode_Pin_AbilityActivate(int AbilityIndex)

Tries to Activate the Pin Mode with an Ability

Speed Methods

void SetSprint(bool value)

Enable/Disable sprinting on the animal

void Speed_Change_Lock(bool value)

Lock speed changes on the animal. Disable changing from walk to run..etc

void Speed_CurrentIndex_Set(int index)

Set an specific speed on the currentSpeedModifier set

E.g. if the animal is using the SpeedSet "Ground" it will change the current speed modifier inside that set (Walk,Run) using an index

MSpeed Speed_GetModifier(string set, int index)

Returns a speed modifier, using the name of the set and an index.

E.g. MAnimal.Speed_GetModifier("Ground",1) will return the Walk SpeedModifier

void Speed_SetTopIndex(int index)

Change the Top Index of a Speed Set.

void Speed_SetTopIndex(string setname ,int index)

Change the Top Index of a Speed Set using the setname

void SpeedSet_Set_Active(string setName, string activeSpeed)

Change the Speed of a Speed Set

void SpeedDown()

Changes to the previous speed on the current speed set modifier

void SpeedUp()

Changes to the next speed on the current speed set modifier

Last updated