Corgi Engine  v8.8
MoreMountains.CorgiEngine.ButtonActivated Class Reference

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

Inheritance diagram for MoreMountains.CorgiEngine.ButtonActivated:
MoreMountains.Tools.MMMonoBehaviour MoreMountains.CorgiEngine.DialogueZone MoreMountains.CorgiEngine.FinishLevel MoreMountains.CorgiEngine.KeyOperatedZone MoreMountains.CorgiEngine.Teleporter MoreMountains.CorgiEngine.TimeZone MoreMountains.CorgiEngine.GoToLevelEntryPoint MoreMountains.CorgiEngine.RetroAdventureFinishLevel

Public Types

enum  ButtonActivatedRequirements { ButtonActivatedRequirements.Character, ButtonActivatedRequirements.ButtonActivator, ButtonActivatedRequirements.Either, ButtonActivatedRequirements.None }
 the different possible requirements for this activated zone, which can be either a character, a button activator, one or the other, or none More...
 
enum  InputTypes { InputTypes.Default, InputTypes.Button, InputTypes.Key }
 how input gets detected for this zone (default : default binding from the InputManager for Interact, button (type in an axis button name), or key) More...
 

Public Member Functions

virtual void Initialization ()
 Grabs components and shows prompt if needed More...
 
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 TriggerButtonAction (GameObject instigator)
 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)
 On exit, we reset our staying bool and invoke our OnExit event 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 ()
 Enables 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
 the requirement(s) for 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 PreventJumpsWhileInThisZone = false
 if this is true, characters won't be able to jump when in that zone, regardless of the settings on their CharacterButtonActivation 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...
 
bool AutoActivationAndButtonInteraction = false
 if true, this zone will be auto activated but will still allow button interaction 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...
 
bool AlsoPerformChecksOnStay = false
 if this is true, extra enter checks will be performed on TriggerStay, to handle edge cases like a zone that'd prevent activation when not grounded, and a character enters it airborne, but then lands 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...
 
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 : default binding from the InputManager for Interact, button (type in an axis button name), or key) More...
 
string InputButton = "Interact"
 the button axis name to use for this button activated object More...
 
KeyCode InputKey = KeyCode.Space
 the key to use for this 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...
 
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
 an action to trigger when this gets activated More...
 
UnityEvent OnExit
 an action to trigger when exiting this zone More...
 
UnityEvent OnStay
 an action to trigger when staying in 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 void ActivateZone ()
 Activates the zone More...
 
virtual void DisableAfterActivation ()
 Handles the disabling of the zone after activation More...
 
virtual void OnTriggerEnter2D (Collider2D collidingObject)
 Handles enter collision with 2D triggers More...
 
virtual void OnTriggerStay2D (Collider2D collidingObject)
 On stay we invoke our stay event if needed, and perform a trigger enter check if it hasn't been done already More...
 
virtual void OnTriggerExit2D (Collider2D 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
 
bool _promptHiddenForever = false
 
int _numberOfActivationsLeft
 
float _lastActivationTimestamp
 
Collider2D _buttonActivatedZoneCollider
 
CharacterButtonActivation _characterButtonActivation
 
Character _currentCharacter
 
List< GameObject > _collidingObjects
 
List< GameObject > _stayingGameObjects
 
List< Collider2D > _enteredColliders
 
int _inputActionPressedAtFrame
 

Properties

bool InputActionPerformed [get]
 

Detailed Description

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

Member Enumeration Documentation

◆ ButtonActivatedRequirements

the different possible requirements for this activated zone, which can be either a character, a button activator, one or the other, or none

Enumerator
Character 
ButtonActivator 
Either 
None 

◆ InputTypes

how input gets detected for this zone (default : default binding from the InputManager for Interact, button (type in an axis button name), or key)

Enumerator
Default 
Button 
Key 

Member Function Documentation

◆ ActivateZone()

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

Activates the zone

◆ CheckConditions()

virtual bool MoreMountains.CorgiEngine.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.CorgiEngine.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.

◆ DisableAfterActivation()

virtual void MoreMountains.CorgiEngine.ButtonActivated.DisableAfterActivation ( )
protectedvirtual

Handles the disabling of the zone after activation

Reimplemented in MoreMountains.CorgiEngine.DialogueZone.

◆ DisableZone()

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

Enables the button activated zone

◆ EnableZone()

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

Enables the button activated zone

◆ HidePrompt()

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

Hides the button A prompt.

◆ Initialization()

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

Grabs components and shows prompt if needed

Reimplemented in MoreMountains.CorgiEngine.FinishLevel.

◆ MakeActivable()

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

Makes the zone activable

◆ MakeUnactivable()

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

Makes the zone unactivable

◆ OnDisable()

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

On disable we disable our input action if needed

◆ OnEnable()

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

On Enable, we initialize our ButtonActivated zone

Reimplemented in MoreMountains.CorgiEngine.DialogueZone.

◆ OnTriggerEnter2D()

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

Handles enter collision with 2D triggers

Parameters
collidingObjectColliding object.

Reimplemented in MoreMountains.CorgiEngine.Teleporter, and MoreMountains.CorgiEngine.KeyOperatedZone.

◆ OnTriggerExit2D()

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

Handles enter collision with 2D triggers

Parameters
collidingObjectColliding object.

◆ OnTriggerStay2D()

virtual void MoreMountains.CorgiEngine.ButtonActivated.OnTriggerStay2D ( Collider2D  collidingObject)
protectedvirtual

On stay we invoke our stay event if needed, and perform a trigger enter check if it hasn't been done already

Parameters
collidingObject

Reimplemented in MoreMountains.CorgiEngine.Teleporter.

◆ PromptError()

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

Triggers an error

◆ ShowPrompt()

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

Shows the button A prompt.

◆ TestForLastObject()

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

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

Parameters
collider
Returns

◆ ToggleActivable()

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

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

◆ TriggerButtonAction()

virtual void MoreMountains.CorgiEngine.ButtonActivated.TriggerButtonAction ( GameObject  instigator)
virtual

When the input button is pressed, we check whether or not the zone can be activated, and if yes, trigger ZoneActivated

Reimplemented in MoreMountains.CorgiEngine.Teleporter, MoreMountains.CorgiEngine.DialogueZone, MoreMountains.CorgiEngine.FinishLevel, MoreMountains.CorgiEngine.KeyOperatedZone, and MoreMountains.CorgiEngine.TimeZone.

◆ TriggerEnter()

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

Triggered when something collides with the button activated zone

Parameters
colliderSomething colliding with the water.

◆ TriggerExit()

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

Triggered when something exits the water

Parameters
colliderSomething colliding with the dialogue zone.

◆ TriggerExitAction()

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

On exit, we reset our staying bool and invoke our OnExit event

Parameters
collider

Reimplemented in MoreMountains.CorgiEngine.Teleporter, and MoreMountains.CorgiEngine.TimeZone.

Member Data Documentation

◆ _buttonActivatedZoneCollider

Collider2D MoreMountains.CorgiEngine.ButtonActivated._buttonActivatedZoneCollider
protected

◆ _buttonPrompt

ButtonPrompt MoreMountains.CorgiEngine.ButtonActivated._buttonPrompt
protected

◆ _buttonPromptAnimator

Animator MoreMountains.CorgiEngine.ButtonActivated._buttonPromptAnimator
protected

◆ _characterButtonActivation

CharacterButtonActivation MoreMountains.CorgiEngine.ButtonActivated._characterButtonActivation
protected

◆ _collidingObjects

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

◆ _currentCharacter

Character MoreMountains.CorgiEngine.ButtonActivated._currentCharacter
protected

◆ _enteredColliders

List<Collider2D> MoreMountains.CorgiEngine.ButtonActivated._enteredColliders
protected

◆ _inputActionPressedAtFrame

int MoreMountains.CorgiEngine.ButtonActivated._inputActionPressedAtFrame
protected

◆ _lastActivationTimestamp

float MoreMountains.CorgiEngine.ButtonActivated._lastActivationTimestamp
protected

◆ _numberOfActivationsLeft

int MoreMountains.CorgiEngine.ButtonActivated._numberOfActivationsLeft
protected

◆ _promptHiddenForever

bool MoreMountains.CorgiEngine.ButtonActivated._promptHiddenForever = false
protected

◆ _stayingGameObjects

List<GameObject> MoreMountains.CorgiEngine.ButtonActivated._stayingGameObjects
protected

◆ Activable

bool MoreMountains.CorgiEngine.ButtonActivated.Activable = true

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

◆ ActivationFeedback

MMFeedbacks MoreMountains.CorgiEngine.ButtonActivated.ActivationFeedback

a feedback to play when the zone gets activated

◆ AlsoPerformChecksOnStay

bool MoreMountains.CorgiEngine.ButtonActivated.AlsoPerformChecksOnStay = false

if this is true, extra enter checks will be performed on TriggerStay, to handle edge cases like a zone that'd prevent activation when not grounded, and a character enters it airborne, but then lands

◆ AlwaysShowPrompt

bool MoreMountains.CorgiEngine.ButtonActivated.AlwaysShowPrompt = true

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

◆ AnimationTriggerParameterName

string MoreMountains.CorgiEngine.ButtonActivated.AnimationTriggerParameterName

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

◆ AutoActivation

bool MoreMountains.CorgiEngine.ButtonActivated.AutoActivation = false

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

◆ AutoActivationAndButtonInteraction

bool MoreMountains.CorgiEngine.ButtonActivated.AutoActivationAndButtonInteraction = false

if true, this zone will be auto activated but will still allow button interaction

◆ ButtonActivatedRequirement

ButtonActivatedRequirements MoreMountains.CorgiEngine.ButtonActivated.ButtonActivatedRequirement = ButtonActivatedRequirements.Either

the requirement(s) for this zone

◆ ButtonPromptColor

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

the text to display in the button prompt

◆ ButtonPromptPrefab

ButtonPrompt MoreMountains.CorgiEngine.ButtonActivated.ButtonPromptPrefab

the gameobject to instantiate to present the prompt

◆ ButtonPromptText

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

the text to display in the button prompt

◆ ButtonPromptTextColor

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

the color for the prompt's text

◆ CanOnlyActivateIfGrounded

bool MoreMountains.CorgiEngine.ButtonActivated.CanOnlyActivateIfGrounded = false

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

◆ DelayBetweenUses

float MoreMountains.CorgiEngine.ButtonActivated.DelayBetweenUses = 0f

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

◆ DeniedFeedback

MMFeedbacks MoreMountains.CorgiEngine.ButtonActivated.DeniedFeedback

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

◆ DisableAfterUse

bool MoreMountains.CorgiEngine.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.CorgiEngine.ButtonActivated.EnterFeedback

a feedback to play when the zone gets entered

◆ ExitFeedback

MMFeedbacks MoreMountains.CorgiEngine.ButtonActivated.ExitFeedback

a feedback to play when the zone gets exited

◆ HidePromptAfterUse

bool MoreMountains.CorgiEngine.ButtonActivated.HidePromptAfterUse = false

If true, the prompt will hide after use.

◆ InputButton

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

the button axis name to use for this button activated object

◆ InputKey

KeyCode MoreMountains.CorgiEngine.ButtonActivated.InputKey = KeyCode.Space

the key to use for this

◆ InputType

InputTypes MoreMountains.CorgiEngine.ButtonActivated.InputType = InputTypes.Default

the selected input type (default : default binding from the InputManager for Interact, button (type in an axis button name), or key)

◆ MaxNumberOfActivations

int MoreMountains.CorgiEngine.ButtonActivated.MaxNumberOfActivations = 0

the number of times the zone can be interacted with

◆ OnActivation

UnityEvent MoreMountains.CorgiEngine.ButtonActivated.OnActivation

an action to trigger when this gets activated

◆ OnExit

UnityEvent MoreMountains.CorgiEngine.ButtonActivated.OnExit

an action to trigger when exiting this zone

◆ OnlyOneActivationAtOnce

bool MoreMountains.CorgiEngine.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.CorgiEngine.ButtonActivated.OnStay

an action to trigger when staying in the zone

◆ PreventJumpsWhileInThisZone

bool MoreMountains.CorgiEngine.ButtonActivated.PreventJumpsWhileInThisZone = false

if this is true, characters won't be able to jump when in that zone, regardless of the settings on their CharacterButtonActivation ability

◆ PromptRelativePosition

Vector3 MoreMountains.CorgiEngine.ButtonActivated.PromptRelativePosition = Vector3.zero

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

◆ RequiresButtonActivationAbility

bool MoreMountains.CorgiEngine.ButtonActivated.RequiresButtonActivationAbility = true

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

◆ RequiresPlayerType

bool MoreMountains.CorgiEngine.ButtonActivated.RequiresPlayerType = true

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

◆ ShouldUpdateState

bool MoreMountains.CorgiEngine.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.CorgiEngine.ButtonActivated.ShowPromptWhenColliding = true

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

◆ TargetLayerMask

LayerMask MoreMountains.CorgiEngine.ButtonActivated.TargetLayerMask = ~0

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

◆ UnlimitedActivations

bool MoreMountains.CorgiEngine.ButtonActivated.UnlimitedActivations = true

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

◆ UseVisualPrompt

bool MoreMountains.CorgiEngine.ButtonActivated.UseVisualPrompt = true

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

Property Documentation

◆ InputActionPerformed

bool MoreMountains.CorgiEngine.ButtonActivated.InputActionPerformed
get

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