TopDown Engine  v4.1
MoreMountains.TopDownEngine.ButtonActivated Class Reference

Extend this class to activate something when a button is pressed in a certain zone More...

Inheritance diagram for MoreMountains.TopDownEngine.ButtonActivated:
MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.Tools.MMMonoBehaviour MoreMountains.TopDownEngine.ButtonActivatedZone MoreMountains.TopDownEngine.DialogueZone MoreMountains.TopDownEngine.FinishLevel MoreMountains.TopDownEngine.KeyOperatedZone MoreMountains.TopDownEngine.MovementZone MoreMountains.TopDownEngine.Teleporter MoreMountains.TopDownEngine.TimeZone MoreMountains.TopDownEngine.DeadlineFinishLevel MoreMountains.TopDownEngine.GoToLevelEntryPoint

Public Types

enum  ButtonActivatedRequirements { ButtonActivatedRequirements.Character, ButtonActivatedRequirements.ButtonActivator, ButtonActivatedRequirements.Either, ButtonActivatedRequirements.None }
 
enum  InputTypes { InputTypes.Default, InputTypes.Button, InputTypes.Key }
 

Public Member Functions

virtual void Initialization ()
 Grabs components and shows prompt if needed More...
 
virtual void TriggerButtonAction ()
 When the input button is pressed, we check whether or not the zone can be activated, and if yes, trigger ZoneActivated More...
 
virtual void TriggerExitAction (GameObject collider)
 
virtual void MakeActivable ()
 Makes the zone activable More...
 
virtual void MakeUnactivable ()
 Makes the zone unactivable More...
 
virtual void ToggleActivable ()
 Makes the zone activable if it wasn't, unactivable if it was activable. More...
 
virtual void PromptError ()
 Triggers an error More...
 
virtual void ShowPrompt ()
 Shows the button A prompt. More...
 
virtual void HidePrompt ()
 Hides the button A prompt. More...
 
virtual void DisableZone ()
 Disables the button activated zone More...
 
virtual void EnableZone ()
 Enables the button activated zone More...
 
virtual bool CheckNumberOfUses ()
 Checks the remaining number of uses and eventual delay between uses and returns true if the zone can be activated. More...
 

Public Attributes

ButtonActivatedRequirements ButtonActivatedRequirement = ButtonActivatedRequirements.Either
 if this is true, objects with a ButtonActivator class will be able to interact with this zone More...
 
bool RequiresPlayerType = true
 if this is true, this can only be activated by player Characters More...
 
bool RequiresButtonActivationAbility = true
 if this is true, this zone can only be activated if the character has the required ability More...
 
bool Activable = true
 if this is false, the zone won't be activable More...
 
bool AutoActivation = false
 if true, the zone will activate whether the button is pressed or not More...
 
float AutoActivationDelay = 0f
 the delay, in seconds, during which the character has to be within the zone to activate it More...
 
bool AutoActivationDelayResetsOnExit = true
 if this is true, exiting the zone will reset the auto activation delay More...
 
bool CanOnlyActivateIfGrounded = false
 if this is set to false, the zone won't be activable while not grounded More...
 
bool ShouldUpdateState = true
 Set this to true if you want the CharacterBehaviorState to be notified of the player's entry into the zone. More...
 
bool OnlyOneActivationAtOnce = true
 if this is true, enter won't be retriggered if another object enters, and exit will only be triggered when the last object exits More...
 
LayerMask TargetLayerMask = ~0
 a layermask with all the layers that can interact with this specific button activated zone More...
 
bool UnlimitedActivations = true
 if this is set to false, your number of activations will be MaxNumberOfActivations More...
 
int MaxNumberOfActivations = 0
 the number of times the zone can be interacted with More...
 
int NumberOfActivationsLeft
 the amount of remaining activations on this zone More...
 
float DelayBetweenUses = 0f
 the delay (in seconds) after an activation during which the zone can't be activated More...
 
bool DisableAfterUse = false
 if this is true, the zone will disable itself (forever or until you manually reactivate it) after its last use More...
 
InputTypes InputType = InputTypes.Default
 the selected input type (default, button or key) More...
 
string InputButton = "Interact"
 the selected button string used to activate this zone More...
 
KeyCode InputKey = KeyCode.Space
 the key used to activate this zone More...
 
string AnimationTriggerParameterName
 an (absolutely optional) animation parameter that can be triggered on the character when activating the zone
More...
 
bool UseVisualPrompt = true
 if this is true, a prompt will be shown if setup properly More...
 
ButtonPrompt ButtonPromptPrefab
 the gameobject to instantiate to present the prompt More...
 
string ButtonPromptText = "A"
 the text to display in the button prompt More...
 
Color ButtonPromptColor = MMColors.LawnGreen
 the text to display in the button prompt More...
 
Color ButtonPromptTextColor = MMColors.White
 the color for the prompt's text More...
 
bool AlwaysShowPrompt = true
 If true, the "buttonA" prompt will always be shown, whether the player is in the zone or not. More...
 
bool ShowPromptWhenColliding = true
 If true, the "buttonA" prompt will be shown when a player is colliding with the zone. More...
 
bool HidePromptAfterUse = false
 If true, the prompt will hide after use. More...
 
Vector3 PromptRelativePosition = Vector3.zero
 the position of the actual buttonA prompt relative to the object's center More...
 
Vector3 PromptRotation = Vector3.zero
 the rotation of the actual buttonA prompt More...
 
MMFeedbacks ActivationFeedback
 a feedback to play when the zone gets activated More...
 
MMFeedbacks DeniedFeedback
 a feedback to play when the zone tries to get activated but can't More...
 
MMFeedbacks EnterFeedback
 a feedback to play when the zone gets entered
More...
 
MMFeedbacks ExitFeedback
 a feedback to play when the zone gets exited
More...
 
UnityEvent OnActivation
 a UnityEvent to trigger when this zone gets activated More...
 
UnityEvent OnExit
 a UnityEvent to trigger when this zone gets exited More...
 
UnityEvent OnStay
 a UnityEvent to trigger when a character is within the zone More...
 

Protected Member Functions

virtual void OnEnable ()
 On Enable, we initialize our ButtonActivated zone More...
 
virtual void OnDisable ()
 On disable we disable our input action if needed More...
 
virtual IEnumerator TriggerButtonActionCo ()
 
virtual void Update ()
 
virtual void ActivateZone ()
 Activates the zone More...
 
virtual void OnTriggerEnter2D (Collider2D collidingObject)
 Handles enter collision with 2D triggers More...
 
virtual void OnTriggerExit2D (Collider2D collidingObject)
 Handles enter collision with 2D triggers More...
 
virtual void OnTriggerEnter (Collider collidingObject)
 Handles enter collision with 2D triggers More...
 
virtual void OnTriggerExit (Collider collidingObject)
 Handles enter collision with 2D triggers More...
 
virtual void TriggerEnter (GameObject collider)
 Triggered when something collides with the button activated zone More...
 
virtual void TriggerExit (GameObject collider)
 Triggered when something exits the water More...
 
virtual bool TestForLastObject (GameObject collider)
 Tests if the object exiting our zone is the last remaining one More...
 
virtual bool CheckConditions (GameObject collider)
 Determines whether or not this zone should be activated More...
 

Protected Attributes

Animator _buttonPromptAnimator
 
ButtonPrompt _buttonPrompt
 
Collider _collider
 
Collider2D _collider2D
 
bool _promptHiddenForever = false
 
CharacterButtonActivation _characterButtonActivation
 
float _lastActivationTimestamp
 
List< GameObject > _collidingObjects
 
Character _currentCharacter
 
bool _staying = false
 
Coroutine _autoActivationCoroutine
 

Properties

virtual bool AutoActivationInProgress [get, set]
 
virtual float AutoActivationStartedAt [get, set]
 
bool InputActionPerformed [get]
 

Detailed Description

Extend this class to activate something when a button is pressed in a certain zone

Member Enumeration Documentation

◆ ButtonActivatedRequirements

Enumerator
Character 
ButtonActivator 
Either 
None 

◆ InputTypes

Enumerator
Default 
Button 
Key 

Member Function Documentation

◆ ActivateZone()

virtual void MoreMountains.TopDownEngine.ButtonActivated.ActivateZone ( )
protectedvirtual

Activates the zone

◆ CheckConditions()

virtual bool MoreMountains.TopDownEngine.ButtonActivated.CheckConditions ( GameObject  collider)
protectedvirtual

Determines whether or not this zone should be activated

Returns
true, if conditions was checked, false otherwise.
Parameters
characterCharacter.
characterButtonActivationCharacter button activation.

◆ CheckNumberOfUses()

virtual bool MoreMountains.TopDownEngine.ButtonActivated.CheckNumberOfUses ( )
virtual

Checks the remaining number of uses and eventual delay between uses and returns true if the zone can be activated.

Returns
true, if number of uses was checked, false otherwise.

◆ DisableZone()

virtual void MoreMountains.TopDownEngine.ButtonActivated.DisableZone ( )
virtual

Disables the button activated zone

◆ EnableZone()

virtual void MoreMountains.TopDownEngine.ButtonActivated.EnableZone ( )
virtual

Enables the button activated zone

◆ HidePrompt()

virtual void MoreMountains.TopDownEngine.ButtonActivated.HidePrompt ( )
virtual

Hides the button A prompt.

◆ Initialization()

virtual void MoreMountains.TopDownEngine.ButtonActivated.Initialization ( )
virtual

Grabs components and shows prompt if needed

Reimplemented in MoreMountains.TopDownEngine.MovementZone.

◆ MakeActivable()

virtual void MoreMountains.TopDownEngine.ButtonActivated.MakeActivable ( )
virtual

Makes the zone activable

◆ MakeUnactivable()

virtual void MoreMountains.TopDownEngine.ButtonActivated.MakeUnactivable ( )
virtual

Makes the zone unactivable

◆ OnDisable()

virtual void MoreMountains.TopDownEngine.ButtonActivated.OnDisable ( )
protectedvirtual

On disable we disable our input action if needed

◆ OnEnable()

virtual void MoreMountains.TopDownEngine.ButtonActivated.OnEnable ( )
protectedvirtual

On Enable, we initialize our ButtonActivated zone

Reimplemented in MoreMountains.TopDownEngine.DialogueZone.

◆ OnTriggerEnter()

virtual void MoreMountains.TopDownEngine.ButtonActivated.OnTriggerEnter ( Collider  collidingObject)
protectedvirtual

Handles enter collision with 2D triggers

Parameters
collidingObjectColliding object.

Reimplemented in MoreMountains.TopDownEngine.KeyOperatedZone.

◆ OnTriggerEnter2D()

virtual void MoreMountains.TopDownEngine.ButtonActivated.OnTriggerEnter2D ( Collider2D  collidingObject)
protectedvirtual

Handles enter collision with 2D triggers

Parameters
collidingObjectColliding object.

Reimplemented in MoreMountains.TopDownEngine.KeyOperatedZone.

◆ OnTriggerExit()

virtual void MoreMountains.TopDownEngine.ButtonActivated.OnTriggerExit ( Collider  collidingObject)
protectedvirtual

Handles enter collision with 2D triggers

Parameters
collidingObjectColliding object.

◆ OnTriggerExit2D()

virtual void MoreMountains.TopDownEngine.ButtonActivated.OnTriggerExit2D ( Collider2D  collidingObject)
protectedvirtual

Handles enter collision with 2D triggers

Parameters
collidingObjectColliding object.

◆ PromptError()

virtual void MoreMountains.TopDownEngine.ButtonActivated.PromptError ( )
virtual

Triggers an error

◆ ShowPrompt()

virtual void MoreMountains.TopDownEngine.ButtonActivated.ShowPrompt ( )
virtual

Shows the button A prompt.

◆ TestForLastObject()

virtual bool MoreMountains.TopDownEngine.ButtonActivated.TestForLastObject ( GameObject  collider)
protectedvirtual

Tests if the object exiting our zone is the last remaining one

Parameters
collider
Returns

◆ ToggleActivable()

virtual void MoreMountains.TopDownEngine.ButtonActivated.ToggleActivable ( )
virtual

Makes the zone activable if it wasn't, unactivable if it was activable.

◆ TriggerButtonAction()

virtual void MoreMountains.TopDownEngine.ButtonActivated.TriggerButtonAction ( )
virtual

◆ TriggerButtonActionCo()

virtual IEnumerator MoreMountains.TopDownEngine.ButtonActivated.TriggerButtonActionCo ( )
protectedvirtual

◆ TriggerEnter()

virtual void MoreMountains.TopDownEngine.ButtonActivated.TriggerEnter ( GameObject  collider)
protectedvirtual

Triggered when something collides with the button activated zone

Parameters
colliderSomething colliding with the water.

Reimplemented in MoreMountains.TopDownEngine.Teleporter.

◆ TriggerExit()

virtual void MoreMountains.TopDownEngine.ButtonActivated.TriggerExit ( GameObject  collider)
protectedvirtual

Triggered when something exits the water

Parameters
colliderSomething colliding with the dialogue zone.

◆ TriggerExitAction()

virtual void MoreMountains.TopDownEngine.ButtonActivated.TriggerExitAction ( GameObject  collider)
virtual

◆ Update()

virtual void MoreMountains.TopDownEngine.ButtonActivated.Update ( )
protectedvirtual

Member Data Documentation

◆ _autoActivationCoroutine

Coroutine MoreMountains.TopDownEngine.ButtonActivated._autoActivationCoroutine
protected

◆ _buttonPrompt

ButtonPrompt MoreMountains.TopDownEngine.ButtonActivated._buttonPrompt
protected

◆ _buttonPromptAnimator

Animator MoreMountains.TopDownEngine.ButtonActivated._buttonPromptAnimator
protected

◆ _characterButtonActivation

CharacterButtonActivation MoreMountains.TopDownEngine.ButtonActivated._characterButtonActivation
protected

◆ _collider

Collider MoreMountains.TopDownEngine.ButtonActivated._collider
protected

◆ _collider2D

Collider2D MoreMountains.TopDownEngine.ButtonActivated._collider2D
protected

◆ _collidingObjects

List<GameObject> MoreMountains.TopDownEngine.ButtonActivated._collidingObjects
protected

◆ _currentCharacter

Character MoreMountains.TopDownEngine.ButtonActivated._currentCharacter
protected

◆ _lastActivationTimestamp

float MoreMountains.TopDownEngine.ButtonActivated._lastActivationTimestamp
protected

◆ _promptHiddenForever

bool MoreMountains.TopDownEngine.ButtonActivated._promptHiddenForever = false
protected

◆ _staying

bool MoreMountains.TopDownEngine.ButtonActivated._staying = false
protected

◆ Activable

bool MoreMountains.TopDownEngine.ButtonActivated.Activable = true

if this is false, the zone won't be activable

◆ ActivationFeedback

MMFeedbacks MoreMountains.TopDownEngine.ButtonActivated.ActivationFeedback

a feedback to play when the zone gets activated

◆ AlwaysShowPrompt

bool MoreMountains.TopDownEngine.ButtonActivated.AlwaysShowPrompt = true

If true, the "buttonA" prompt will always be shown, whether the player is in the zone or not.

◆ AnimationTriggerParameterName

string MoreMountains.TopDownEngine.ButtonActivated.AnimationTriggerParameterName

an (absolutely optional) animation parameter that can be triggered on the character when activating the zone

◆ AutoActivation

bool MoreMountains.TopDownEngine.ButtonActivated.AutoActivation = false

if true, the zone will activate whether the button is pressed or not

◆ AutoActivationDelay

float MoreMountains.TopDownEngine.ButtonActivated.AutoActivationDelay = 0f

the delay, in seconds, during which the character has to be within the zone to activate it

◆ AutoActivationDelayResetsOnExit

bool MoreMountains.TopDownEngine.ButtonActivated.AutoActivationDelayResetsOnExit = true

if this is true, exiting the zone will reset the auto activation delay

◆ ButtonActivatedRequirement

ButtonActivatedRequirements MoreMountains.TopDownEngine.ButtonActivated.ButtonActivatedRequirement = ButtonActivatedRequirements.Either

if this is true, objects with a ButtonActivator class will be able to interact with this zone

◆ ButtonPromptColor

Color MoreMountains.TopDownEngine.ButtonActivated.ButtonPromptColor = MMColors.LawnGreen

the text to display in the button prompt

◆ ButtonPromptPrefab

ButtonPrompt MoreMountains.TopDownEngine.ButtonActivated.ButtonPromptPrefab

the gameobject to instantiate to present the prompt

◆ ButtonPromptText

string MoreMountains.TopDownEngine.ButtonActivated.ButtonPromptText = "A"

the text to display in the button prompt

◆ ButtonPromptTextColor

Color MoreMountains.TopDownEngine.ButtonActivated.ButtonPromptTextColor = MMColors.White

the color for the prompt's text

◆ CanOnlyActivateIfGrounded

bool MoreMountains.TopDownEngine.ButtonActivated.CanOnlyActivateIfGrounded = false

if this is set to false, the zone won't be activable while not grounded

◆ DelayBetweenUses

float MoreMountains.TopDownEngine.ButtonActivated.DelayBetweenUses = 0f

the delay (in seconds) after an activation during which the zone can't be activated

◆ DeniedFeedback

MMFeedbacks MoreMountains.TopDownEngine.ButtonActivated.DeniedFeedback

a feedback to play when the zone tries to get activated but can't

◆ DisableAfterUse

bool MoreMountains.TopDownEngine.ButtonActivated.DisableAfterUse = false

if this is true, the zone will disable itself (forever or until you manually reactivate it) after its last use

◆ EnterFeedback

MMFeedbacks MoreMountains.TopDownEngine.ButtonActivated.EnterFeedback

a feedback to play when the zone gets entered

◆ ExitFeedback

MMFeedbacks MoreMountains.TopDownEngine.ButtonActivated.ExitFeedback

a feedback to play when the zone gets exited

◆ HidePromptAfterUse

bool MoreMountains.TopDownEngine.ButtonActivated.HidePromptAfterUse = false

If true, the prompt will hide after use.

◆ InputButton

string MoreMountains.TopDownEngine.ButtonActivated.InputButton = "Interact"

the selected button string used to activate this zone

◆ InputKey

KeyCode MoreMountains.TopDownEngine.ButtonActivated.InputKey = KeyCode.Space

the key used to activate this zone

◆ InputType

InputTypes MoreMountains.TopDownEngine.ButtonActivated.InputType = InputTypes.Default

the selected input type (default, button or key)

◆ MaxNumberOfActivations

int MoreMountains.TopDownEngine.ButtonActivated.MaxNumberOfActivations = 0

the number of times the zone can be interacted with

◆ NumberOfActivationsLeft

int MoreMountains.TopDownEngine.ButtonActivated.NumberOfActivationsLeft

the amount of remaining activations on this zone

◆ OnActivation

UnityEvent MoreMountains.TopDownEngine.ButtonActivated.OnActivation

a UnityEvent to trigger when this zone gets activated

◆ OnExit

UnityEvent MoreMountains.TopDownEngine.ButtonActivated.OnExit

a UnityEvent to trigger when this zone gets exited

◆ OnlyOneActivationAtOnce

bool MoreMountains.TopDownEngine.ButtonActivated.OnlyOneActivationAtOnce = true

if this is true, enter won't be retriggered if another object enters, and exit will only be triggered when the last object exits

◆ OnStay

UnityEvent MoreMountains.TopDownEngine.ButtonActivated.OnStay

a UnityEvent to trigger when a character is within the zone

◆ PromptRelativePosition

Vector3 MoreMountains.TopDownEngine.ButtonActivated.PromptRelativePosition = Vector3.zero

the position of the actual buttonA prompt relative to the object's center

◆ PromptRotation

Vector3 MoreMountains.TopDownEngine.ButtonActivated.PromptRotation = Vector3.zero

the rotation of the actual buttonA prompt

◆ RequiresButtonActivationAbility

bool MoreMountains.TopDownEngine.ButtonActivated.RequiresButtonActivationAbility = true

if this is true, this zone can only be activated if the character has the required ability

◆ RequiresPlayerType

bool MoreMountains.TopDownEngine.ButtonActivated.RequiresPlayerType = true

if this is true, this can only be activated by player Characters

◆ ShouldUpdateState

bool MoreMountains.TopDownEngine.ButtonActivated.ShouldUpdateState = true

Set this to true if you want the CharacterBehaviorState to be notified of the player's entry into the zone.

◆ ShowPromptWhenColliding

bool MoreMountains.TopDownEngine.ButtonActivated.ShowPromptWhenColliding = true

If true, the "buttonA" prompt will be shown when a player is colliding with the zone.

◆ TargetLayerMask

LayerMask MoreMountains.TopDownEngine.ButtonActivated.TargetLayerMask = ~0

a layermask with all the layers that can interact with this specific button activated zone

◆ UnlimitedActivations

bool MoreMountains.TopDownEngine.ButtonActivated.UnlimitedActivations = true

if this is set to false, your number of activations will be MaxNumberOfActivations

◆ UseVisualPrompt

bool MoreMountains.TopDownEngine.ButtonActivated.UseVisualPrompt = true

if this is true, a prompt will be shown if setup properly

Property Documentation

◆ AutoActivationInProgress

virtual bool MoreMountains.TopDownEngine.ButtonActivated.AutoActivationInProgress
getset

◆ AutoActivationStartedAt

virtual float MoreMountains.TopDownEngine.ButtonActivated.AutoActivationStartedAt
getset

◆ InputActionPerformed

bool MoreMountains.TopDownEngine.ButtonActivated.InputActionPerformed
get

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