platformer
Public Member Functions | Public Attributes | List of all members
UnityPlatformer.CharacterActionGrab Class Reference

Character Grab 'something', is centered and stop. ex: grab a ring More...

Inheritance diagram for UnityPlatformer.CharacterActionGrab:
UnityPlatformer.CharacterAction

Public Member Functions

override void OnEnable ()
 keep Character.actions in sync More...
 
override int WantsToUpdate (float delta)
 Tells the character we want to take control More...
 
override void GainControl (float delta)
 EnterState and start centering More...
 
override void LoseControl (float delta)
 ExitState and no centering More...
 
override void PerformAction (float delta)
 Do your action here. More...
 
override PostUpdateActions GetPostUpdateActions ()
 Return what to do next. More...
 
- Public Member Functions inherited from UnityPlatformer.CharacterAction
void Reset ()
 Try to set character & input from parent nodes More...
 
virtual void OnDisable ()
 keep Character.actions in sync More...
 

Public Attributes

float towardsSpeed = 32
 Maximum speed to snap to the center. More...
 
float towardsTime = 0.1f
 Time to reach the center (if towardsSpeed is fast enough). More...
 
bool moveToCenter = false
 Move character to the center of the grabArea More...
 
Vector3 grabbingOffset = new Vector3(0, 0, 0)
 Character offset position while grabbing More...
 
bool dismountPressingDown = true
 Dismount 'Grab' pressing down axis More...
 
bool dismountJumping = true
 Dismount 'Grab' jumping More...
 
JumpConstantProperties jumpOff = new JumpConstantProperties(new Vector2(20, 20))
 Dismount jump properties More...
 
int priority = 20
 Action priority More...
 
float grabAgainCooldown = 0.25f
 Time after dismount before being able to grab again. More...
 
- Public Attributes inherited from UnityPlatformer.CharacterAction
Character character
 Target character that will be affected by this movement More...
 
PlatformerInput input
 Input to listen More...
 
Action onGrainControl
 Callback when this movement WantsToUpdate and has highest priority. More...
 
Action onLoseControl
 Callback when this movement don't WantsToUpdate or another movement has higher priority More...
 

Detailed Description

Character Grab 'something', is centered and stop. ex: grab a ring

Member Function Documentation

◆ GainControl()

override void UnityPlatformer.CharacterActionGrab.GainControl ( float  delta)
inlinevirtual

EnterState and start centering

Reimplemented from UnityPlatformer.CharacterAction.

◆ GetPostUpdateActions()

override PostUpdateActions UnityPlatformer.CharacterActionGrab.GetPostUpdateActions ( )
inlinevirtual

Return what to do next.

By default should be: APPLY_GRAVITY | WORLD_COLLISIONS

Implements UnityPlatformer.CharacterAction.

◆ LoseControl()

override void UnityPlatformer.CharacterActionGrab.LoseControl ( float  delta)
inlinevirtual

ExitState and no centering

Reimplemented from UnityPlatformer.CharacterAction.

◆ OnEnable()

override void UnityPlatformer.CharacterActionGrab.OnEnable ( )
inlinevirtual

keep Character.actions in sync

Reimplemented from UnityPlatformer.CharacterAction.

◆ PerformAction()

override void UnityPlatformer.CharacterActionGrab.PerformAction ( float  delta)
inlinevirtual

Do your action here.

Implements UnityPlatformer.CharacterAction.

◆ WantsToUpdate()

override int UnityPlatformer.CharacterActionGrab.WantsToUpdate ( float  delta)
inlinevirtual

Tells the character we want to take control

  • Positive numbers fight: Higher number wins
  • Negative numbers are used to ignore fight and force Character to call PerformAction, but! because it doesn't win the fight onLoseControl, onGrainControl and GetPostUpdateActions are ignored.
    NOTE can be used as a replace for UpdateManager.PlatformerUpdate

Implements UnityPlatformer.CharacterAction.

Member Data Documentation

◆ dismountJumping

bool UnityPlatformer.CharacterActionGrab.dismountJumping = true

Dismount 'Grab' jumping

◆ dismountPressingDown

bool UnityPlatformer.CharacterActionGrab.dismountPressingDown = true

Dismount 'Grab' pressing down axis

◆ grabAgainCooldown

float UnityPlatformer.CharacterActionGrab.grabAgainCooldown = 0.25f

Time after dismount before being able to grab again.

◆ grabbingOffset

Vector3 UnityPlatformer.CharacterActionGrab.grabbingOffset = new Vector3(0, 0, 0)

Character offset position while grabbing

◆ jumpOff

JumpConstantProperties UnityPlatformer.CharacterActionGrab.jumpOff = new JumpConstantProperties(new Vector2(20, 20))

Dismount jump properties

◆ moveToCenter

bool UnityPlatformer.CharacterActionGrab.moveToCenter = false

Move character to the center of the grabArea

◆ priority

int UnityPlatformer.CharacterActionGrab.priority = 20

Action priority

◆ towardsSpeed

float UnityPlatformer.CharacterActionGrab.towardsSpeed = 32

Maximum speed to snap to the center.

◆ towardsTime

float UnityPlatformer.CharacterActionGrab.towardsTime = 0.1f

Time to reach the center (if towardsSpeed is fast enough).


The documentation for this class was generated from the following file: