This class will pilot the TopDownController component of your character. This is where you'll implement all of your character's game rules, like jump, dash, shoot, stuff like that. Animator parameters : Grounded (bool), xSpeed (float), ySpeed (float), CollidingLeft (bool), CollidingRight (bool), CollidingBelow (bool), CollidingAbove (bool), Idle (bool) Random : a random float between 0 and 1, updated every frame, useful to add variance to your state entry transitions for example RandomConstant : a random int (between 0 and 1000), generated at Start and that'll remain constant for the entire lifetime of this animator, useful to have different characters of the same type
More...
|
virtual void | CacheAbilities () |
| Grabs abilities and caches them for further use Make sure you call this if you add abilities at runtime Ideally you'll want to avoid adding components at runtime, it's costly, and it's best to activate/disable components instead. But if you need to, call this method. More...
|
|
virtual void | ForceAbilitiesInitialization () |
| Forces the (re)initialization of the character's abilities More...
|
|
T | FindAbility< T > () |
| A method to check whether a Character has a certain ability or not More...
|
|
CharacterAbility | FindAbilityByString (string abilityName) |
| A method to check whether a Character has a certain ability or not More...
|
|
List< T > | FindAbilities< T > () |
| A method to check whether a Character has a certain ability or not More...
|
|
virtual void | AssignAnimator (bool forceAssignation=false) |
| Binds an animator to this character More...
|
|
virtual void | SetInputManager () |
| Gets (if it exists) the InputManager matching the Character's Player ID More...
|
|
virtual void | SetInputManager (InputManager inputManager) |
| Sets a new input manager for this Character and all its abilities More...
|
|
virtual void | ResetInput () |
| Resets the input for all abilities More...
|
|
virtual void | SetPlayerID (string newPlayerID) |
| Sets the player ID More...
|
|
virtual void | RespawnAt (Vector3 spawnPosition, FacingDirections facingDirection) |
|
virtual void | RespawnAt (Transform spawnPoint, FacingDirections facingDirection) |
| Makes the player respawn at the location passed in parameters More...
|
|
virtual void | FlipAllAbilities () |
| Calls flip on all abilities More...
|
|
virtual void | ChangeCharacterConditionTemporarily (CharacterStates.CharacterConditions newCondition, float duration, bool resetControllerForces, bool disableGravity) |
| Use this method to change the character's condition for a specified duration, and resetting it afterwards. You can also use this to disable gravity for a while, and optionally reset forces too. More...
|
|
virtual void | SetCameraDirection (Vector3 direction) |
| Stores the associated camera direction More...
|
|
virtual void | Freeze () |
| Freezes this character. More...
|
|
virtual void | UnFreeze () |
| Unfreezes this character More...
|
|
virtual void | Disable () |
| Called to disable the player (at the end of a level for example. It won't move and respond to input after this. More...
|
|
virtual void | Reset () |
| Called when the Character dies. Calls every abilities' Reset() method, so you can restore settings to their original value if needed More...
|
|
This class will pilot the TopDownController component of your character. This is where you'll implement all of your character's game rules, like jump, dash, shoot, stuff like that. Animator parameters : Grounded (bool), xSpeed (float), ySpeed (float), CollidingLeft (bool), CollidingRight (bool), CollidingBelow (bool), CollidingAbove (bool), Idle (bool) Random : a random float between 0 and 1, updated every frame, useful to add variance to your state entry transitions for example RandomConstant : a random int (between 0 and 1000), generated at Start and that'll remain constant for the entire lifetime of this animator, useful to have different characters of the same type
◆ CharacterDimensions
◆ CharacterTypes
the possible character types : player controller or AI (controlled by the computer)
◆ FacingDirections
the possible initial facing direction for your character
Enumerator |
---|
West | |
East | |
North | |
South | |
◆ AssignAnimator()
virtual void MoreMountains.TopDownEngine.Character.AssignAnimator |
( |
bool |
forceAssignation = false | ) |
|
|
virtual |
Binds an animator to this character
◆ Awake()
virtual void MoreMountains.TopDownEngine.Character.Awake |
( |
| ) |
|
|
protectedvirtual |
Initializes this instance of the character
◆ CacheAbilities()
virtual void MoreMountains.TopDownEngine.Character.CacheAbilities |
( |
| ) |
|
|
virtual |
Grabs abilities and caches them for further use Make sure you call this if you add abilities at runtime Ideally you'll want to avoid adding components at runtime, it's costly, and it's best to activate/disable components instead. But if you need to, call this method.
◆ CacheAbilitiesAtInit()
virtual void MoreMountains.TopDownEngine.Character.CacheAbilitiesAtInit |
( |
| ) |
|
|
protectedvirtual |
Caches abilities if necessary
◆ ChangeCharacterConditionTemporarily()
virtual void MoreMountains.TopDownEngine.Character.ChangeCharacterConditionTemporarily |
( |
CharacterStates.CharacterConditions |
newCondition, |
|
|
float |
duration, |
|
|
bool |
resetControllerForces, |
|
|
bool |
disableGravity |
|
) |
| |
|
virtual |
Use this method to change the character's condition for a specified duration, and resetting it afterwards. You can also use this to disable gravity for a while, and optionally reset forces too.
- Parameters
-
newCondition | |
duration | |
resetControllerForces | |
disableGravity | |
◆ ChangeCharacterConditionTemporarilyCo()
virtual IEnumerator MoreMountains.TopDownEngine.Character.ChangeCharacterConditionTemporarilyCo |
( |
CharacterStates.CharacterConditions |
newCondition, |
|
|
float |
duration, |
|
|
bool |
resetControllerForces, |
|
|
bool |
disableGravity |
|
) |
| |
|
protectedvirtual |
Coroutine handling the temporary change of condition mandated by ChangeCharacterConditionTemporarily
- Parameters
-
newCondition | |
duration | |
resetControllerForces | |
disableGravity | |
- Returns
◆ Disable()
virtual void MoreMountains.TopDownEngine.Character.Disable |
( |
| ) |
|
|
virtual |
Called to disable the player (at the end of a level for example. It won't move and respond to input after this.
◆ EarlyProcessAbilities()
virtual void MoreMountains.TopDownEngine.Character.EarlyProcessAbilities |
( |
| ) |
|
|
protectedvirtual |
Calls all registered abilities' Early Process methods
◆ EveryFrame()
virtual void MoreMountains.TopDownEngine.Character.EveryFrame |
( |
| ) |
|
|
protectedvirtual |
We do this every frame. This is separate from Update for more flexibility.
◆ FindAbilities< T >()
List<T> MoreMountains.TopDownEngine.Character.FindAbilities< T > |
( |
| ) |
|
A method to check whether a Character has a certain ability or not
- Template Parameters
-
- Returns
◆ FindAbility< T >()
T MoreMountains.TopDownEngine.Character.FindAbility< T > |
( |
| ) |
|
A method to check whether a Character has a certain ability or not
- Template Parameters
-
- Returns
◆ FindAbilityByString()
CharacterAbility MoreMountains.TopDownEngine.Character.FindAbilityByString |
( |
string |
abilityName | ) |
|
A method to check whether a Character has a certain ability or not
- Template Parameters
-
- Returns
◆ FixedUpdate()
void MoreMountains.TopDownEngine.Character.FixedUpdate |
( |
| ) |
|
|
protected |
◆ FlipAllAbilities()
virtual void MoreMountains.TopDownEngine.Character.FlipAllAbilities |
( |
| ) |
|
|
virtual |
Calls flip on all abilities
◆ ForceAbilitiesInitialization()
virtual void MoreMountains.TopDownEngine.Character.ForceAbilitiesInitialization |
( |
| ) |
|
|
virtual |
Forces the (re)initialization of the character's abilities
◆ Freeze()
virtual void MoreMountains.TopDownEngine.Character.Freeze |
( |
| ) |
|
|
virtual |
◆ Initialization()
virtual void MoreMountains.TopDownEngine.Character.Initialization |
( |
| ) |
|
|
protectedvirtual |
Gets and stores input manager, camera and components
◆ InitializeAnimatorParameters()
virtual void MoreMountains.TopDownEngine.Character.InitializeAnimatorParameters |
( |
| ) |
|
|
protectedvirtual |
Initializes the animator parameters.
◆ LateProcessAbilities()
virtual void MoreMountains.TopDownEngine.Character.LateProcessAbilities |
( |
| ) |
|
|
protectedvirtual |
Calls all registered abilities' Late Process methods
◆ OnDeath()
virtual void MoreMountains.TopDownEngine.Character.OnDeath |
( |
| ) |
|
|
protectedvirtual |
◆ OnDisable()
virtual void MoreMountains.TopDownEngine.Character.OnDisable |
( |
| ) |
|
|
protectedvirtual |
OnDisable, we unregister our OnRevive event
◆ OnEnable()
virtual void MoreMountains.TopDownEngine.Character.OnEnable |
( |
| ) |
|
|
protectedvirtual |
OnEnable, we register our OnRevive event
◆ OnHit()
virtual void MoreMountains.TopDownEngine.Character.OnHit |
( |
| ) |
|
|
protectedvirtual |
◆ OnRevive()
virtual void MoreMountains.TopDownEngine.Character.OnRevive |
( |
| ) |
|
|
protectedvirtual |
On revive, we force the spawn direction
◆ ProcessAbilities()
virtual void MoreMountains.TopDownEngine.Character.ProcessAbilities |
( |
| ) |
|
|
protectedvirtual |
Calls all registered abilities' Process methods
◆ Reset()
virtual void MoreMountains.TopDownEngine.Character.Reset |
( |
| ) |
|
|
virtual |
Called when the Character dies. Calls every abilities' Reset() method, so you can restore settings to their original value if needed
◆ ResetInput()
virtual void MoreMountains.TopDownEngine.Character.ResetInput |
( |
| ) |
|
|
virtual |
Resets the input for all abilities
◆ RespawnAt() [1/2]
virtual void MoreMountains.TopDownEngine.Character.RespawnAt |
( |
Transform |
spawnPoint, |
|
|
FacingDirections |
facingDirection |
|
) |
| |
|
virtual |
Makes the player respawn at the location passed in parameters
- Parameters
-
spawnPoint | The location of the respawn. |
◆ RespawnAt() [2/2]
virtual void MoreMountains.TopDownEngine.Character.RespawnAt |
( |
Vector3 |
spawnPosition, |
|
|
FacingDirections |
facingDirection |
|
) |
| |
|
virtual |
◆ SetCameraDirection()
virtual void MoreMountains.TopDownEngine.Character.SetCameraDirection |
( |
Vector3 |
direction | ) |
|
|
virtual |
Stores the associated camera direction
◆ SetInputManager() [1/2]
virtual void MoreMountains.TopDownEngine.Character.SetInputManager |
( |
| ) |
|
|
virtual |
◆ SetInputManager() [2/2]
virtual void MoreMountains.TopDownEngine.Character.SetInputManager |
( |
InputManager |
inputManager | ) |
|
|
virtual |
Sets a new input manager for this Character and all its abilities
- Parameters
-
◆ SetPlayerID()
virtual void MoreMountains.TopDownEngine.Character.SetPlayerID |
( |
string |
newPlayerID | ) |
|
|
virtual |
Sets the player ID
- Parameters
-
newPlayerID | New player ID. |
◆ UnFreeze()
virtual void MoreMountains.TopDownEngine.Character.UnFreeze |
( |
| ) |
|
|
virtual |
◆ Update()
virtual void MoreMountains.TopDownEngine.Character.Update |
( |
| ) |
|
|
protectedvirtual |
This is called every frame.
◆ UpdateAnimationRandomNumber()
virtual void MoreMountains.TopDownEngine.Character.UpdateAnimationRandomNumber |
( |
| ) |
|
|
protectedvirtual |
Generates a random number to send to the animator
◆ UpdateAnimators()
virtual void MoreMountains.TopDownEngine.Character.UpdateAnimators |
( |
| ) |
|
|
protectedvirtual |
This is called at Update() and sets each of the animators parameters to their corresponding State values
◆ UpdateInputManagersInAbilities()
virtual void MoreMountains.TopDownEngine.Character.UpdateInputManagersInAbilities |
( |
| ) |
|
|
protectedvirtual |
Updates the linked input manager for all abilities
◆ _abilitiesCachedOnce
bool MoreMountains.TopDownEngine.Character._abilitiesCachedOnce = false |
|
protected |
◆ _aliveAnimationParameter
int MoreMountains.TopDownEngine.Character._aliveAnimationParameter |
|
protected |
◆ _aliveAnimationParameterName
const string MoreMountains.TopDownEngine.Character._aliveAnimationParameterName = "Alive" |
|
staticprotected |
◆ _animatorInitialized
bool MoreMountains.TopDownEngine.Character._animatorInitialized = false |
|
protected |
◆ _animatorRandomNumber
float MoreMountains.TopDownEngine.Character._animatorRandomNumber |
|
protected |
◆ _characterAbilities
◆ _characterPersistence
◆ _conditionChangeCoroutine
Coroutine MoreMountains.TopDownEngine.Character._conditionChangeCoroutine |
|
protected |
◆ _controller
◆ _currentSpeedAnimationParameter
int MoreMountains.TopDownEngine.Character._currentSpeedAnimationParameter |
|
protected |
◆ _currentSpeedAnimationParameterName
const string MoreMountains.TopDownEngine.Character._currentSpeedAnimationParameterName = "CurrentSpeed" |
|
staticprotected |
◆ _groundedAnimationParameter
int MoreMountains.TopDownEngine.Character._groundedAnimationParameter |
|
protected |
◆ _groundedAnimationParameterName
const string MoreMountains.TopDownEngine.Character._groundedAnimationParameterName = "Grounded" |
|
staticprotected |
◆ _idleAnimationParameter
int MoreMountains.TopDownEngine.Character._idleAnimationParameter |
|
protected |
◆ _idleAnimationParameterName
const string MoreMountains.TopDownEngine.Character._idleAnimationParameterName = "Idle" |
|
staticprotected |
◆ _lastState
◆ _onReviveRegistered
bool MoreMountains.TopDownEngine.Character._onReviveRegistered |
|
protected |
◆ _randomAnimationParameter
int MoreMountains.TopDownEngine.Character._randomAnimationParameter |
|
protected |
◆ _randomAnimationParameterName
const string MoreMountains.TopDownEngine.Character._randomAnimationParameterName = "Random" |
|
staticprotected |
◆ _randomConstantAnimationParameter
int MoreMountains.TopDownEngine.Character._randomConstantAnimationParameter |
|
protected |
◆ _randomConstantAnimationParameterName
const string MoreMountains.TopDownEngine.Character._randomConstantAnimationParameterName = "RandomConstant" |
|
staticprotected |
◆ _spawnDirectionForced
bool MoreMountains.TopDownEngine.Character._spawnDirectionForced = false |
|
protected |
◆ _thisPositionLastFrame
Vector3 MoreMountains.TopDownEngine.Character._thisPositionLastFrame |
|
protected |
◆ _transformVelocity
Vector3 MoreMountains.TopDownEngine.Character._transformVelocity |
|
protected |
◆ _transformVelocityXAnimationParameter
int MoreMountains.TopDownEngine.Character._transformVelocityXAnimationParameter |
|
protected |
◆ _transformVelocityXAnimationParameterName
const string MoreMountains.TopDownEngine.Character._transformVelocityXAnimationParameterName = "TransformVelocityX" |
|
staticprotected |
◆ _transformVelocityYAnimationParameter
int MoreMountains.TopDownEngine.Character._transformVelocityYAnimationParameter |
|
protected |
◆ _transformVelocityYAnimationParameterName
const string MoreMountains.TopDownEngine.Character._transformVelocityYAnimationParameterName = "TransformVelocityY" |
|
staticprotected |
◆ _transformVelocityZAnimationParameter
int MoreMountains.TopDownEngine.Character._transformVelocityZAnimationParameter |
|
protected |
◆ _transformVelocityZAnimationParameterName
const string MoreMountains.TopDownEngine.Character._transformVelocityZAnimationParameterName = "TransformVelocityZ" |
|
staticprotected |
◆ _xSpeedAnimationParameter
int MoreMountains.TopDownEngine.Character._xSpeedAnimationParameter |
|
protected |
◆ _xSpeedAnimationParameterName
const string MoreMountains.TopDownEngine.Character._xSpeedAnimationParameterName = "xSpeed" |
|
staticprotected |
◆ _xVelocityAnimationParameter
int MoreMountains.TopDownEngine.Character._xVelocityAnimationParameter |
|
protected |
◆ _xVelocityAnimationParameterName
const string MoreMountains.TopDownEngine.Character._xVelocityAnimationParameterName = "xVelocity" |
|
staticprotected |
◆ _ySpeedAnimationParameter
int MoreMountains.TopDownEngine.Character._ySpeedAnimationParameter |
|
protected |
◆ _ySpeedAnimationParameterName
const string MoreMountains.TopDownEngine.Character._ySpeedAnimationParameterName = "ySpeed" |
|
staticprotected |
◆ _yVelocityAnimationParameter
int MoreMountains.TopDownEngine.Character._yVelocityAnimationParameter |
|
protected |
◆ _yVelocityAnimationParameterName
const string MoreMountains.TopDownEngine.Character._yVelocityAnimationParameterName = "yVelocity" |
|
staticprotected |
◆ _zSpeedAnimationParameter
int MoreMountains.TopDownEngine.Character._zSpeedAnimationParameter |
|
protected |
◆ _zSpeedAnimationParameterName
const string MoreMountains.TopDownEngine.Character._zSpeedAnimationParameterName = "zSpeed" |
|
staticprotected |
◆ _zVelocityAnimationParameter
int MoreMountains.TopDownEngine.Character._zVelocityAnimationParameter |
|
protected |
◆ _zVelocityAnimationParameterName
const string MoreMountains.TopDownEngine.Character._zVelocityAnimationParameterName = "zVelocity" |
|
staticprotected |
◆ AdditionalAbilityNodes
List<GameObject> MoreMountains.TopDownEngine.Character.AdditionalAbilityNodes |
A list of gameobjects (usually nested under the Character) under which to search for additional abilities.
◆ CharacterAnimator
Animator MoreMountains.TopDownEngine.Character.CharacterAnimator |
◆ CharacterBrain
AIBrain MoreMountains.TopDownEngine.Character.CharacterBrain |
The brain currently associated with this character, if it's an Advanced AI. By default the engine will pick the one on this object, but you can attach another one if you'd like.
◆ CharacterDimension
◆ CharacterHealth
Health MoreMountains.TopDownEngine.Character.CharacterHealth |
the Health script associated to this Character, will be grabbed automatically if left empty
◆ CharacterModel
GameObject MoreMountains.TopDownEngine.Character.CharacterModel |
the 'model' (can be any gameobject) used to manipulate the character. Ideally it's separated (and nested) from the collider/TopDown controller/abilities, to avoid messing with collisions.
◆ CharacterType
Is the character player-controlled or controlled by an AI ?
◆ ConditionState
◆ DisableAnimatorLogs
bool MoreMountains.TopDownEngine.Character.DisableAnimatorLogs = true |
if this is true, animator logs for the associated animator will be turned off to avoid potential spam
◆ MovementState
◆ OptimizeForMobile
bool MoreMountains.TopDownEngine.Character.OptimizeForMobile = true |
Whether to optimize this character for mobile. Will disable its cone of vision on mobile.
◆ PlayerID
string MoreMountains.TopDownEngine.Character.PlayerID = "" |
Only used if the character is player-controlled. The PlayerID must match an input manager's PlayerID. It's also used to match Unity's input settings. So you'll be safe if you keep to Player1, Player2, Player3 or Player4.
◆ RunAnimatorSanityChecks
bool MoreMountains.TopDownEngine.Character.RunAnimatorSanityChecks = false |
If this is true, sanity checks will be performed to make sure animator parameters exist before updating them. Turning this to false will increase performance but will throw errors if you're trying to update non existing parameters. Make sure your animator has the required parameters.
◆ SendStateChangeEvents
bool MoreMountains.TopDownEngine.Character.SendStateChangeEvents = true |
If this is true, the Character's state machine will emit events when entering/exiting a state.
◆ UseDefaultMecanim
bool MoreMountains.TopDownEngine.Character.UseDefaultMecanim = true |
Set this to false if you want to implement your own animation system.
◆ _animator
virtual Animator MoreMountains.TopDownEngine.Character._animator |
|
getprotected set |
the animator associated to this character
◆ _animatorParameters
virtual HashSet<int> MoreMountains.TopDownEngine.Character._animatorParameters |
|
getset |
a list of animator parameters
◆ CameraDirection
virtual Vector3 MoreMountains.TopDownEngine.Character.CameraDirection |
|
getprotected set |
the direction of the camera associated to this character
◆ CameraTarget
virtual GameObject MoreMountains.TopDownEngine.Character.CameraTarget |
|
getset |
an object to use as the camera's point of focus and follow target
◆ CharacterState
virtual CharacterStates MoreMountains.TopDownEngine.Character.CharacterState |
|
getprotected set |
the various states of the character
◆ LinkedInputManager
virtual InputManager MoreMountains.TopDownEngine.Character.LinkedInputManager |
|
getprotected set |
associated camera and input manager
◆ Orientation2D
this character's orientation 2D ability
◆ Orientation3D
this character's orientation 3D ability
The documentation for this class was generated from the following file:
- F:/Github/Store/TopDownEngine/Assets/TopDownEngine/Common/Scripts/Characters/Core/Character.cs