Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.SpecialMovement_GrapplingHook Class Reference

A grappling hook with various options. More...

Inheritance diagram for PlatformerPro.SpecialMovement_GrapplingHook:
PlatformerPro.SpecialMovement PlatformerPro.BaseMovement< SpecialMovement >

Public Member Functions

override Movement Init (Character character, MovementVariable[] movementData)
 Initialise the movement with the given movement data. More...
 
override bool WantsSpecialMove ()
 Gets a value indicating whether this movement wants to do a special move. More...
 
override void DoSpecialMove ()
 Start the special mvoe More...
 
virtual void Latch ()
 Called by the hook when it latches on to something. More...
 
virtual void CancelGrapple ()
 Cancels the grapple. More...
 
override void DoMove ()
 Moves the character. More...
 
override void LosingControl ()
 Called when the movement loses control. More...
 
- Public Member Functions inherited from PlatformerPro.BaseMovement< SpecialMovement >
sealed override Movement Init (Character character)
 Initialise this movement. More...
 
bool IsMovementDataDifferent (MovementVariable[] originalMovementData)
 Determines whether this instances movement data is different from the supplied originalMovementData. More...
 

Public Attributes

Vector2 handOffset
 Distance between characters transform and their hand. More...
 
float maxDistance
 The max distance the rope can travel. More...
 
GrapplingHookControlType controlType
 How we control the grapple. More...
 
bool canLaunchWhenGrounded
 Can we launch the grapple when gorunded? More...
 
float retractSpeed
 Speed at which the hook retracts (i.e speed which played moves up/down). More...
 
Vector2 launchVelocityBoost
 The additional boost we add to the swing velocity when player leaves grapple. More...
 
Vector2 launchVelocityMultiplier
 The additional multiplier applied swing velocity when player leaves grapple. More...
 
float slingshotRetractSpeed
 Speed at which the hook retracts (i.e speed which played moves up/down). More...
 
Vector2 slingshotLaunchVelocity
 Speed at which we slingshot. More...
 
float drag
 When retracting by how much do we speed up the swing? More...
 
float gravity
 Gravity to use when swinging. More...
 
GameObject grapplePrefab
 Prefab to use for the grapple. More...
 
GameObject ropePrefab
 Prefab to use for the rope. More...
 
SlowDownType slowDownType
 How do we slow down? More...
 

Protected Member Functions

virtual ButtonState GetGrappleButtonState ()
 Determines state of grapple button. More...
 
virtual void HandleInputs ()
 Handle inputs during the grapple More...
 
virtual void FireGrapple ()
 Fires the grapple. More...
 
virtual void DoRetract (int retractDirection)
 Does the retracting More...
 
virtual void DoSlingShot ()
 Launches the player with slingshot velocity More...
 
virtual void DrawRope ()
 Draws the rope. More...
 
virtual bool WouldHitSides ()
 Are we hitting our sides? If so cancel grapple. More...
 
virtual void DoSwing ()
 Does the swinging movement More...
 

Protected Attributes

ProjectileAimer aimer
 Cached reference to the projectile aimer. More...
 
GrapplingHookProjectile grapple
 Actual grappling hook. More...
 
GrapplingHookState state
 The state. More...
 
bool hasLeftGround
 Tracks if we have left the ground. More...
 
float ropeDistance
 Current distance between player and rope. More...
 
float buttonHeldTimer
 Slingshot after this timer reaches threshold. More...
 
bool buttonReleased
 Checks if the button is being held. More...
 
bool buttonHoldStarted
 Have we started to hold button. More...
 
GameObject ropeGo
 Gameobject for the rope. More...
 
Vector2 direction
 Direction from character to grapple. More...
 
float travelledDistance
 Tracks how far we have travelled up the rope since slingshot started. More...
 
float slingshotLaunchDistance
 Tracks the distance we have to travel before we slingshot. More...
 
float maxRopeDistance
 The max rope distance. More...
 
float swingTime
 Time we have been swinging for. More...
 
- Protected Attributes inherited from PlatformerPro.BaseMovement< SpecialMovement >
Movement implementation
 The class that will do the movement. More...
 
string movementType
 The type of movement as a string. More...
 
MovementVariable[] movementData
 Data that should be applied to the movement type on init. More...
 

Static Protected Attributes

const int HandOffsetIndex = 0
 The index of the hand offset in the movement data. More...
 
const int MaxDistanceIndex = 1
 The index of the max distance in the movement data. More...
 
const int ControlTypeIndex = 2
 The index of the control type in the movement data. More...
 
const int RetractSpeedIndex = 3
 The index of the retract speed in the movement data. More...
 
const int GravityIndex = 4
 The index of the gravity in the movement data. More...
 
const int GrapplePrefabIndex = 5
 The index of the grapple prefab in the movement data. More...
 
const int RopePrefabIndex = 6
 The index of the rope prefab in the movement data. More...
 
const int SlowDownTypeIndex = 7
 The index of the slow down type in the movement data. More...
 
const int DragIndex = 8
 The index of the drag in the movement data. More...
 
const int SlingshotRetractSpeedIndex = 9
 The index of the slingshot retract speed value in the movement data. More...
 
const int SlingshotLaunchVelocityIndex = 10
 The index of the slingshot launch velocity. More...
 
const int CanLaunchWhenGroundedIndex = 11
 The index of can launch when grounded. More...
 
const int LaunchVelocityBoostIndex = 12
 The index of launch velocity boost in the movement data. More...
 
const int LaunchVelocityMultiplierIndex = 13
 The index of launch velocity multiplier in the movement data. More...
 
const int MovementVariableCount = 14
 The size of the movement variable array in the movement data. More...
 
const float DefaultMaxDistance = 5.0f
 The default max distance. More...
 
const GrapplingHookControlType DefaultControlType = GrapplingHookControlType.AUTO_RETRACT
 The default type of the control. More...
 
const float DefaultRetractSpeed = 10.0f
 The default retract speed. More...
 
const float DefaultGravity = -50f
 The default gravity. More...
 
const float buttonHeldTime = 0.25f
 The button held time. More...
 
static Vector2 DefaultLaunchVelocityBoost = new Vector2(2.0f, 2.0f)
 The default launch velocity boost. More...
 
const float MaxRopeSlingshotDistance = 2.5f
 Maximum distance after which you will always slingshot. More...
 

Properties

new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
override bool ShouldApplyGravity [get]
 This class will handle gravity internally. More...
 
override int FacingDirection [get]
 Returns the direction the character is facing. 0 for none, 1 for right, -1 for left. This overriden version always returns the velocity direction. More...
 
Vector2 HandOffset [get]
 Gets the hand offset offset for facing direction. More...
 
override AnimationState AnimationState [get]
 Gets the animation state that this movement wants to set. More...
 
- Properties inherited from PlatformerPro.SpecialMovement
new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
- Properties inherited from PlatformerPro.BaseMovement< SpecialMovement >
virtual string MovementType [get, set]
 The type of movement as a string. More...
 
virtual MovementVariable[] MovementData [get, set]
 Data that should be applied to the movement type on init. More...
 
new static MovementInfo Info [get]
 Static movement info used by the editor. More...
 
override bool Enabled [get, set]
 A custom enable which base movements can use to pass on enable values. More...
 
override Movement Implementation [get]
 Gets the underlying implementation. More...
 

Detailed Description

A grappling hook with various options.

Member Function Documentation

◆ CancelGrapple()

virtual void PlatformerPro.SpecialMovement_GrapplingHook.CancelGrapple ( )
virtual

Cancels the grapple.

◆ DoMove()

override void PlatformerPro.SpecialMovement_GrapplingHook.DoMove ( )

Moves the character.

◆ DoRetract()

virtual void PlatformerPro.SpecialMovement_GrapplingHook.DoRetract ( int  retractDirection)
protectedvirtual

Does the retracting

Parameters
retractDirectionRetract direction, 1 for up -1 for down.

◆ DoSlingShot()

virtual void PlatformerPro.SpecialMovement_GrapplingHook.DoSlingShot ( )
protectedvirtual

Launches the player with slingshot velocity

◆ DoSpecialMove()

override void PlatformerPro.SpecialMovement_GrapplingHook.DoSpecialMove ( )
virtual

Start the special mvoe

Reimplemented from PlatformerPro.SpecialMovement.

◆ DoSwing()

virtual void PlatformerPro.SpecialMovement_GrapplingHook.DoSwing ( )
protectedvirtual

Does the swinging movement

◆ DrawRope()

virtual void PlatformerPro.SpecialMovement_GrapplingHook.DrawRope ( )
protectedvirtual

Draws the rope.

◆ FireGrapple()

virtual void PlatformerPro.SpecialMovement_GrapplingHook.FireGrapple ( )
protectedvirtual

Fires the grapple.

◆ GetGrappleButtonState()

virtual ButtonState PlatformerPro.SpecialMovement_GrapplingHook.GetGrappleButtonState ( )
protectedvirtual

Determines state of grapple button.

◆ HandleInputs()

virtual void PlatformerPro.SpecialMovement_GrapplingHook.HandleInputs ( )
protectedvirtual

Handle inputs during the grapple

◆ Init()

override Movement PlatformerPro.SpecialMovement_GrapplingHook.Init ( Character  character,
MovementVariable[]  movementData 
)

Initialise the movement with the given movement data.

Parameters
characterCharacter.
movementDataMovement data.

◆ Latch()

virtual void PlatformerPro.SpecialMovement_GrapplingHook.Latch ( )
virtual

Called by the hook when it latches on to something.

◆ LosingControl()

override void PlatformerPro.SpecialMovement_GrapplingHook.LosingControl ( )

Called when the movement loses control.

◆ WantsSpecialMove()

override bool PlatformerPro.SpecialMovement_GrapplingHook.WantsSpecialMove ( )
virtual

Gets a value indicating whether this movement wants to do a special move.

Reimplemented from PlatformerPro.SpecialMovement.

◆ WouldHitSides()

virtual bool PlatformerPro.SpecialMovement_GrapplingHook.WouldHitSides ( )
protectedvirtual

Are we hitting our sides? If so cancel grapple.

Member Data Documentation

◆ aimer

ProjectileAimer PlatformerPro.SpecialMovement_GrapplingHook.aimer
protected

Cached reference to the projectile aimer.

◆ buttonHeldTime

const float PlatformerPro.SpecialMovement_GrapplingHook.buttonHeldTime = 0.25f
staticprotected

The button held time.

ns

◆ buttonHeldTimer

float PlatformerPro.SpecialMovement_GrapplingHook.buttonHeldTimer
protected

Slingshot after this timer reaches threshold.

◆ buttonHoldStarted

bool PlatformerPro.SpecialMovement_GrapplingHook.buttonHoldStarted
protected

Have we started to hold button.

◆ buttonReleased

bool PlatformerPro.SpecialMovement_GrapplingHook.buttonReleased
protected

Checks if the button is being held.

◆ canLaunchWhenGrounded

bool PlatformerPro.SpecialMovement_GrapplingHook.canLaunchWhenGrounded

Can we launch the grapple when gorunded?

◆ CanLaunchWhenGroundedIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.CanLaunchWhenGroundedIndex = 11
staticprotected

The index of can launch when grounded.

◆ controlType

GrapplingHookControlType PlatformerPro.SpecialMovement_GrapplingHook.controlType

How we control the grapple.

◆ ControlTypeIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.ControlTypeIndex = 2
staticprotected

The index of the control type in the movement data.

◆ DefaultControlType

const GrapplingHookControlType PlatformerPro.SpecialMovement_GrapplingHook.DefaultControlType = GrapplingHookControlType.AUTO_RETRACT
staticprotected

The default type of the control.

◆ DefaultGravity

const float PlatformerPro.SpecialMovement_GrapplingHook.DefaultGravity = -50f
staticprotected

The default gravity.

◆ DefaultLaunchVelocityBoost

Vector2 PlatformerPro.SpecialMovement_GrapplingHook.DefaultLaunchVelocityBoost = new Vector2(2.0f, 2.0f)
staticprotected

The default launch velocity boost.

◆ DefaultMaxDistance

const float PlatformerPro.SpecialMovement_GrapplingHook.DefaultMaxDistance = 5.0f
staticprotected

The default max distance.

◆ DefaultRetractSpeed

const float PlatformerPro.SpecialMovement_GrapplingHook.DefaultRetractSpeed = 10.0f
staticprotected

The default retract speed.

◆ direction

Vector2 PlatformerPro.SpecialMovement_GrapplingHook.direction
protected

Direction from character to grapple.

◆ drag

float PlatformerPro.SpecialMovement_GrapplingHook.drag

When retracting by how much do we speed up the swing?

◆ DragIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.DragIndex = 8
staticprotected

The index of the drag in the movement data.

◆ grapple

GrapplingHookProjectile PlatformerPro.SpecialMovement_GrapplingHook.grapple
protected

Actual grappling hook.

◆ grapplePrefab

GameObject PlatformerPro.SpecialMovement_GrapplingHook.grapplePrefab

Prefab to use for the grapple.

◆ GrapplePrefabIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.GrapplePrefabIndex = 5
staticprotected

The index of the grapple prefab in the movement data.

◆ gravity

float PlatformerPro.SpecialMovement_GrapplingHook.gravity

Gravity to use when swinging.

◆ GravityIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.GravityIndex = 4
staticprotected

The index of the gravity in the movement data.

◆ handOffset

Vector2 PlatformerPro.SpecialMovement_GrapplingHook.handOffset

Distance between characters transform and their hand.

◆ HandOffsetIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.HandOffsetIndex = 0
staticprotected

The index of the hand offset in the movement data.

◆ hasLeftGround

bool PlatformerPro.SpecialMovement_GrapplingHook.hasLeftGround
protected

Tracks if we have left the ground.

◆ launchVelocityBoost

Vector2 PlatformerPro.SpecialMovement_GrapplingHook.launchVelocityBoost

The additional boost we add to the swing velocity when player leaves grapple.

◆ LaunchVelocityBoostIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.LaunchVelocityBoostIndex = 12
staticprotected

The index of launch velocity boost in the movement data.

◆ launchVelocityMultiplier

Vector2 PlatformerPro.SpecialMovement_GrapplingHook.launchVelocityMultiplier

The additional multiplier applied swing velocity when player leaves grapple.

◆ LaunchVelocityMultiplierIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.LaunchVelocityMultiplierIndex = 13
staticprotected

The index of launch velocity multiplier in the movement data.

◆ maxDistance

float PlatformerPro.SpecialMovement_GrapplingHook.maxDistance

The max distance the rope can travel.

◆ MaxDistanceIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.MaxDistanceIndex = 1
staticprotected

The index of the max distance in the movement data.

◆ maxRopeDistance

float PlatformerPro.SpecialMovement_GrapplingHook.maxRopeDistance
protected

The max rope distance.

◆ MaxRopeSlingshotDistance

const float PlatformerPro.SpecialMovement_GrapplingHook.MaxRopeSlingshotDistance = 2.5f
staticprotected

Maximum distance after which you will always slingshot.

◆ MovementVariableCount

const int PlatformerPro.SpecialMovement_GrapplingHook.MovementVariableCount = 14
staticprotected

The size of the movement variable array in the movement data.

◆ retractSpeed

float PlatformerPro.SpecialMovement_GrapplingHook.retractSpeed

Speed at which the hook retracts (i.e speed which played moves up/down).

◆ RetractSpeedIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.RetractSpeedIndex = 3
staticprotected

The index of the retract speed in the movement data.

◆ ropeDistance

float PlatformerPro.SpecialMovement_GrapplingHook.ropeDistance
protected

Current distance between player and rope.

◆ ropeGo

GameObject PlatformerPro.SpecialMovement_GrapplingHook.ropeGo
protected

Gameobject for the rope.

◆ ropePrefab

GameObject PlatformerPro.SpecialMovement_GrapplingHook.ropePrefab

Prefab to use for the rope.

◆ RopePrefabIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.RopePrefabIndex = 6
staticprotected

The index of the rope prefab in the movement data.

◆ slingshotLaunchDistance

float PlatformerPro.SpecialMovement_GrapplingHook.slingshotLaunchDistance
protected

Tracks the distance we have to travel before we slingshot.

◆ slingshotLaunchVelocity

Vector2 PlatformerPro.SpecialMovement_GrapplingHook.slingshotLaunchVelocity

Speed at which we slingshot.

◆ SlingshotLaunchVelocityIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.SlingshotLaunchVelocityIndex = 10
staticprotected

The index of the slingshot launch velocity.

◆ slingshotRetractSpeed

float PlatformerPro.SpecialMovement_GrapplingHook.slingshotRetractSpeed

Speed at which the hook retracts (i.e speed which played moves up/down).

◆ SlingshotRetractSpeedIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.SlingshotRetractSpeedIndex = 9
staticprotected

The index of the slingshot retract speed value in the movement data.

◆ slowDownType

SlowDownType PlatformerPro.SpecialMovement_GrapplingHook.slowDownType

How do we slow down?

◆ SlowDownTypeIndex

const int PlatformerPro.SpecialMovement_GrapplingHook.SlowDownTypeIndex = 7
staticprotected

The index of the slow down type in the movement data.

◆ state

GrapplingHookState PlatformerPro.SpecialMovement_GrapplingHook.state
protected

The state.

◆ swingTime

float PlatformerPro.SpecialMovement_GrapplingHook.swingTime
protected

Time we have been swinging for.

◆ travelledDistance

float PlatformerPro.SpecialMovement_GrapplingHook.travelledDistance
protected

Tracks how far we have travelled up the rope since slingshot started.

Property Documentation

◆ AnimationState

override AnimationState PlatformerPro.SpecialMovement_GrapplingHook.AnimationState
get

Gets the animation state that this movement wants to set.

◆ FacingDirection

override int PlatformerPro.SpecialMovement_GrapplingHook.FacingDirection
get

Returns the direction the character is facing. 0 for none, 1 for right, -1 for left. This overriden version always returns the velocity direction.

◆ HandOffset

Vector2 PlatformerPro.SpecialMovement_GrapplingHook.HandOffset
getprotected

Gets the hand offset offset for facing direction.

The hand offset.

◆ Info

new static MovementInfo PlatformerPro.SpecialMovement_GrapplingHook.Info
staticget

Static movement info used by the editor.

◆ ShouldApplyGravity

override bool PlatformerPro.SpecialMovement_GrapplingHook.ShouldApplyGravity
get

This class will handle gravity internally.


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