Pick And Throw

The player can pickup and throw a block. Use Moving Platforms must be enabled in the collision settings to use this ability properly.

Use the block in Demo2 as a template. To create one from scratch, add a AIFSM to an empty gameobject. Set the Tag to Block. Set Layer to Platform. Set AI type to MovingPlatform. Enable has Gravity. Enable Collide With World Only in the Collision settings. Create one empty state Called Wait. Another called Throw, and add the Throw node. Set the throw velocity. Enable OnSuccess and OnFailure to jump to the Slide State. Add the Slide state and the Slide node. Set the slide speed. Enable OnSuccess and OnFailure to jump to the Wait sate. This ability will be in charge of using these states. Make sure this has a BoxCollider2D and a sprite renderer.

Property

Grab Button

If pressed, the player will pickup a block if it’s touching it.

Drop Button

If pressed, the player will drop the block.

Throw Time

The time the throwingBlock signal will be set true in order to play a throwing animation. Set to zero if not needed.

Hold Position

This hold position of the block relative to the player once it’s being held by the player.

Pick Up time

The time it will take to move the block along the pick up path for player animation purposes. Set to zero if not needed.

Lerp Pick Up

If enabled, the block will lerp through the pick up path.

Pick Up Path

The points the block will traverse to reach the Hold Position. The x position on each point will be flipped according to player direction.

**Signals: pickAndThrowBlock, pickingUpBlock, holdingBlock, throwingBlock*