TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.TopDownEngine.Teleporter Class Reference

Add this script to a trigger collider2D or collider to teleport objects from that object to its destination. More...

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

Public Types

enum  CameraModes { DoNothing , TeleportCamera , CinemachinePriority }
 the possible modes the teleporter can interact with the camera system on activation, either doing nothing, teleporting the camera to a new position, or blending between Cinemachine virtual cameras More...
enum  TeleportationModes { Instant , Tween }
 the possible teleportation modes (either 1-frame instant teleportation, or tween between this teleporter and its destination) More...
enum  TimeModes { Unscaled , Scaled }
 the possible time modes More...
Public Types inherited from MoreMountains.TopDownEngine.ButtonActivated
enum  ButtonActivatedRequirements { Character , ButtonActivator , Either , None }
enum  InputTypes { Default , Button , Key }

Public Member Functions

override void TriggerButtonAction ()
 If we're button activated and if the button is pressed, we teleport.
override void TriggerExitAction (GameObject collider)
 When something exits the teleporter, if it's on the ignore list, we remove it from it, so it'll be considered next time it enters.
virtual void AddToIgnoreList (Transform objectToIgnore)
 Adds an object to the ignore list, which will prevent that object to be moved by the teleporter while it's in that list.
Public Member Functions inherited from MoreMountains.TopDownEngine.ButtonActivated
virtual void Initialization ()
 Grabs components and shows prompt if needed.
virtual void TriggerEnterAction (GameObject collider)
virtual void MakeActivable ()
 Makes the zone activable.
virtual void MakeUnactivable ()
 Makes the zone unactivable.
virtual void ToggleActivable ()
 Makes the zone activable if it wasn't, unactivable if it was activable.
virtual void PromptError ()
 Triggers an error.
virtual void ShowPrompt ()
 Shows the button A prompt.
virtual void HidePrompt ()
 Hides the button A prompt.
virtual void DisableZone ()
 Disables the button activated zone.
virtual void EnableZone ()
 Enables the button activated zone.
virtual bool CheckNumberOfUses ()
 Checks the remaining number of uses and eventual delay between uses and returns true if the zone can be activated.

Public Attributes

bool OnlyAffectsPlayer = true
 if true, this won't teleport non player characters
Vector3 ExitOffset
 the offset to apply when exiting this teleporter
TeleportationModes TeleportationMode = TeleportationModes.Instant
 the selected teleportation mode
MMTween.MMTweenCurve TweenCurve = MMTween.MMTweenCurve.EaseInCubic
 the curve to apply to the teleportation tween
bool MaintainXEntryPositionOnExit = false
 whether or not to maintain the x value of the teleported object on exit
bool MaintainYEntryPositionOnExit = false
 whether or not to maintain the y value of the teleported object on exit
bool MaintainZEntryPositionOnExit = false
 whether or not to maintain the z value of the teleported object on exit
Teleporter Destination
 the teleporter's destination
bool AddToDestinationIgnoreList = true
CameraModes CameraMode = CameraModes.TeleportCamera
 the chosen camera mode
Room CurrentRoom
 the room this teleporter belongs to
Room TargetRoom
 the target room
bool TriggerFade = false
 if this is true, a fade to black will occur when teleporting
int FaderID = 0
 the ID of the fader to target
MMTweenType FadeTween = new MMTweenType(MMTween.MMTweenCurve.EaseInCubic)
 the curve to use to fade to black
bool FadeIgnoresTimescale = false
 if this is true, fade events will ignore timescale
bool MoveMask = true
 whether or not we should ask to move a MMSpriteMask on activation
MMTween.MMTweenCurve MoveMaskCurve = MMTween.MMTweenCurve.EaseInCubic
 the curve to move the mask along to
MMSpriteMaskEvent.MMSpriteMaskEventTypes MoveMaskMethod = MMSpriteMaskEvent.MMSpriteMaskEventTypes.ExpandAndMoveToNewPosition
 the method to move the mask
float MoveMaskDuration = 0.2f
 the duration of the mask movement (usually the same as the DelayBetweenFades
bool FreezeTime = false
 whether or not time should be frozen during the transition
bool FreezeCharacter = true
 whether or not the character should be frozen (input blocked) for the duration of the transition
TimeModes TimeMode = TimeModes.Unscaled
 the timescale to use for the teleport sequence
float InitialDelay = 0.1f
 the delay (in seconds) to apply before running the sequence
float FadeOutDuration = 0.2f
 the duration (in seconds) after the initial delay covering for the fade out of the scene
float DelayBetweenFades = 0.3f
 the duration (in seconds) to wait for after the fade out and before the fade in
float FadeInDuration = 0.2f
 the duration (in seconds) after the initial delay covering for the fade in of the scene
float FinalDelay = 0.1f
 the duration (in seconds) to apply after the fade in of the scene
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
bool RequiresPlayerType = true
 if this is true, this can only be activated by player Characters
bool RequiresButtonActivationAbility = true
 if this is true, this zone can only be activated if the character has the required ability
bool Activable = true
 if this is false, the zone won't be activable
bool AutoActivation = false
 if true, the zone will activate whether the button is pressed or not
bool AutoActivationAndButtonInteraction = false
 if true, this zone will be auto activated but will still allow button interaction
float AutoActivationDelay = 0f
 the delay, in seconds, during which the character has to be within the zone to activate it
bool AutoActivationDelayResetsOnExit = true
 if this is true, exiting the zone will reset the auto activation delay
bool CanOnlyActivateIfGrounded = false
 if this is set to false, the zone won't be activable while not grounded
bool ShouldUpdateState = true
 Set this to true if you want the CharacterBehaviorState to be notified of the player's entry into the zone.
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
LayerMask TargetLayerMask = ~0
 a layermask with all the layers that can interact with this specific button activated zone
bool UnlimitedActivations = true
 if this is set to false, your number of activations will be MaxNumberOfActivations
int MaxNumberOfActivations = 0
 the number of times the zone can be interacted with
int NumberOfActivationsLeft
 the amount of remaining activations on this zone
float DelayBetweenUses = 0f
 the delay (in seconds) after an activation during which the zone can't be activated
bool DisableAfterUse = false
 if this is true, the zone will disable itself (forever or until you manually reactivate it) after its last use
InputTypes InputType = InputTypes.Default
 the selected input type (default, button or key)
string InputButton = "Interact"
 the selected button string used to activate this zone
KeyCode InputKey = KeyCode.Space
 the key used to activate this zone
string AnimationTriggerParameterName
 an (absolutely optional) animation parameter that can be triggered on the character when activating the zone
bool UseVisualPrompt = true
 if this is true, a prompt will be shown if setup properly
ButtonPrompt ButtonPromptPrefab
 the gameobject to instantiate to present the prompt
string ButtonPromptText = "A"
 the text to display in the button prompt
Color ButtonPromptColor = MMColors.LawnGreen
 the text to display in the button prompt
Color ButtonPromptTextColor = MMColors.White
 the color for the prompt's text
bool AlwaysShowPrompt = true
 If true, the "buttonA" prompt will always be shown, whether the player is in the zone or not.
bool ShowPromptWhenColliding = true
 If true, the "buttonA" prompt will be shown when a player is colliding with the zone.
bool HidePromptAfterUse = false
 If true, the prompt will hide after use.
Vector3 PromptRelativePosition = Vector3.zero
 the position of the actual buttonA prompt relative to the object's center
Vector3 PromptRotation = Vector3.zero
 the rotation of the actual buttonA prompt
MMFeedbacks ActivationFeedback
 a feedback to play when the zone gets activated
MMFeedbacks DeniedFeedback
 a feedback to play when the zone tries to get activated but can't
MMFeedbacks EnterFeedback
 a feedback to play when the zone gets entered
MMFeedbacks ExitFeedback
 a feedback to play when the zone gets exited
UnityEvent OnActivation
 a UnityEvent to trigger when this zone gets activated
UnityEvent OnEnter
 a UnityEvent to trigger when this zone gets entered
UnityEvent OnExit
 a UnityEvent to trigger when this zone gets exited
UnityEvent OnStay
 a UnityEvent to trigger when a character is within the zone

Protected Member Functions

virtual void Awake ()
 On start we initialize our ignore list.
virtual void InitializeTeleporter ()
 Grabs the current room in the parent if needed.
override void TriggerEnter (GameObject collider)
 Triggered when something enters the teleporter.
virtual void Teleport (GameObject collider)
 Teleports whatever enters the portal to a new destination.
virtual IEnumerator TeleportSequence (GameObject collider)
 Handles the teleport sequence (fade in, pause, fade out)
virtual void SequenceStart (GameObject collider)
 Describes the events happening before the initial fade in.
virtual void AfterInitialDelay (GameObject collider)
 Describes the events happening after the initial delay has passed.
virtual void AfterFadeOut (GameObject collider)
 Describes the events happening once the initial fade in is complete.
virtual void TeleportCollider (GameObject collider)
 Teleports the object going through the teleporter, either instantly or by tween.
virtual IEnumerator TeleportTweenCo (GameObject collider, Vector3 origin, Vector3 destination)
 Tweens the object from origin to destination.
virtual void AfterDelayBetweenFades (GameObject collider)
 Describes the events happening after the pause between the fade in and the fade out.
virtual void AfterFadeIn (GameObject collider)
 Describes the events happening after the fade in of the scene.
virtual void SequenceEnd (GameObject collider)
 Describes the events happening after the fade out is complete, so at the end of the teleport sequence.
virtual void OnDrawGizmos ()
 On draw gizmos, we draw arrows to the target destination and target room if there are any.
Protected Member Functions inherited from MoreMountains.TopDownEngine.ButtonActivated
virtual void OnEnable ()
 On Enable, we initialize our ButtonActivated zone.
virtual void OnDisable ()
 On disable we disable our input action if needed.
virtual IEnumerator TriggerButtonActionCo ()
virtual void Update ()
virtual void ActivateZone ()
 Activates the zone.
virtual void OnTriggerEnter2D (Collider2D collidingObject)
 Handles enter collision with 2D triggers.
virtual void OnTriggerExit2D (Collider2D collidingObject)
 Handles enter collision with 2D triggers.
virtual void OnTriggerEnter (Collider collidingObject)
 Handles enter collision with 2D triggers.
virtual void OnTriggerExit (Collider collidingObject)
 Handles enter collision with 2D triggers.
virtual void TriggerExit (GameObject collider)
 Triggered when something exits the water.
virtual bool TestForLastObject (GameObject collider)
 Tests if the object exiting our zone is the last remaining one.
virtual bool CheckConditions (GameObject collider)
 Determines whether or not this zone should be activated.

Protected Attributes

Character _player
Character _characterTester
CharacterGridMovement _characterGridMovement
List< Transform > _ignoreList
Vector3 _entryPosition
Vector3 _newPosition
Protected Attributes inherited from MoreMountains.TopDownEngine.ButtonActivated
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 float LocalTime [get]
virtual float LocalDeltaTime [get]
Properties inherited from MoreMountains.TopDownEngine.ButtonActivated
virtual bool AutoActivationInProgress [get, set]
virtual float AutoActivationStartedAt [get, set]
bool InputActionPerformed [get]

Detailed Description

Add this script to a trigger collider2D or collider to teleport objects from that object to its destination.

Member Enumeration Documentation

◆ CameraModes

the possible modes the teleporter can interact with the camera system on activation, either doing nothing, teleporting the camera to a new position, or blending between Cinemachine virtual cameras

Enumerator
DoNothing 
TeleportCamera 
CinemachinePriority 

◆ TeleportationModes

the possible teleportation modes (either 1-frame instant teleportation, or tween between this teleporter and its destination)

Enumerator
Instant 
Tween 

◆ TimeModes

the possible time modes

Enumerator
Unscaled 
Scaled 

Member Function Documentation

◆ AddToIgnoreList()

virtual void MoreMountains.TopDownEngine.Teleporter.AddToIgnoreList ( Transform objectToIgnore)
virtual

Adds an object to the ignore list, which will prevent that object to be moved by the teleporter while it's in that list.

Parameters
objectToIgnoreObject to ignore.

◆ AfterDelayBetweenFades()

virtual void MoreMountains.TopDownEngine.Teleporter.AfterDelayBetweenFades ( GameObject collider)
protectedvirtual

Describes the events happening after the pause between the fade in and the fade out.

◆ AfterFadeIn()

virtual void MoreMountains.TopDownEngine.Teleporter.AfterFadeIn ( GameObject collider)
protectedvirtual

Describes the events happening after the fade in of the scene.

Parameters
collider

◆ AfterFadeOut()

virtual void MoreMountains.TopDownEngine.Teleporter.AfterFadeOut ( GameObject collider)
protectedvirtual

Describes the events happening once the initial fade in is complete.

◆ AfterInitialDelay()

virtual void MoreMountains.TopDownEngine.Teleporter.AfterInitialDelay ( GameObject collider)
protectedvirtual

Describes the events happening after the initial delay has passed.

Parameters
collider

◆ Awake()

virtual void MoreMountains.TopDownEngine.Teleporter.Awake ( )
protectedvirtual

On start we initialize our ignore list.

◆ InitializeTeleporter()

virtual void MoreMountains.TopDownEngine.Teleporter.InitializeTeleporter ( )
protectedvirtual

Grabs the current room in the parent if needed.

◆ OnDrawGizmos()

virtual void MoreMountains.TopDownEngine.Teleporter.OnDrawGizmos ( )
protectedvirtual

On draw gizmos, we draw arrows to the target destination and target room if there are any.

◆ SequenceEnd()

virtual void MoreMountains.TopDownEngine.Teleporter.SequenceEnd ( GameObject collider)
protectedvirtual

Describes the events happening after the fade out is complete, so at the end of the teleport sequence.

◆ SequenceStart()

virtual void MoreMountains.TopDownEngine.Teleporter.SequenceStart ( GameObject collider)
protectedvirtual

Describes the events happening before the initial fade in.

Parameters
collider

◆ Teleport()

virtual void MoreMountains.TopDownEngine.Teleporter.Teleport ( GameObject collider)
protectedvirtual

Teleports whatever enters the portal to a new destination.

◆ TeleportCollider()

virtual void MoreMountains.TopDownEngine.Teleporter.TeleportCollider ( GameObject collider)
protectedvirtual

Teleports the object going through the teleporter, either instantly or by tween.

Parameters
collider

◆ TeleportSequence()

virtual IEnumerator MoreMountains.TopDownEngine.Teleporter.TeleportSequence ( GameObject collider)
protectedvirtual

Handles the teleport sequence (fade in, pause, fade out)

Parameters
collider
Returns

◆ TeleportTweenCo()

virtual IEnumerator MoreMountains.TopDownEngine.Teleporter.TeleportTweenCo ( GameObject collider,
Vector3 origin,
Vector3 destination )
protectedvirtual

Tweens the object from origin to destination.

Parameters
collider
origin
destination
Returns

◆ TriggerButtonAction()

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

If we're button activated and if the button is pressed, we teleport.

Reimplemented from MoreMountains.TopDownEngine.ButtonActivated.

◆ TriggerEnter()

override void MoreMountains.TopDownEngine.Teleporter.TriggerEnter ( GameObject collider)
protectedvirtual

Triggered when something enters the teleporter.

Parameters
colliderCollider.

Reimplemented from MoreMountains.TopDownEngine.ButtonActivated.

◆ TriggerExitAction()

override void MoreMountains.TopDownEngine.Teleporter.TriggerExitAction ( GameObject collider)
virtual

When something exits the teleporter, if it's on the ignore list, we remove it from it, so it'll be considered next time it enters.

Parameters
colliderCollider.

Reimplemented from MoreMountains.TopDownEngine.ButtonActivated.

Member Data Documentation

◆ _characterGridMovement

CharacterGridMovement MoreMountains.TopDownEngine.Teleporter._characterGridMovement
protected

◆ _characterTester

Character MoreMountains.TopDownEngine.Teleporter._characterTester
protected

◆ _entryPosition

Vector3 MoreMountains.TopDownEngine.Teleporter._entryPosition
protected

◆ _ignoreList

List<Transform> MoreMountains.TopDownEngine.Teleporter._ignoreList
protected

◆ _newPosition

Vector3 MoreMountains.TopDownEngine.Teleporter._newPosition
protected

◆ _player

Character MoreMountains.TopDownEngine.Teleporter._player
protected

◆ AddToDestinationIgnoreList

bool MoreMountains.TopDownEngine.Teleporter.AddToDestinationIgnoreList = true

if this is true, the teleported object will be put on the destination's ignore list, to prevent immediate re-entry. If your destination's offset is far enough from its center, you can set that to false

◆ CameraMode

CameraModes MoreMountains.TopDownEngine.Teleporter.CameraMode = CameraModes.TeleportCamera

the chosen camera mode

◆ CurrentRoom

Room MoreMountains.TopDownEngine.Teleporter.CurrentRoom

the room this teleporter belongs to

◆ DelayBetweenFades

float MoreMountains.TopDownEngine.Teleporter.DelayBetweenFades = 0.3f

the duration (in seconds) to wait for after the fade out and before the fade in

◆ Destination

Teleporter MoreMountains.TopDownEngine.Teleporter.Destination

the teleporter's destination

◆ ExitOffset

Vector3 MoreMountains.TopDownEngine.Teleporter.ExitOffset

the offset to apply when exiting this teleporter

◆ FadeIgnoresTimescale

bool MoreMountains.TopDownEngine.Teleporter.FadeIgnoresTimescale = false

if this is true, fade events will ignore timescale

◆ FadeInDuration

float MoreMountains.TopDownEngine.Teleporter.FadeInDuration = 0.2f

the duration (in seconds) after the initial delay covering for the fade in of the scene

◆ FadeOutDuration

float MoreMountains.TopDownEngine.Teleporter.FadeOutDuration = 0.2f

the duration (in seconds) after the initial delay covering for the fade out of the scene

◆ FaderID

int MoreMountains.TopDownEngine.Teleporter.FaderID = 0

the ID of the fader to target

◆ FadeTween

MMTweenType MoreMountains.TopDownEngine.Teleporter.FadeTween = new MMTweenType(MMTween.MMTweenCurve.EaseInCubic)

the curve to use to fade to black

◆ FinalDelay

float MoreMountains.TopDownEngine.Teleporter.FinalDelay = 0.1f

the duration (in seconds) to apply after the fade in of the scene

◆ FreezeCharacter

bool MoreMountains.TopDownEngine.Teleporter.FreezeCharacter = true

whether or not the character should be frozen (input blocked) for the duration of the transition

◆ FreezeTime

bool MoreMountains.TopDownEngine.Teleporter.FreezeTime = false

whether or not time should be frozen during the transition

◆ InitialDelay

float MoreMountains.TopDownEngine.Teleporter.InitialDelay = 0.1f

the delay (in seconds) to apply before running the sequence

◆ MaintainXEntryPositionOnExit

bool MoreMountains.TopDownEngine.Teleporter.MaintainXEntryPositionOnExit = false

whether or not to maintain the x value of the teleported object on exit

◆ MaintainYEntryPositionOnExit

bool MoreMountains.TopDownEngine.Teleporter.MaintainYEntryPositionOnExit = false

whether or not to maintain the y value of the teleported object on exit

◆ MaintainZEntryPositionOnExit

bool MoreMountains.TopDownEngine.Teleporter.MaintainZEntryPositionOnExit = false

whether or not to maintain the z value of the teleported object on exit

◆ MoveMask

bool MoreMountains.TopDownEngine.Teleporter.MoveMask = true

whether or not we should ask to move a MMSpriteMask on activation

◆ MoveMaskCurve

MMTween.MMTweenCurve MoreMountains.TopDownEngine.Teleporter.MoveMaskCurve = MMTween.MMTweenCurve.EaseInCubic

the curve to move the mask along to

◆ MoveMaskDuration

float MoreMountains.TopDownEngine.Teleporter.MoveMaskDuration = 0.2f

the duration of the mask movement (usually the same as the DelayBetweenFades

◆ MoveMaskMethod

MMSpriteMaskEvent.MMSpriteMaskEventTypes MoreMountains.TopDownEngine.Teleporter.MoveMaskMethod = MMSpriteMaskEvent.MMSpriteMaskEventTypes.ExpandAndMoveToNewPosition

the method to move the mask

◆ OnlyAffectsPlayer

bool MoreMountains.TopDownEngine.Teleporter.OnlyAffectsPlayer = true

if true, this won't teleport non player characters

◆ TargetRoom

Room MoreMountains.TopDownEngine.Teleporter.TargetRoom

the target room

◆ TeleportationMode

TeleportationModes MoreMountains.TopDownEngine.Teleporter.TeleportationMode = TeleportationModes.Instant

the selected teleportation mode

◆ TimeMode

TimeModes MoreMountains.TopDownEngine.Teleporter.TimeMode = TimeModes.Unscaled

the timescale to use for the teleport sequence

◆ TriggerFade

bool MoreMountains.TopDownEngine.Teleporter.TriggerFade = false

if this is true, a fade to black will occur when teleporting

◆ TweenCurve

MMTween.MMTweenCurve MoreMountains.TopDownEngine.Teleporter.TweenCurve = MMTween.MMTweenCurve.EaseInCubic

the curve to apply to the teleportation tween

Property Documentation

◆ LocalDeltaTime

virtual float MoreMountains.TopDownEngine.Teleporter.LocalDeltaTime
get

◆ LocalTime

virtual float MoreMountains.TopDownEngine.Teleporter.LocalTime
get

The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/ScriptsCinemachine/Environment/Teleporter.cs