Destructible Component: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Remove categories to hide page from component category lists) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
'''This component has been removed and cannot be added to new mods.''' | |||
The destructible is a [[:Category:Gameplay Components|gameplay component]] that allows a [[Gameobject|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 Component|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 == | |||
{| class="wikitable" | |||
|- | |||
! Property !! Description | |||
|- | |||
|'''On Hit''' || A list of [[Action]]s to perform each time the object is hit. | |||
|- | |||
|} | |||
== Usage == | |||
Use this component to make an object perform some [[Action]]s 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 === | |||
[[File:ExampleAddScoreAndDestroy.png|thumb|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 | |||
[[File:ExampleDoorAnimated.gif|thumb|325px|none|The button and series of actions working.]] | |||
[[File:ExampleDoorOpenClose.png|thumb|325px|none|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.]] |
Latest revision as of 02:06, 16 December 2022
This component has been removed and cannot be added to new mods.
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
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