Feel  3.16
The best way to improve your game's feel and make it extra juicy
MoreMountains.Tools.MMViewportEdgeTeleporter Class Reference

Add this class to an object and it will automatically teleport to the other end of the screen when reaching the screen's edges More...

Inheritance diagram for MoreMountains.Tools.MMViewportEdgeTeleporter:

Public Member Functions

virtual void SetCamera (Camera newCamera)
 Sets a new camera More...
 

Public Attributes

bool AutoGrabMainCamera
 whether or not to grab the Camera.main and store it on init More...
 
Camera MainCamera
 the camera used to compute viewport positions More...
 
Vector2 ViewportOrigin = new Vector2(0f, 0f)
 the origin values of the viewport More...
 
Vector2 ViewportDimensions = new Vector2(1f, 1f)
 the dimensions of the viewport More...
 
Vector2 TeleportOrigin = new Vector2(0f, 0f)
 the origin of the teleport destination zone More...
 
Vector2 TeleportDimensions = new Vector2(1f, 1f)
 the dimensions of the teleport destination zone More...
 
UnityEvent OnTeleport
 an event to trigger on teleport More...
 

Protected Member Functions

virtual void Awake ()
 On Awake we initialize our teleporter More...
 
virtual void Initialization ()
 Stores the main camera if needed More...
 
virtual void Update ()
 On Update we check our position relative to the edges More...
 
virtual void DetectEdges ()
 Detects edges, compares with our object's position, and moves it if needed More...
 

Protected Attributes

Vector3 _viewportPosition
 
Vector3 _newViewportPosition
 

Detailed Description

Add this class to an object and it will automatically teleport to the other end of the screen when reaching the screen's edges

Member Function Documentation

◆ Awake()

virtual void MoreMountains.Tools.MMViewportEdgeTeleporter.Awake ( )
protectedvirtual

On Awake we initialize our teleporter

◆ DetectEdges()

virtual void MoreMountains.Tools.MMViewportEdgeTeleporter.DetectEdges ( )
protectedvirtual

Detects edges, compares with our object's position, and moves it if needed

◆ Initialization()

virtual void MoreMountains.Tools.MMViewportEdgeTeleporter.Initialization ( )
protectedvirtual

Stores the main camera if needed

◆ SetCamera()

virtual void MoreMountains.Tools.MMViewportEdgeTeleporter.SetCamera ( Camera  newCamera)
virtual

Sets a new camera

Parameters
newCamera

◆ Update()

virtual void MoreMountains.Tools.MMViewportEdgeTeleporter.Update ( )
protectedvirtual

On Update we check our position relative to the edges

Member Data Documentation

◆ _newViewportPosition

Vector3 MoreMountains.Tools.MMViewportEdgeTeleporter._newViewportPosition
protected

◆ _viewportPosition

Vector3 MoreMountains.Tools.MMViewportEdgeTeleporter._viewportPosition
protected

◆ AutoGrabMainCamera

bool MoreMountains.Tools.MMViewportEdgeTeleporter.AutoGrabMainCamera

whether or not to grab the Camera.main and store it on init

◆ MainCamera

Camera MoreMountains.Tools.MMViewportEdgeTeleporter.MainCamera

the camera used to compute viewport positions

◆ OnTeleport

UnityEvent MoreMountains.Tools.MMViewportEdgeTeleporter.OnTeleport

an event to trigger on teleport

◆ TeleportDimensions

Vector2 MoreMountains.Tools.MMViewportEdgeTeleporter.TeleportDimensions = new Vector2(1f, 1f)

the dimensions of the teleport destination zone

◆ TeleportOrigin

Vector2 MoreMountains.Tools.MMViewportEdgeTeleporter.TeleportOrigin = new Vector2(0f, 0f)

the origin of the teleport destination zone

◆ ViewportDimensions

Vector2 MoreMountains.Tools.MMViewportEdgeTeleporter.ViewportDimensions = new Vector2(1f, 1f)

the dimensions of the viewport

◆ ViewportOrigin

Vector2 MoreMountains.Tools.MMViewportEdgeTeleporter.ViewportOrigin = new Vector2(0f, 0f)

the origin values of the viewport


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