Destructible Component

From Pummel Party Mod Documentation
Revision as of 22:30, 25 October 2022 by RBDev (talk | contribs) (Added example usages)
Jump to navigation Jump to search

The destructible is a gameplay component that allows a gameobject to perform events whenever it is hit. A hit can be recieved from a player's punch or a weapon's shot (from either a weapon-type item, or a Weapon Component). The gameobject with this component must have an active collider to receive hits.

Despite the name, the gameobject/component will not be destroyed on hit.


Component Settings

Property Description
On Hit A list of Actions to perform each time the object is hit.

Usage

Use this component to make an object perform some Actions whenever it is hit.

Destroy an object

A good usage of this component is to make the object being hit destroy itself

  • You can achieve this by adding a Kill Action to its On Hit event, with the target of This (Destructable).

Reward with score

These actions will reward the hitting player with 1 point, then destroy this gameobject.

Another common usage is to give the player score whenever they hit it.

  • Adding an action with the target set to Hitter will do this.
  • If you want it to be a one time thing, you can also destroy the object when hit.

Hittable buttons

You could use this component to create a button that opens a door.

  • On the button, add this component
  • Create a door gameobject
  • Inside the On Hit event, add a Play Tween Animation Action. Set the target to Advanced. In the list of Targets that appears add an element and set it to the door's transform. Now animate the door to move or rotate as you'd like to make it open.
  • Optionally you can use a Wait Action followed by another animation to close the door
The button and series of actions working.
These actions make the door slide up 5 units over 1 second, stay open for 2 (it waits for 3 seconds but during the first second of waiting, the door is still opening), and close over 1 second.