![]() |
Platformer Pro
2.3.2
A platform game kit for Unity.
|
The root class for a character. This class ties together movement, animation, and other behaviours. More...
Public Member Functions | |
delegate void | NamedPropertySetter (object value) |
Delegate for setting a named property. More... | |
virtual void | OnChangeAnimationState () |
Raises the change animation state event. This version is public and it just triggers a resend not a change. More... | |
virtual void | Translate (float x, float y, bool applyTransformsInWorldSpace) |
Translate the character by the supplied amount. More... | |
virtual void | AddVelocity (float x, float y, bool velocityIsInWorldSpace) |
Adds velocity. More... | |
virtual void | SetVelocityX (float x) |
Sets X velocity. More... | |
virtual void | SetVelocityY (float y) |
Sets Y velocity. More... | |
virtual void | DoBaseCollisionsForRaycastType (RaycastType type) |
Executes base collisions for a given raycast collider type. Used by movements that require collision data. More... | |
virtual RaycastHit2D | GetClosestCollision (int i) |
Gets the closest collision for the collider from Colliders at the index i. Note this is generally the collissions from the previous frame when called by a movement during a transition check. More... | |
virtual Vector2 | ApplyBaseCollisionsForRaycastType (RaycastType type) |
Applies the base collisions for the given raycast collider type. More... | |
virtual void | ForceAnimation (AnimationState state, float minimumTime) |
Overrides the animation for the given amount of time. More... | |
virtual void | AddAnimationOverride (string overrideState) |
Adds an animation override. NOTE: Currently only one override is supported at a time. Note overrides are used to refer to an animator or layer override (depending on animation type) not forcing the override of a single animation which is done with ForceAnimation(). More... | |
virtual void | RemoveAnimationOverride (string overrideState) |
Removes an animation override. NOTE: Currently only one override is supported at a time. More... | |
virtual void | Damage (DamageInfo info) |
Damages the character which typically triggers some kind of damage animation. More... | |
virtual void | Kill (DamageInfo info) |
Kill the character which typically triggers some kind of death animation. More... | |
virtual void | Respawn (RespawnPoint r, int facingDirection) |
Respawn the character. Called by LevelManager. You generally wont call this directly. Note: this method is used to set a characters facing direction during respawn and it is NOT about where the character spawns. If you want to respawn your character at a specific respawn point you should use LevelManager.Respawn(Character character, string respawnPoint) More... | |
virtual void | Respawn () |
Respawn the character. Called by LevelManager.You generally wont call this directly. More... | |
virtual void | AboutToExitScene (string newSceneName) |
Called by something that will load a new level (without killing character). More... | |
virtual void | FinishedAttack (string name) |
Indicate current attack is finished. More... | |
virtual void | HitEnemy (IMob enemy, DamageInfo info) |
Called when the character hits an enemy. More... | |
virtual void | SetTaggedProperty (string name, object value) |
Sets the named property across all applicable movements. More... | |
virtual void | SetTaggedProperty (string name, object value, List< System.Type > excludedTypes) |
Sets the named property across all applicable movements. More... | |
virtual void | AddToTaggedProperty (string name, float value) |
Adds to the named property across all applicable movements. More... | |
virtual void | AddToTaggedProperty (string name, float value, List< System.Type > excludedTypes) |
Adds to the named property across all applicable movements. More... | |
virtual void | MultiplyTaggedProperty (string name, float value) |
Multiplies the named property across all applicable movements. More... | |
virtual void | MultiplyTaggedProperty (string name, float value, List< System.Type > excludedTypes) |
Multiplies the named property across all applicable movements. More... | |
virtual bool | IsColliderIgnored (Collider2D collider) |
Check if a given collider should be ignored in collisions. More... | |
virtual void | AddIgnoredCollider (Collider2D collider) |
Adds a collider to the list of ignored colliders. More... | |
virtual void | RemoveIgnoredCollider (Collider2D collider) |
Removes a collider from the list of ignored colliders. More... | |
virtual void | UpdateCurrentWall () |
![]() | |
virtual void | Validate (PlatformerProMonoBehaviour myTarget) |
Override this method if you want to provide custom validation. The actual code should be surrounded by the if UNITY_EDITOR / endif directive. More... | |
Public Attributes | |
float | feetLookAhead = DefaultFeetLookAhead |
How much extra we cast beyond the collider length when checking feet colliders. We do this so we can (for example) detect a landing state. More... | |
float | sideLookAhead = DefaultSideLookAhead |
How much extra we cast beyond the collider length when checking side colliders. We do this so we can (for example) detect a wall. More... | |
float | groundedLookAhead = DefaultGroundedLookAhead |
How much extra we cast beyond the collider length when checking feet colliders. We do this so we can (for example) detect a landing state. More... | |
bool | snapToGroundOnSlopesOnly = true |
If true snap to ground will only apply on slopes. More... | |
LayerMask | layerMask = 1 |
All layers that we collide with. Note that just because something is in this group it doesn't mean we do anything about collisions with it. For example this mask includes layers like ladders and triggers which are ignored when responding to collisions. More... | |
LayerMask | geometryLayerMask = 1 |
The layers that are considered when working out collisions. i.e. the things we can't move through. Layers in this mask must appear in the layerMask. More... | |
LayerMask | passthroughLayerMask |
The layers that the character can walk on top of but can passthrough in other directions. More... | |
float | fallSpeedForIgnoreHeadCollisions = DefaultFallSpeedForIgnoreHeadCollisions |
Usually set this very low as it gives smoother movement while falling. Can be an issue if you have platforms that move faster downwards than this speed. More... | |
float | timeForFallState = 0.1f |
How long do we need to wait before we change the state to falling. This stops minor ground preturbations causing us to trigger the fall animation. More... | |
float | terminalVelocity = DefaultTerminalVelocity |
Maximum fall speed (note that any individual movement may override this if it wants to). More... | |
bool | calculateSlopes = true |
Should we Calcualte slope angles for use by movements? More... | |
bool | rotateToSlopes = false |
Should we allow the character to walk on slopes? More... | |
float | maxSlopeRotation = DefaultMaxSlopeRotation |
How far can the character rotate in degrees. More... | |
float | rotationSpeed = DefaultRotationSpeed |
How fast the character rotates to match a slope. Measured in degrees per second. More... | |
float | upSlopeDeceleration = 0 |
Effect of walking up a slope on base max speed. 0 = none, 1 = reduce speed by sine of angle. More... | |
float | downSlopeAcceleration = 0 |
Effect of walking down a slope on base max speed. 0 = none, 1 = increase speed by sine of angle. More... | |
float | sideAngle = DefaultSideAngle |
The minimum angle at which a wall needs to be at for it to be considered a "side". More... | |
float | groundedLeeway = DefaultGroundedLeeway |
How long after leaving the ground are we still considered grounded? More... | |
float | passthroughLeeway = DefaultPassthroughLeeway |
At what point will a passthrough collider consider itself groudned. Too small and you fall through platforms. Too large and you snap oddly. Usually the default is okay unless you change gravity dramatically. More... | |
float | minFastFallPassthroughTime = DefaultMinFastFallPassthroughTime |
When we fall fast we need to consider passthroughs that we fell past but should have snapped to. However at the very peak of a jump this can cause us to snap oddly. This constant stops that happening by ignoring fall times smaller than this. More... | |
bool | switchCollidersOnDirectionChange |
Should we switch left and right colliders when the character changes direction (used for asymmetric characters). More... | |
CharacterRotationType | characterRotationType |
The type of slope rotation. More... | |
BasicRaycast[] | feetColliders |
The feet colliders. More... | |
BasicRaycast[] | leftColliders |
The left side colliders. More... | |
BasicRaycast[] | rightColliders |
The right side colliders. More... | |
BasicRaycast[] | headColliders |
The head colliders. More... | |
Static Public Attributes | |
const float | DefaultFeetLookAhead = 0.2f |
The default feet look ahead. More... | |
const float | DefaultGroundedLookAhead = 0.05f |
The default grounded look ahead. More... | |
const float | DefaultGroundedLeeway = 0.1f |
The default time after leaving ground for which the character is still conisdered to be on the ground. More... | |
const float | DefaultSideLookAhead = 0.1f |
The default side look ahead. More... | |
const float | DefaultPassthroughLeeway = -0.1f |
Deafult passthrough leeway. More... | |
const float | DefaultMinFastFallPassthroughTime = 0.5f |
Deafult min ast fall time leeway. More... | |
const float | DefaultFallSpeedForIgnoreHeadCollisions = 0.2f |
The default fall speed at which head collisions are ignored. More... | |
const float | DefaultTerminalVelocity = -15.0f |
Defauly terminal velocity More... | |
const float | DefaultMaxSlopeRotation = 50 |
The default max slope rotation. More... | |
const float | DefaultRotationSpeed = 180 |
The default rotation speed. More... | |
const float | DefaultSideAngle = 50 |
The default side angle. More... | |
Protected Member Functions | |
virtual void | OnChangeAnimationState (AnimationState state, AnimationState previousState) |
Raises the change animation state event. More... | |
virtual void | OnChangeAnimationState (AnimationState state, AnimationState previousState, int priority) |
Raises the change animation state event. More... | |
virtual void | OnSceneWillExit (string newSceneName) |
Raises the scene will exit event. More... | |
virtual void | OnRespawned () |
Raises the respawned event. More... | |
virtual void | OnAttackStarted () |
Raises the attack started event. More... | |
virtual void | OnAttackFinished (string name) |
Raises the attack finished event. More... | |
virtual void | OnAttackCausedDamage (IMob enemy, DamageInfo info) |
Raises the attack caused damage event. More... | |
virtual void | Init () |
Set up the character More... | |
virtual void | SetGrounded () |
Sets the grounded state by checking feet colliders. More... | |
virtual void | TransitionMovementControl () |
Pass control to the movement most suitable for the current state. More... | |
virtual void | DoBaseCollisions (RaycastType typeMask) |
Does the base collisions. More... | |
virtual void | CheckForLadder () |
Checks if we collided with a ladder. More... | |
virtual void | DoRotation () |
Rotate towards the target rotation. More... | |
virtual void | CalculateTargetRotation () |
Use the feet colliders to determine the target rotation. More... | |
virtual void | UpdateClosestColliders (RaycastType typeMask) |
Updates the closest colliders array for the given type mask, leaves other types alone. More... | |
virtual void | SwitchColliders () |
Switches left and right collider direction and flips position of all colliders about y axis. More... | |
virtual void | CreateNamedPropertiesDictionary () |
Creates the dictionary used for apply named proeprty changes. More... | |
Protected Attributes | |
bool | detectLaddersByTag |
Should we use a tag to detect ladders, default will use layer. More... | |
string | ladderLayerOrTagName |
Layers or tag name used for ladder detection. More... | |
Input | input |
Cached copy of the input. More... | |
bool | detectAllWalls |
Detect all walls for use by wall movements? More... | |
bool | detectWallsByTag |
Detect walls by tag or layer? More... | |
string | wallLayerOrTagName |
Layer or tag name for wall detection. More... | |
Transform | myTransform |
Cached copy of the characters transform. More... | |
BaseCollisions | baseMovement |
Cached reference to the base movement. More... | |
Movement[] | movements |
Cached references to all the movements. More... | |
int | activeMovement |
The index of the currently active movement in the movements array. More... | |
int | activeAttack |
The active attack. More... | |
int | defaultGroundMovement |
The index of the default ground movement in the movements array. More... | |
int | defaultAirMovement |
The index of the default air movement in the movements array. More... | |
int | defaultLadderMovement |
The index of the default ladder movement in the movements array. -1 for no ladder movement. More... | |
int | defaultWallMovement |
The index of the default wall movement in the movements array. -1 for no wall movement. More... | |
int | defaultDamageMovement |
The index of the default damage movement in the movements array. -1 for no damage movement. More... | |
int | defaultDeathMovement |
The index of the default death movement in the movements array. -1 for no death movement. More... | |
int | defaultAttackMovement |
The index of the default attack movement. More... | |
Gravity | gravity |
The class that does gravity movement. More... | |
Collider2D | currentLadder |
The current ladder collider or null if we don't have a ladder. More... | |
Collider2D | currentWall |
The current wall collider or null if we don't have a wall. More... | |
int | currentWallCollider |
The current wall collider direction. 1 for right, -1 for left, 0 for none. More... | |
AnimationState | animationState |
The caaracters current animation state. More... | |
Platform | parentPlatform |
The parent platform. More... | |
Transform | parentTransform |
The transform of th parent platform. More... | |
RaycastType | parentRaycastType |
Tracks the raycast type we are using for parent calculation. More... | |
BasicRaycast[] | colliders |
Cached reference to all colliders. Some funciton expect this to be ordered with feet colliders left to right at the start. More... | |
int[] | closestColliders |
Keeps track of the closest collisions. More... | |
float | slope |
If slopes are on this is the rotation we are rotating towards. More... | |
int | rotationPoint |
Position of the feet collider in the feet colliders array that we should rotate around. More... | |
int | animationPriority |
Current animations animation priority. More... | |
string | overrideState |
Current animation override. More... | |
AnimationState | forcedAnimationState |
The forced animation state. More... | |
float | forcedAnimationTime |
The time remaining to play the forced animation. More... | |
AnimationEventArgs | animationEventArgs |
A cached animation event args that we update so we don't need to allocate. More... | |
AttackEventArgs | attackEventArgs |
The cached attack event args. More... | |
ExtraDamageInfoEventArgs | damageEventArgs |
The cached damage event args. More... | |
float | ignoredSlope |
The angle of the ignored slope. More... | |
int | currentFacingDirection |
The direction currently faced. Used for switch collider calculations. More... | |
bool | grounded |
Local copy of grounded state. More... | |
List< BasicRaycast > | collidersToUseForWallCling |
A list of colliders that can be used for wall cling (i.e. only those high enough). More... | |
int | ladderLayerNumber = -1 |
Cached conversion of ladder layer to layer int. More... | |
int | wallLayerNumber = -1 |
Cached conversion of wall layer to layer int. More... | |
float | previousRotation |
The previous frames target rotation. More... | |
int | minimumWallColliders |
The minimum required colliders from the various Wall movements. More... | |
RaycastHit2D | EmptyRaycastHit = new RaycastHit2D() |
Cached empty ray cast hit. More... | |
Dictionary< string, List< System.Reflection.FieldInfo > > | namedProperties |
Dictionary of names properties to field info. More... | |
HashSet< Collider2D > | ignoredColliders |
A list of colliders to ingore during collisions. More... | |
DisabledInput | disabledInput |
Reference to the disabled input. Used when InputEnabled is set to false. More... | |
Input | cachedInput |
Cached input to the main input used when re-enabling input. More... | |
Properties | |
virtual CharacterHealth | CharacterHealth [get, protected set] |
Gets CharacterHealth for this Character. Can be null if Character does not have a CharacterHealth. More... | |
virtual ItemManager | ItemManager [get, protected set] |
Gets ItemManager for this Character. Can be null if Character does not have an ItemManager. More... | |
virtual PowerUpManager | PowerUpManager [get, protected set] |
Gets PowerUpManager for this Character. Can be null if Character does not have a PowerUpManager. More... | |
virtual Inventory | Inventory [get, protected set] |
Gets Inventory for this Character. Can be null if Character does not have an Inventory. More... | |
virtual EquipmentManager | EquipmentManager [get, protected set] |
Gets EquipmentManager for this Character. Can be null if Character does not have an EquipmentManager. More... | |
virtual Breath | Breath [get, protected set] |
Gets breath for this Character. Can be null if Character does not have Breath. More... | |
virtual int | PlayerId [get, set] |
Stores the player that is asociated with this Character. More... | |
virtual Transform | Transform [get] |
Gets cache copy of the transform. More... | |
virtual BasicRaycast[] | Colliders [get, set] |
Gets or sets the colliders. More... | |
virtual RaycastHit2D[][] | CurrentCollisions [get, protected set] |
Gets the current collisions. More... | |
virtual Input | Input [get] |
Gets the assigned input. More... | |
virtual Vector2 | Velocity [get, protected set] |
The characters velocity. For details of what this means see Character.VelocityType. More... | |
virtual Vector2 | PreviousVelocity [get, protected set] |
The characters velocity in the previous frame. More... | |
virtual VelocityType | VelocityType [get] |
How is the characters velocity currently represented. More... | |
virtual bool | Grounded [get, protected set] |
Returns true if we are grounded or false otherwise. More... | |
virtual bool | OnLadder [get, protected set] |
If the character is currently controlled by a ladder the character is considered to be on ladder. More... | |
virtual float | TimeSinceGrounded [get, protected set] |
Tracks how much time has passed since the character was last grounded. More... | |
virtual float | TimeSinceGroundedOrOnLadder [get, protected set] |
Tracks how much time has passed since the character was last grounded OR on a ladder. Useful for movements that can happen when grounded or when a ladder (like jump). More... | |
virtual float | TimeFalling [get, protected set] |
Tracks how much time has passed since the character started falling. More... | |
virtual float | TimeSinceSlope [get, protected set] |
Tracks how much time has passed since the character was on a slope. More... | |
virtual float | DefaultGravity [get] |
Gets the default value of gravity. More... | |
virtual float | Gravity [get] |
Gets the current value of gravity. More... | |
virtual Collider2D | CurrentLadder [get] |
Gets the current ladder or null if no ladder in range. More... | |
virtual Collider2D | CurrentWall [get] |
Gets the current wall or null if no wall in range. More... | |
virtual int | CurrentWallCollider [get] |
Gets the current wall collider More... | |
float | BottomOfFeet [get] |
Returns the y position (in world space) of the bottom of the characters feet. More... | |
float | RightExtent [get] |
Returns the x position (in world space) of the rightmost of the characters colliders. More... | |
float | LeftExtent [get] |
Returns the x position (in world space) of the leftmost of the characters colliders. More... | |
virtual AnimationState | AnimationState [get, protected set] |
The characters current animation state. More... | |
virtual int | FacingDirection [get] |
Returns the direction the character is facing. 0 for none, 1 for right, -1 for left. More... | |
virtual int? | LastFacedDirection [get] |
Returns the direction the character is facing, but if direction is currently 0 instead returns the direction last faced. More... | |
virtual RaycastType | ParentRaycastType [get, set] |
Gets or sets the type of the raycast for the parent platform. Value has no meaning if not parented. More... | |
virtual Platform | ParentPlatform [get, set] |
Gets or sets the parent platform. More... | |
virtual Platform | StoodOnPlatform [get, set] |
Gets or sets the platform the charater is currently standing on (even if they aren't parented to it). More... | |
virtual float | SlopeTargetRotation [get] |
If slopes are on this is the rotation we are rotating towards. More... | |
float | SlopeActualRotation [get] |
If slopes are on this is the rotation we are currently at. More... | |
float | PreviousRotation [get, protected set] |
If slopes are on this is the rotation we were previously targetting. NOTE: This is actually target rotation from 2 frames ago, as if we use one we often get the delta angle between the real target and the new angle due to the transition frame. More... | |
virtual float | MinSideAngle [get] |
Gets the minimum angle at which geometry is considered a wall. More... | |
virtual float | Friction [get, set] |
Gets or sets the current friction value or -1 if the movement should use its own default. More... | |
virtual float | IgnoredSlope [get, set] |
Gets or sets the ignored slope. The ignored slope is used primary for internal physics calculations and is the largest slope that was ignored by the side colliders last frame. More... | |
virtual bool | IsGravityFlipped [get] |
Gets a value indicating whether this characters gravity has been flipped. More... | |
virtual string | OverrideState [get, protected set] |
Gets the animation override state. More... | |
virtual GroundMovement | DefaultGroundMovement [get] |
Gets the default ground movement. More... | |
virtual AirMovement | DefaultAirMovement [get] |
Gets the default air movement. More... | |
virtual Movement | ActiveMovement [get] |
Gets the currently active movement. More... | |
virtual bool | IsAttacking [get] |
Gets a value indicating whether this instance is attacking. More... | |
virtual float | AttackNormalisedTime [get] |
Gets the normalised time of the current attack or -1 if not attacking. More... | |
virtual string | AttackName [get] |
Gets the name of the current attack or null if not attacking. More... | |
virtual AttackLocation | AttackLocation [get] |
Gets the location of the current attack or ANY if not attacking More... | |
virtual bool | AttackHasHit [get] |
Returns true if the current attacks hit box has hit an enemy. More... | |
virtual int | ZLayer [get, set] |
Gets the characters current z layer. More... | |
virtual int | GroundLayer [get, set] |
Gets or sets the feet layer: the layer the character is currently standing on if grounded. More... | |
virtual Collider2D | GroundCollider [get, set] |
Gets or sets the feet collider: the collider the character is currently standing on if grounded. More... | |
virtual int | FootCount [get] |
How many feet colliders the character has; handy for some calculations. More... | |
virtual int | GroundedFootCount [get, set] |
How many feet colliders are on the ground. Usually called only from BaseCollissions. More... | |
virtual int | CurrentWallColliderCount [get, protected set] |
How many wall colliders hit the current wall this frame. More... | |
virtual bool | WouldHitHeadThisFrame [get, set] |
Did we hit our head this frame? More... | |
bool | InputEnabled [get, set] |
Gets or sets a value indicating whether input is enabled for this Character. More... | |
![]() | |
virtual string | Header [get] |
Gets the header string used to describe the component. More... | |
virtual string | DocLink [get] |
Gets a link to documentation site. More... | |
virtual string | VideoLink [get] |
Gets a link to a youtube video. More... | |
virtual string | Deprecated [get] |
If non-null this component is deprecated. The string shows a message indicating how it should be replaced. More... | |
![]() | |
AnimationState | AnimationState [get] |
The current animation state. More... | |
int | FacingDirection [get] |
Returns the direction being faced. 0 for none, 1 for right, -1 for left. More... | |
int | LastFacedDirection [get] |
Returns the direction being faced, but if direction is currently 0 instead returns the direction last faced. More... | |
Vector2 | Velocity [get] |
The characters velocity relative to self. More... | |
Vector2 | PreviousVelocity [get] |
The characters velocity in the previous frame relative to self. More... | |
float | SlopeTargetRotation [get] |
If slopes are on this is the rotation we are rotating towards. More... | |
float | SlopeActualRotation [get] |
If slopes are on this is the rotation we are currently on. More... | |
float | PreviousRotation [get] |
If slopes are on this is the rotation we were at last frame. More... | |
float | IgnoredSlope [get, set] |
Gets the ignored slope. The ignored slope is used primary for internal physics calculations and is the largest slope that was ignored by the side colliders last frame. More... | |
float | MinSideAngle [get] |
Gets the minimum angle at which geometry is considered a wall. More... | |
int | ZLayer [get, set] |
Gets or sets the characters current z layer. More... | |
bool | Grounded [get] |
Returns true if we are grounded or false otherwise. More... | |
int | GroundLayer [get] |
If grounded this is the layer of the ground. Undefined if not grounded. More... | |
float | Gravity [get] |
Gravity currently acting on the character. More... | |
float | Friction [get, set] |
Gets the friction. More... | |
Events | |
System.EventHandler< AnimationEventArgs > | ChangeAnimationState |
Event for animation state changes. More... | |
System.EventHandler< SceneEventArgs > | WillExitScene |
Event for scene exit. More... | |
System.EventHandler< CharacterEventArgs > | Respawned |
Event for respawning. More... | |
System.EventHandler< AttackEventArgs > | AttackStarted |
Event for attack starting. More... | |
System.EventHandler< AttackEventArgs > | AttackFinished |
Event for attack finishing. More... | |
System.EventHandler< ExtraDamageInfoEventArgs > | AttackCausedDamage |
Event for attack connecting. More... | |
![]() | |
System.EventHandler< AnimationEventArgs > | ChangeAnimationState |
Event for anmation state changes. More... | |
The root class for a character. This class ties together movement, animation, and other behaviours.
|
virtual |
Called by something that will load a new level (without killing character).
|
virtual |
Adds an animation override. NOTE: Currently only one override is supported at a time. Note overrides are used to refer to an animator or layer override (depending on animation type) not forcing the override of a single animation which is done with ForceAnimation().
overrideState | Override State, null values iwll be ignored. |
|
virtual |
Adds a collider to the list of ignored colliders.
collider | Collider. |
|
virtual |
Adds to the named property across all applicable movements.
name | Property name. |
value | Value to set. |
|
virtual |
Adds to the named property across all applicable movements.
name | Property name. |
value | Value to set. |
excludedTypes | Movements of this type will not have their value changed. |
|
virtual |
Adds velocity.
x | The velocity to add to x. |
y | The velocity to add to y. |
velocityIsInWorldSpace | If true the velocity will not added in world space, otherwise the velocity will be added in character space. |
|
virtual |
Applies the base collisions for the given raycast collider type.
type | Type. |
|
protectedvirtual |
Use the feet colliders to determine the target rotation.
|
protectedvirtual |
Checks if we collided with a ladder.
|
protectedvirtual |
Creates the dictionary used for apply named proeprty changes.
|
virtual |
Damages the character which typically triggers some kind of damage animation.
|
protectedvirtual |
Does the base collisions.
|
virtual |
Executes base collisions for a given raycast collider type. Used by movements that require collision data.
type | Raycast type. |
|
protectedvirtual |
Rotate towards the target rotation.
|
virtual |
Indicate current attack is finished.
|
virtual |
Overrides the animation for the given amount of time.
state | State. |
minimumTime | Minimum time. |
|
virtual |
Gets the closest collision for the collider from Colliders at the index i. Note this is generally the collissions from the previous frame when called by a movement during a transition check.
i | The index. |
|
virtual |
Called when the character hits an enemy.
enemy | Enemy that was hit. |
info | Damage info. |
|
protectedvirtual |
Set up the character
|
virtual |
Check if a given collider should be ignored in collisions.
true
if this instance is ignoring he specified collider; otherwise, false
.collider | Collider. |
Implements PlatformerPro.IMob.
|
virtual |
Kill the character which typically triggers some kind of death animation.
|
virtual |
Multiplies the named property across all applicable movements.
name | Property name. |
value | Value to set. |
|
virtual |
Multiplies the named property across all applicable movements.
name | Property name. |
value | Value to set. |
excludedTypes | Movements of this type will not have their value changed. |
delegate void PlatformerPro.Character.NamedPropertySetter | ( | object | value | ) |
Delegate for setting a named property.
|
protectedvirtual |
Raises the attack caused damage event.
enemy | Enemy. |
info | Info. |
|
protectedvirtual |
Raises the attack finished event.
|
protectedvirtual |
Raises the attack started event.
|
virtual |
Raises the change animation state event. This version is public and it just triggers a resend not a change.
|
protectedvirtual |
Raises the change animation state event.
state | Current state. |
previousState | Previous state. |
|
protectedvirtual |
Raises the change animation state event.
state | Current state. |
previousState | Previous state. |
priority | Animaton state priority. |
|
protectedvirtual |
Raises the respawned event.
|
protectedvirtual |
Raises the scene will exit event.
newSceneName | New scene name. |
|
virtual |
Removes an animation override. NOTE: Currently only one override is supported at a time.
overrideState | Override State, will be removed if it matches current value. Use empty string to remove all overrides. |
|
virtual |
Removes a collider from the list of ignored colliders.
collider | Collider. |
|
virtual |
Respawn the character. Called by LevelManager.You generally wont call this directly.
|
virtual |
Respawn the character. Called by LevelManager. You generally wont call this directly. Note: this method is used to set a characters facing direction during respawn and it is NOT about where the character spawns. If you want to respawn your character at a specific respawn point you should use LevelManager.Respawn(Character character, string respawnPoint)
r | Respawn point to use for Facing Direction |
facingDirection | Facing direction to set if the respawn point doesn't have a facing direction override. |
|
protectedvirtual |
Sets the grounded state by checking feet colliders.
|
virtual |
Sets the named property across all applicable movements.
name | Property name. |
value | Value to set. |
|
virtual |
Sets the named property across all applicable movements.
name | Property name. |
value | Value to set. |
excludedTypes | Movements of this type will not have their value changed. |
|
virtual |
|
virtual |
|
protectedvirtual |
Switches left and right collider direction and flips position of all colliders about y axis.
|
protectedvirtual |
Pass control to the movement most suitable for the current state.
|
virtual |
Translate the character by the supplied amount.
x | The x amount. |
y | The y amount. |
applyYTransformsInWorldSpace | Should transforms be in world space instead of relative to the character position? Default is true. |
Implements PlatformerPro.IMob.
|
protectedvirtual |
Updates the closest colliders array for the given type mask, leaves other types alone.
|
virtual |
|
protected |
The active attack.
|
protected |
The index of the currently active movement in the movements array.
|
protected |
A cached animation event args that we update so we don't need to allocate.
|
protected |
Current animations animation priority.
|
protected |
The caaracters current animation state.
|
protected |
The cached attack event args.
|
protected |
Cached reference to the base movement.
|
protected |
Cached input to the main input used when re-enabling input.
bool PlatformerPro.Character.calculateSlopes = true |
Should we Calcualte slope angles for use by movements?
CharacterRotationType PlatformerPro.Character.characterRotationType |
The type of slope rotation.
|
protected |
Keeps track of the closest collisions.
|
protected |
Cached reference to all colliders. Some funciton expect this to be ordered with feet colliders left to right at the start.
|
protected |
A list of colliders that can be used for wall cling (i.e. only those high enough).
|
protected |
The direction currently faced. Used for switch collider calculations.
|
protected |
The current ladder collider or null if we don't have a ladder.
|
protected |
The current wall collider or null if we don't have a wall.
|
protected |
The current wall collider direction. 1 for right, -1 for left, 0 for none.
|
protected |
The cached damage event args.
|
protected |
The index of the default air movement in the movements array.
|
protected |
The index of the default attack movement.
|
protected |
The index of the default damage movement in the movements array. -1 for no damage movement.
|
protected |
The index of the default death movement in the movements array. -1 for no death movement.
|
static |
The default fall speed at which head collisions are ignored.
|
static |
The default feet look ahead.
|
static |
The default time after leaving ground for which the character is still conisdered to be on the ground.
|
static |
The default grounded look ahead.
|
protected |
The index of the default ground movement in the movements array.
|
protected |
The index of the default ladder movement in the movements array. -1 for no ladder movement.
|
static |
The default max slope rotation.
|
static |
Deafult min ast fall time leeway.
|
static |
Deafult passthrough leeway.
|
static |
The default rotation speed.
|
static |
The default side angle.
|
static |
The default side look ahead.
|
static |
Defauly terminal velocity
|
protected |
The index of the default wall movement in the movements array. -1 for no wall movement.
|
protected |
Detect all walls for use by wall movements?
|
protected |
Should we use a tag to detect ladders, default will use layer.
|
protected |
Detect walls by tag or layer?
|
protected |
Reference to the disabled input. Used when InputEnabled is set to false.
float PlatformerPro.Character.downSlopeAcceleration = 0 |
Effect of walking down a slope on base max speed. 0 = none, 1 = increase speed by sine of angle.
|
protected |
Cached empty ray cast hit.
float PlatformerPro.Character.fallSpeedForIgnoreHeadCollisions = DefaultFallSpeedForIgnoreHeadCollisions |
Usually set this very low as it gives smoother movement while falling. Can be an issue if you have platforms that move faster downwards than this speed.
BasicRaycast [] PlatformerPro.Character.feetColliders |
The feet colliders.
float PlatformerPro.Character.feetLookAhead = DefaultFeetLookAhead |
How much extra we cast beyond the collider length when checking feet colliders. We do this so we can (for example) detect a landing state.
|
protected |
The forced animation state.
|
protected |
The time remaining to play the forced animation.
LayerMask PlatformerPro.Character.geometryLayerMask = 1 |
The layers that are considered when working out collisions. i.e. the things we can't move through. Layers in this mask must appear in the layerMask.
|
protected |
The class that does gravity movement.
|
protected |
Local copy of grounded state.
float PlatformerPro.Character.groundedLeeway = DefaultGroundedLeeway |
How long after leaving the ground are we still considered grounded?
float PlatformerPro.Character.groundedLookAhead = DefaultGroundedLookAhead |
How much extra we cast beyond the collider length when checking feet colliders. We do this so we can (for example) detect a landing state.
BasicRaycast [] PlatformerPro.Character.headColliders |
The head colliders.
|
protected |
A list of colliders to ingore during collisions.
|
protected |
The angle of the ignored slope.
|
protected |
Cached copy of the input.
|
protected |
Cached conversion of ladder layer to layer int.
|
protected |
Layers or tag name used for ladder detection.
The transform.
LayerMask PlatformerPro.Character.layerMask = 1 |
All layers that we collide with. Note that just because something is in this group it doesn't mean we do anything about collisions with it. For example this mask includes layers like ladders and triggers which are ignored when responding to collisions.
BasicRaycast [] PlatformerPro.Character.leftColliders |
The left side colliders.
float PlatformerPro.Character.maxSlopeRotation = DefaultMaxSlopeRotation |
How far can the character rotate in degrees.
float PlatformerPro.Character.minFastFallPassthroughTime = DefaultMinFastFallPassthroughTime |
When we fall fast we need to consider passthroughs that we fell past but should have snapped to. However at the very peak of a jump this can cause us to snap oddly. This constant stops that happening by ignoring fall times smaller than this.
|
protected |
The minimum required colliders from the various Wall movements.
|
protected |
Cached references to all the movements.
|
protected |
Cached copy of the characters transform.
|
protected |
Dictionary of names properties to field info.
|
protected |
Current animation override.
|
protected |
The parent platform.
|
protected |
Tracks the raycast type we are using for parent calculation.
|
protected |
The transform of th parent platform.
LayerMask PlatformerPro.Character.passthroughLayerMask |
The layers that the character can walk on top of but can passthrough in other directions.
float PlatformerPro.Character.passthroughLeeway = DefaultPassthroughLeeway |
At what point will a passthrough collider consider itself groudned. Too small and you fall through platforms. Too large and you snap oddly. Usually the default is okay unless you change gravity dramatically.
|
protected |
The previous frames target rotation.
BasicRaycast [] PlatformerPro.Character.rightColliders |
The right side colliders.
bool PlatformerPro.Character.rotateToSlopes = false |
Should we allow the character to walk on slopes?
|
protected |
Position of the feet collider in the feet colliders array that we should rotate around.
float PlatformerPro.Character.rotationSpeed = DefaultRotationSpeed |
How fast the character rotates to match a slope. Measured in degrees per second.
float PlatformerPro.Character.sideAngle = DefaultSideAngle |
The minimum angle at which a wall needs to be at for it to be considered a "side".
float PlatformerPro.Character.sideLookAhead = DefaultSideLookAhead |
How much extra we cast beyond the collider length when checking side colliders. We do this so we can (for example) detect a wall.
|
protected |
If slopes are on this is the rotation we are rotating towards.
bool PlatformerPro.Character.snapToGroundOnSlopesOnly = true |
If true snap to ground will only apply on slopes.
bool PlatformerPro.Character.switchCollidersOnDirectionChange |
Should we switch left and right colliders when the character changes direction (used for asymmetric characters).
float PlatformerPro.Character.terminalVelocity = DefaultTerminalVelocity |
Maximum fall speed (note that any individual movement may override this if it wants to).
float PlatformerPro.Character.timeForFallState = 0.1f |
How long do we need to wait before we change the state to falling. This stops minor ground preturbations causing us to trigger the fall animation.
float PlatformerPro.Character.upSlopeDeceleration = 0 |
Effect of walking up a slope on base max speed. 0 = none, 1 = reduce speed by sine of angle.
|
protected |
Cached conversion of wall layer to layer int.
|
protected |
Layer or tag name for wall detection.
|
get |
Gets the currently active movement.
|
getprotected set |
The characters current animation state.
|
get |
Returns true if the current attacks hit box has hit an enemy.
|
get |
Gets the location of the current attack or ANY if not attacking
|
get |
Gets the name of the current attack or null if not attacking.
|
get |
Gets the normalised time of the current attack or -1 if not attacking.
|
get |
Returns the y position (in world space) of the bottom of the characters feet.
|
getprotected set |
|
getprotected set |
Gets CharacterHealth for this Character. Can be null if Character does not have a CharacterHealth.
|
getset |
Gets or sets the colliders.
The colliders.
|
getprotected set |
Gets the current collisions.
|
get |
Gets the current ladder or null if no ladder in range.
The current ladder.
|
get |
Gets the current wall or null if no wall in range.
The current wall.
|
get |
Gets the current wall collider
The current wall.
|
getprotected set |
How many wall colliders hit the current wall this frame.
|
get |
Gets the default air movement.
|
get |
Gets the default value of gravity.
|
get |
Gets the default ground movement.
|
getprotected set |
Gets EquipmentManager for this Character. Can be null if Character does not have an EquipmentManager.
|
get |
Returns the direction the character is facing. 0 for none, 1 for right, -1 for left.
|
get |
How many feet colliders the character has; handy for some calculations.
|
getset |
Gets or sets the current friction value or -1 if the movement should use its own default.
|
get |
Gets the current value of gravity.
|
getset |
Gets or sets the feet collider: the collider the character is currently standing on if grounded.
|
getprotected set |
Returns true if we are grounded or false otherwise.
|
getset |
How many feet colliders are on the ground. Usually called only from BaseCollissions.
|
getset |
Gets or sets the feet layer: the layer the character is currently standing on if grounded.
|
getset |
Gets or sets the ignored slope. The ignored slope is used primary for internal physics calculations and is the largest slope that was ignored by the side colliders last frame.
The ignored slope.
|
get |
Gets the assigned input.
|
getset |
Gets or sets a value indicating whether input is enabled for this Character.
true
if input enabled; otherwise, false
.
|
getprotected set |
|
get |
Gets a value indicating whether this instance is attacking.
true
if this instance is attacking; otherwise, false
.
|
get |
Gets a value indicating whether this characters gravity has been flipped.
|
getprotected set |
Gets ItemManager for this Character. Can be null if Character does not have an ItemManager.
|
get |
Returns the direction the character is facing, but if direction is currently 0 instead returns the direction last faced.
|
get |
Returns the x position (in world space) of the leftmost of the characters colliders.
|
get |
Gets the minimum angle at which geometry is considered a wall.
|
getprotected set |
If the character is currently controlled by a ladder the character is considered to be on ladder.
|
getprotected set |
Gets the animation override state.
|
getset |
Gets or sets the parent platform.
|
getset |
Gets or sets the type of the raycast for the parent platform. Value has no meaning if not parented.
|
getset |
Stores the player that is asociated with this Character.
The player identifier.
|
getprotected set |
Gets PowerUpManager for this Character. Can be null if Character does not have a PowerUpManager.
|
getprotected set |
If slopes are on this is the rotation we were previously targetting. NOTE: This is actually target rotation from 2 frames ago, as if we use one we often get the delta angle between the real target and the new angle due to the transition frame.
|
getprotected set |
The characters velocity in the previous frame.
|
get |
Returns the x position (in world space) of the rightmost of the characters colliders.
|
get |
If slopes are on this is the rotation we are currently at.
|
get |
If slopes are on this is the rotation we are rotating towards.
|
getset |
Gets or sets the platform the charater is currently standing on (even if they aren't parented to it).
|
getprotected set |
Tracks how much time has passed since the character started falling.
|
getprotected set |
Tracks how much time has passed since the character was last grounded.
|
getprotected set |
Tracks how much time has passed since the character was last grounded OR on a ladder. Useful for movements that can happen when grounded or when a ladder (like jump).
|
getprotected set |
Tracks how much time has passed since the character was on a slope.
|
get |
Gets cache copy of the transform.
|
getprotected set |
The characters velocity. For details of what this means see Character.VelocityType.
|
get |
How is the characters velocity currently represented.
This is here because different classes of movements are often best implemented with different ways of representing velocity (for example for most platform ground movements X velocity is best handled as relative to character angle).
|
getset |
Did we hit our head this frame?
|
getset |
Gets the characters current z layer.
The Z layer.
System.EventHandler<ExtraDamageInfoEventArgs> PlatformerPro.Character.AttackCausedDamage |
Event for attack connecting.
System.EventHandler<AttackEventArgs> PlatformerPro.Character.AttackFinished |
Event for attack finishing.
System.EventHandler<AttackEventArgs> PlatformerPro.Character.AttackStarted |
Event for attack starting.
System.EventHandler<AnimationEventArgs> PlatformerPro.Character.ChangeAnimationState |
Event for animation state changes.
System.EventHandler<CharacterEventArgs> PlatformerPro.Character.Respawned |
Event for respawning.
System.EventHandler<SceneEventArgs> PlatformerPro.Character.WillExitScene |
Event for scene exit.