|
TopDown Engine v4.5
|
This class is an example of how you can create pickable abilities, items that, when picked, enable an ability on the picking character. This example will permit the CharacterDash2D ability. You can of course create more items like this for any other ability. More...
Protected Member Functions | |
| override bool | CheckIfPickable () |
| To make sure this can be picked, we make sure we're dealing with a Player Character. | |
| override void | Pick (GameObject picker) |
| On pick, we permit the ability, if found. | |
| Protected Member Functions inherited from MoreMountains.TopDownEngine.PickableItem | |
| virtual void | Start () |
| virtual IEnumerator | DisableTargetObjectCoroutine () |
| virtual IEnumerator | DisablePickerCoroutine () |
| virtual void | Effects () |
| Triggers the various pick effects. | |
Additional Inherited Members | |
| Public Member Functions inherited from MoreMountains.TopDownEngine.PickableItem | |
| virtual void | OnTriggerEnter (Collider collider) |
| Triggered when something collides with the coin. | |
| virtual void | OnTriggerEnter2D (Collider2D collider) |
| Triggered when something collides with the coin. | |
| virtual void | PickItem (GameObject picker) |
| Check if the item is pickable and if yes, proceeds with triggering the effects and disabling the object. | |
| Public Attributes inherited from MoreMountains.TopDownEngine.PickableItem | |
| MMFeedbacks | PickedMMFeedbacks |
| A feedback to play when the object gets picked. | |
| bool | DisableColliderOnPick = false |
| if this is true, the picker's collider will be disabled on pick | |
| bool | DisableObjectOnPick = true |
| if this is set to true, the object will be disabled when picked | |
| float | DisableDelay = 0f |
| the duration (in seconds) after which to disable the object, instant if 0 | |
| bool | DisableModelOnPick = false |
| if this is set to true, the object will be disabled when picked | |
| bool | DisableTargetObjectOnPick = false |
| if this is set to true, the target object will be disabled when picked | |
| GameObject | TargetObjectToDisable |
| the object to disable on pick if DisableTargetObjectOnPick is true | |
| float | TargetObjectDisableDelay = 1f |
| the time in seconds before disabling the target if DisableTargetObjectOnPick is true | |
| GameObject | Model |
| the visual representation of this picker | |
| bool | RequireCharacterComponent = true |
| if this is true, this pickable item will only be pickable by objects with a Character component | |
| bool | RequirePlayerType = true |
| if this is true, this pickable item will only be pickable by objects with a Character component of type player | |
| Protected Attributes inherited from MoreMountains.TopDownEngine.PickableItem | |
| Collider | _collider |
| Collider2D | _collider2D |
| GameObject | _collidingObject |
| Character | _character = null |
| bool | _pickable = false |
| ItemPicker | _itemPicker = null |
| WaitForSeconds | _disableDelay |
This class is an example of how you can create pickable abilities, items that, when picked, enable an ability on the picking character. This example will permit the CharacterDash2D ability. You can of course create more items like this for any other ability.
To give it a try, in the KoalaDungeon demo scene for example, create a new empty game object, add a box collider 2D to it, make sure it's trigger. then add this component to it. Select the Koala prefab, uncheck "permit ability" on its Dash 2D ability. Now play the scene, try dashing (you can't), grab this object, and you can now dash.
|
protectedvirtual |
To make sure this can be picked, we make sure we're dealing with a Player Character.
Reimplemented from MoreMountains.TopDownEngine.PickableItem.
|
protectedvirtual |
On pick, we permit the ability, if found.
| picker |
Reimplemented from MoreMountains.TopDownEngine.PickableItem.