TopDown Engine
v3.6
|
Add this ability to a Character to have it move on a grid. This will require a GridManager be present in your scene DO NOT use that component and a CharacterMovement component on the same character. More...
Public Types | |
enum | GridDirections { GridDirections.None, GridDirections.Up, GridDirections.Down, GridDirections.Left, GridDirections.Right } |
the possible directions on the grid More... | |
enum | InputModes { InputModes.InputManager, InputModes.Script } |
the possible input modes More... | |
enum | DimensionModes { DimensionModes.TwoD, DimensionModes.ThreeD } |
the possible modes More... | |
Public Member Functions | |
virtual void | SetMovement (Vector2 newMovement) |
A public method used to set the character's direction (only in Script InputMode) More... | |
virtual void | LeftOneCell () |
Moves the character one cell to the left More... | |
virtual void | RightOneCell () |
Moves the character one cell to the right More... | |
virtual void | UpOneCell () |
Moves the character one cell up More... | |
virtual void | DownOneCell () |
Moves the character one cell down More... | |
virtual void | Left () |
Sets script movement to left More... | |
virtual void | Right () |
Sets script movement to right More... | |
virtual void | Up () |
Sets script movement to up More... | |
virtual void | Down () |
Sets script movement to down More... | |
virtual void | StopMovement () |
Stops script movement More... | |
virtual void | SetCurrentWorldPositionAsNewPosition () |
override void | ProcessAbility () |
The second of the 3 passes you can have in your ability. Think of it as Update() More... | |
virtual void | Stop (GridDirections direction) |
Stops the character and has it face the specified direction More... | |
override void | UpdateAnimator () |
Sends the current speed and the current value of the Walking state to the animator More... | |
Public Member Functions inherited from MoreMountains.TopDownEngine.CharacterAbility | |
delegate void | AbilityEvent () |
virtual string | HelpBoxText () |
This method is only used to display a helpbox text at the beginning of the ability's inspector. More... | |
virtual void | ForceInitialization () |
Call this any time you want to force this ability to initialize (again) More... | |
virtual void | ResetInput () |
Resets all input for this ability. Can be overridden for ability specific directives More... | |
virtual void | EarlyProcessAbility () |
The first of the 3 passes you can have in your ability. Think of it as EarlyUpdate() if it existed More... | |
virtual void | LateProcessAbility () |
The last of the 3 passes you can have in your ability. Think of it as LateUpdate() More... | |
virtual void | PermitAbility (bool abilityPermitted) |
Changes the status of the ability's permission More... | |
virtual void | Flip () |
Override this to specify what should happen in this ability when the character flips More... | |
virtual void | ResetAbility () |
Override this to reset this ability's parameters. It'll be automatically called when the character gets killed, in anticipation for its respawn. More... | |
virtual void | SetInputManager (InputManager newInputManager) |
Changes the reference to the input manager with the one set in parameters More... | |
virtual void | PlayAbilityStartSfx () |
Plays the ability start sound effect More... | |
virtual void | PlayAbilityUsedSfx () |
Plays the ability used sound effect More... | |
virtual void | StopAbilityUsedSfx () |
Stops the ability used sound effect More... | |
virtual void | PlayAbilityStopSfx () |
Plays the ability stop sound effect More... | |
virtual void | PlayAbilityStartFeedbacks () |
Plays the ability start sound effect More... | |
virtual void | StopStartFeedbacks () |
Stops the ability used sound effect More... | |
virtual void | PlayAbilityStopFeedbacks () |
Plays the ability stop sound effect More... | |
Public Attributes | |
float | MaximumSpeed = 8 |
the maximum speed of the character More... | |
float | Acceleration = 5 |
the acceleration of the character More... | |
float | CurrentSpeed |
the current speed at which the character is going More... | |
float | MaximumSpeedMultiplier = 1f |
a multiplier to apply to the maximum speed More... | |
float | AccelerationMultiplier = 1f |
a multiplier to apply to the acceleration, letting you modify it safely from outside More... | |
InputModes | InputMode = InputModes.InputManager |
whether to use the input manager or a script to feed the inputs More... | |
bool | UseInputBuffer = true |
whether or not input should be buffered (to anticipate the next turn) More... | |
int | BufferSize = 2 |
the size of the input buffer (in grid units) More... | |
bool | FastDirectionChanges = true |
whether or not the agent can perform fast direction changes such as U turns More... | |
float | IdleThreshold = 0.05f |
the speed threshold after which the character is not considered idle anymore More... | |
bool | NormalizedInput = false |
if this is true, movement values will be normalized - prefer checking this when using mobile controls More... | |
Vector3 | ObstacleDetectionOffset = new Vector3(0f, 0.5f, 0f) |
the offset to apply when detecting obstacles More... | |
bool | PerfectTile |
this is true everytime a character is at the exact position of a tile More... | |
Vector3Int | CurrentCellCoordinates |
the coordinates of the cell this character currently occupies More... | |
DimensionModes | DimensionMode = DimensionModes.TwoD |
whether this character is in 2D or 3D. This gets automatically computed at start More... | |
bool | LeftButton |
bool | RightButton |
bool | UpButton |
bool | DownButton |
bool | StopButton |
bool | LeftOneCellButton |
bool | RightOneCellButton |
bool | UpOneCellButton |
bool | DownOneCellButton |
Public Attributes inherited from MoreMountains.TopDownEngine.CharacterAbility | |
AudioClip | AbilityStartSfx |
the sound fx to play when the ability starts More... | |
AudioClip | AbilityInProgressSfx |
the sound fx to play while the ability is running More... | |
AudioClip | AbilityStopSfx |
the sound fx to play when the ability stops More... | |
MMFeedbacks | AbilityStartFeedbacks |
the feedbacks to play when the ability starts More... | |
MMFeedbacks | AbilityStopFeedbacks |
the feedbacks to play when the ability stops More... | |
bool | AbilityPermitted = true |
if true, this ability can perform as usual, if not, it'll be ignored. You can use this to unlock abilities over time for example More... | |
CharacterStates.MovementStates[] | BlockingMovementStates |
an array containing all the blocking movement states. If the Character is in one of these states and tries to trigger this ability, it won't be permitted. Useful to prevent this ability from being used while Idle or Swimming, for example. More... | |
CharacterStates.CharacterConditions[] | BlockingConditionStates |
an array containing all the blocking condition states. If the Character is in one of these states and tries to trigger this ability, it won't be permitted. Useful to prevent this ability from being used while dead, for example. More... | |
Weapon.WeaponStates[] | BlockingWeaponStates |
an array containing all the blocking weapon states. If one of the character's weapons is in one of these states and yet the character tries to trigger this ability, it won't be permitted. Useful to prevent this ability from being used while attacking, for example. More... | |
AbilityEvent | OnAbilityStart |
AbilityEvent | OnAbilityStop |
Protected Member Functions | |
virtual IEnumerator | OneCell (Vector2 direction) |
An internal coroutine used to move the character one cell in the specified direction More... | |
override void | Initialization () |
On Initialization, we set our movement speed to WalkSpeed. More... | |
virtual void | RegisterFirstPosition () |
Registers the first position to the GridManager More... | |
override void | HandleInput () |
Grabs horizontal and vertical input and stores them More... | |
virtual void | DetermineInputDirection () |
Based on press times, determines the input direction More... | |
virtual void | ApplyAcceleration () |
Modifies the current speed based on the acceleration More... | |
virtual void | HandleMovement () |
Moves the character on the grid More... | |
virtual void | ProcessBuffer () |
Processes buffered input More... | |
virtual void | DetermineEndPosition () |
Determines the end position based on the current direction More... | |
Vector3 | DimensionClamp (Vector3 newPosition) |
virtual Vector3Int | ConvertDirectionToVector3Int (GridDirections direction) |
Converts a GridDirection to a Vector3 based on the current D More... | |
virtual GridDirections | GetInverseDirection (GridDirections direction) |
Returns the opposite direction of a GridDirection More... | |
virtual void | HandleState () |
override void | OnDeath () |
On death we free our last occupied cell More... | |
override void | OnRespawn () |
On Respawn we force a reinitialization More... | |
override void | InitializeAnimatorParameters () |
Adds required animator parameters to the animator parameters list if they exist More... | |
Protected Member Functions inherited from MoreMountains.TopDownEngine.CharacterAbility | |
virtual void | Awake () |
On awake we proceed to pre initializing our ability More... | |
virtual void | Start () |
On Start(), we call the ability's intialization More... | |
virtual void | PreInitialization () |
A method you can override to have an initialization before the actual initialization More... | |
virtual void | BindAnimator () |
Binds the animator from the character and initializes the animator parameters More... | |
virtual void | InternalHandleInput () |
Internal method to check if an input manager is present or not More... | |
virtual void | RegisterAnimatorParameter (string parameterName, AnimatorControllerParameterType parameterType, out int parameter) |
Registers a new animator parameter to the list More... | |
virtual void | OnHit () |
Override this to describe what should happen to this ability when the character takes a hit More... | |
virtual void | OnEnable () |
On enable, we bind our respawn delegate More... | |
virtual void | OnDisable () |
On disable, we unbind our respawn delegate More... | |
Static Protected Attributes | |
const string | _speedAnimationParameterName = "Speed" |
const string | _walkingAnimationParameterName = "Walking" |
const string | _idleAnimationParameterName = "Idle" |
Properties | |
virtual Vector3Int | CurrentGridPosition [get, protected set] |
the position of the object on the grid More... | |
virtual Vector3Int | TargetGridPosition [get, protected set] |
the position the object will be at when it reaches its next perfect tile More... | |
Properties inherited from MoreMountains.TopDownEngine.CharacterAbility | |
virtual bool | AbilityAuthorized [get] |
virtual bool | AbilityInitialized [get] |
whether or not this ability has been initialized More... | |
Add this ability to a Character to have it move on a grid. This will require a GridManager be present in your scene DO NOT use that component and a CharacterMovement component on the same character.
|
protectedvirtual |
Modifies the current speed based on the acceleration
|
protectedvirtual |
Converts a GridDirection to a Vector3 based on the current D
direction |
|
protectedvirtual |
Determines the end position based on the current direction
|
protectedvirtual |
Based on press times, determines the input direction
|
protected |
|
virtual |
Sets script movement to down
|
virtual |
Moves the character one cell down
|
protectedvirtual |
Returns the opposite direction of a GridDirection
direction |
|
protectedvirtual |
Grabs horizontal and vertical input and stores them
Reimplemented from MoreMountains.TopDownEngine.CharacterAbility.
|
protectedvirtual |
Moves the character on the grid
|
protectedvirtual |
|
protectedvirtual |
On Initialization, we set our movement speed to WalkSpeed.
Reimplemented from MoreMountains.TopDownEngine.CharacterAbility.
|
protectedvirtual |
Adds required animator parameters to the animator parameters list if they exist
Reimplemented from MoreMountains.TopDownEngine.CharacterAbility.
|
virtual |
Sets script movement to left
|
virtual |
Moves the character one cell to the left
|
protectedvirtual |
On death we free our last occupied cell
Reimplemented from MoreMountains.TopDownEngine.CharacterAbility.
|
protectedvirtual |
An internal coroutine used to move the character one cell in the specified direction
direction |
|
protectedvirtual |
On Respawn we force a reinitialization
Reimplemented from MoreMountains.TopDownEngine.CharacterAbility.
|
virtual |
The second of the 3 passes you can have in your ability. Think of it as Update()
Reimplemented from MoreMountains.TopDownEngine.CharacterAbility.
|
protectedvirtual |
Processes buffered input
|
protectedvirtual |
Registers the first position to the GridManager
|
virtual |
Sets script movement to right
|
virtual |
Moves the character one cell to the right
|
virtual |
|
virtual |
A public method used to set the character's direction (only in Script InputMode)
newMovement |
|
virtual |
Stops the character and has it face the specified direction
direction |
|
virtual |
Stops script movement
|
virtual |
Sets script movement to up
|
virtual |
Sends the current speed and the current value of the Walking state to the animator
Reimplemented from MoreMountains.TopDownEngine.CharacterAbility.
|
virtual |
Moves the character one cell up
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
float MoreMountains.TopDownEngine.CharacterGridMovement.Acceleration = 5 |
the acceleration of the character
float MoreMountains.TopDownEngine.CharacterGridMovement.AccelerationMultiplier = 1f |
a multiplier to apply to the acceleration, letting you modify it safely from outside
int MoreMountains.TopDownEngine.CharacterGridMovement.BufferSize = 2 |
the size of the input buffer (in grid units)
Vector3Int MoreMountains.TopDownEngine.CharacterGridMovement.CurrentCellCoordinates |
the coordinates of the cell this character currently occupies
float MoreMountains.TopDownEngine.CharacterGridMovement.CurrentSpeed |
the current speed at which the character is going
DimensionModes MoreMountains.TopDownEngine.CharacterGridMovement.DimensionMode = DimensionModes.TwoD |
whether this character is in 2D or 3D. This gets automatically computed at start
bool MoreMountains.TopDownEngine.CharacterGridMovement.DownButton |
bool MoreMountains.TopDownEngine.CharacterGridMovement.DownOneCellButton |
bool MoreMountains.TopDownEngine.CharacterGridMovement.FastDirectionChanges = true |
whether or not the agent can perform fast direction changes such as U turns
float MoreMountains.TopDownEngine.CharacterGridMovement.IdleThreshold = 0.05f |
the speed threshold after which the character is not considered idle anymore
InputModes MoreMountains.TopDownEngine.CharacterGridMovement.InputMode = InputModes.InputManager |
whether to use the input manager or a script to feed the inputs
bool MoreMountains.TopDownEngine.CharacterGridMovement.LeftButton |
bool MoreMountains.TopDownEngine.CharacterGridMovement.LeftOneCellButton |
float MoreMountains.TopDownEngine.CharacterGridMovement.MaximumSpeed = 8 |
the maximum speed of the character
float MoreMountains.TopDownEngine.CharacterGridMovement.MaximumSpeedMultiplier = 1f |
a multiplier to apply to the maximum speed
bool MoreMountains.TopDownEngine.CharacterGridMovement.NormalizedInput = false |
if this is true, movement values will be normalized - prefer checking this when using mobile controls
Vector3 MoreMountains.TopDownEngine.CharacterGridMovement.ObstacleDetectionOffset = new Vector3(0f, 0.5f, 0f) |
the offset to apply when detecting obstacles
bool MoreMountains.TopDownEngine.CharacterGridMovement.PerfectTile |
this is true everytime a character is at the exact position of a tile
bool MoreMountains.TopDownEngine.CharacterGridMovement.RightButton |
bool MoreMountains.TopDownEngine.CharacterGridMovement.RightOneCellButton |
bool MoreMountains.TopDownEngine.CharacterGridMovement.StopButton |
bool MoreMountains.TopDownEngine.CharacterGridMovement.UpButton |
bool MoreMountains.TopDownEngine.CharacterGridMovement.UpOneCellButton |
bool MoreMountains.TopDownEngine.CharacterGridMovement.UseInputBuffer = true |
whether or not input should be buffered (to anticipate the next turn)
|
getprotected set |
the position of the object on the grid
|
getprotected set |
the position the object will be at when it reaches its next perfect tile