TopDown Engine  v3.6
MoreMountains.TopDownEngine.KeyOperatedZone Class Reference

Add this component to a collider 2D and you'll be able to have it perform an action when a character equipped with the specified key enters it. More...

Inheritance diagram for MoreMountains.TopDownEngine.KeyOperatedZone:
MoreMountains.TopDownEngine.ButtonActivated MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.Tools.MMMonoBehaviour

Public Member Functions

override void TriggerButtonAction ()
 When the button is pressed, we check if we have a key in our inventory More...
 
- Public Member Functions inherited from MoreMountains.TopDownEngine.ButtonActivated
virtual void Initialization ()
 Grabs components and shows prompt if needed 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

bool RequiresKey = true
 whether this zone actually requires a key More...
 
string KeyID
 the key ID, that will be checked against the existence (or not) of a key of the same name in the player's inventory More...
 
UnityEvent KeyAction
 the method that should be triggered when the key is used More...
 
- Public Attributes inherited from MoreMountains.TopDownEngine.ButtonActivated
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...
 
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 Start ()
 On Start we initialize our object More...
 
override void OnTriggerEnter2D (Collider2D collider)
 On enter we store our colliding object More...
 
override void OnTriggerEnter (Collider collider)
 Handles enter collision with 2D triggers More...
 
virtual void TriggerKeyAction ()
 Calls the method associated to the key action More...
 
- Protected Member Functions inherited from MoreMountains.TopDownEngine.ButtonActivated
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 OnTriggerExit2D (Collider2D 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

GameObject _collidingObject
 
List< int > _keyList
 
- Protected Attributes inherited from MoreMountains.TopDownEngine.ButtonActivated
Animator _buttonPromptAnimator
 
ButtonPrompt _buttonPrompt
 
Collider _collider
 
Collider2D _collider2D
 
bool _promptHiddenForever = false
 
CharacterButtonActivation _characterButtonActivation
 
int _numberOfActivationsLeft
 
float _lastActivationTimestamp
 
List< GameObject > _collidingObjects
 
Character _currentCharacter
 
bool _staying = false
 
Coroutine _autoActivationCoroutine
 

Additional Inherited Members

- Public Types inherited from MoreMountains.TopDownEngine.ButtonActivated
enum  ButtonActivatedRequirements { ButtonActivatedRequirements.Character, ButtonActivatedRequirements.ButtonActivator, ButtonActivatedRequirements.Either, ButtonActivatedRequirements.None }
 
enum  InputTypes { InputTypes.Default, InputTypes.Button, InputTypes.Key }
 
- Properties inherited from MoreMountains.TopDownEngine.ButtonActivated
virtual bool AutoActivationInProgress [get, set]
 
virtual float AutoActivationStartedAt [get, set]
 
bool InputActionPerformed [get]
 

Detailed Description

Add this component to a collider 2D and you'll be able to have it perform an action when a character equipped with the specified key enters it.

Member Function Documentation

◆ OnTriggerEnter()

override void MoreMountains.TopDownEngine.KeyOperatedZone.OnTriggerEnter ( Collider  collidingObject)
protectedvirtual

Handles enter collision with 2D triggers

Parameters
collidingObjectColliding object.

Reimplemented from MoreMountains.TopDownEngine.ButtonActivated.

◆ OnTriggerEnter2D()

override void MoreMountains.TopDownEngine.KeyOperatedZone.OnTriggerEnter2D ( Collider2D  collider)
protectedvirtual

On enter we store our colliding object

Parameters
colliderSomething colliding with the water.

Reimplemented from MoreMountains.TopDownEngine.ButtonActivated.

◆ Start()

virtual void MoreMountains.TopDownEngine.KeyOperatedZone.Start ( )
protectedvirtual

On Start we initialize our object

◆ TriggerButtonAction()

override void MoreMountains.TopDownEngine.KeyOperatedZone.TriggerButtonAction ( )
virtual

When the button is pressed, we check if we have a key in our inventory

Reimplemented from MoreMountains.TopDownEngine.ButtonActivated.

◆ TriggerKeyAction()

virtual void MoreMountains.TopDownEngine.KeyOperatedZone.TriggerKeyAction ( )
protectedvirtual

Calls the method associated to the key action

Member Data Documentation

◆ _collidingObject

GameObject MoreMountains.TopDownEngine.KeyOperatedZone._collidingObject
protected

◆ _keyList

List<int> MoreMountains.TopDownEngine.KeyOperatedZone._keyList
protected

◆ KeyAction

UnityEvent MoreMountains.TopDownEngine.KeyOperatedZone.KeyAction

the method that should be triggered when the key is used

◆ KeyID

string MoreMountains.TopDownEngine.KeyOperatedZone.KeyID

the key ID, that will be checked against the existence (or not) of a key of the same name in the player's inventory

◆ RequiresKey

bool MoreMountains.TopDownEngine.KeyOperatedZone.RequiresKey = true

whether this zone actually requires a key


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