TopDown Engine  v4.2
MoreMountains.TopDownEngine.ProximityManager Class Reference

A class that looks for objects with a ProximityManaged class on them, and enables/disables them based on their settings. This class is meant as an example of how you can deal with large scenes with a lot of objects, disabling the ones that are far away from the action to save on performance. Note that there are many ways to do it, this one is simple and generic, there may be better choices for your specific use case. More...

Inheritance diagram for MoreMountains.TopDownEngine.ProximityManager:
MoreMountains.Tools.MMSingleton< ProximityManager > MoreMountains.Tools.MMEventListener< TopDownEngineEvent >

Public Member Functions

virtual void AddControlledObject (ProximityManaged newObject)
 A public method used to add new controlled objects at runtime More...
 
virtual void OnMMEvent (TopDownEngineEvent engineEvent)
 When we get a level start event, we assign our player as a target More...
 
- Public Member Functions inherited from MoreMountains.Tools.MMEventListener< TopDownEngineEvent >
void OnMMEvent (T eventType)
 

Public Attributes

bool AutomaticallySetPlayerAsTarget = true
 whether or not to automatically grab the player from the LevelManager once the scene loads More...
 
Transform ProximityTarget
 the target to detect proximity with More...
 
bool RequireProximityTarget = true
 in this mode, if there's no ProximityTarget, proximity managed objects will be disabled
More...
 
bool AutomaticallyGrabControlledObjects = true
 whether or not to automatically grab all ProximityManaged objects in the scene More...
 
List< ProximityManagedControlledObjects
 the list of objects to check proximity with More...
 
float EvaluationFrequency = 0.5f
 the frequency, in seconds, at which to evaluate distances and enable/disable stuff More...
 

Protected Member Functions

virtual void Start ()
 On start we grab our controlled objects More...
 
virtual void GrabControlledObjects ()
 Grabs all proximity managed objects in the scene More...
 
virtual void SetPlayerAsTarget ()
 Grabs the player from the level manager More...
 
virtual void Update ()
 On Update we check our distances More...
 
virtual void EvaluateDistance ()
 Checks distances if needed More...
 
virtual void OnEnable ()
 On enable we start listening for events More...
 
virtual void OnDisable ()
 On disable we stop listening for events More...
 
- Protected Member Functions inherited from MoreMountains.Tools.MMSingleton< ProximityManager >
virtual void Awake ()
 On awake, we initialize our instance. Make sure to call base.Awake() in override if you need awake. More...
 
virtual void InitializeSingleton ()
 Initializes the singleton. More...
 

Static Protected Member Functions

static void InitializeStatics ()
 Statics initialization to support enter play modes More...
 

Protected Attributes

float _lastEvaluationAt = 0f
 

Additional Inherited Members

- Static Public Member Functions inherited from MoreMountains.Tools.MMSingleton< ProximityManager >
static T TryGetInstance ()
 
- Static Public Attributes inherited from MoreMountains.Tools.MMSingleton< ProximityManager >
static bool HasInstance
 
static T Current
 
- Static Protected Attributes inherited from MoreMountains.Tools.MMSingleton< ProximityManager >
static T _instance
 
- Properties inherited from MoreMountains.Tools.MMSingleton< ProximityManager >
static T Instance [get]
 Singleton design pattern More...
 

Detailed Description

A class that looks for objects with a ProximityManaged class on them, and enables/disables them based on their settings. This class is meant as an example of how you can deal with large scenes with a lot of objects, disabling the ones that are far away from the action to save on performance. Note that there are many ways to do it, this one is simple and generic, there may be better choices for your specific use case.

Member Function Documentation

◆ AddControlledObject()

virtual void MoreMountains.TopDownEngine.ProximityManager.AddControlledObject ( ProximityManaged  newObject)
virtual

A public method used to add new controlled objects at runtime

Parameters
newObject

◆ EvaluateDistance()

virtual void MoreMountains.TopDownEngine.ProximityManager.EvaluateDistance ( )
protectedvirtual

Checks distances if needed

◆ GrabControlledObjects()

virtual void MoreMountains.TopDownEngine.ProximityManager.GrabControlledObjects ( )
protectedvirtual

Grabs all proximity managed objects in the scene

◆ InitializeStatics()

static void MoreMountains.TopDownEngine.ProximityManager.InitializeStatics ( )
staticprotected

Statics initialization to support enter play modes

◆ OnDisable()

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

On disable we stop listening for events

◆ OnEnable()

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

On enable we start listening for events

◆ OnMMEvent()

virtual void MoreMountains.TopDownEngine.ProximityManager.OnMMEvent ( TopDownEngineEvent  engineEvent)
virtual

When we get a level start event, we assign our player as a target

Parameters
engineEvent

◆ SetPlayerAsTarget()

virtual void MoreMountains.TopDownEngine.ProximityManager.SetPlayerAsTarget ( )
protectedvirtual

Grabs the player from the level manager

◆ Start()

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

On start we grab our controlled objects

◆ Update()

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

On Update we check our distances

Member Data Documentation

◆ _lastEvaluationAt

float MoreMountains.TopDownEngine.ProximityManager._lastEvaluationAt = 0f
protected

◆ AutomaticallyGrabControlledObjects

bool MoreMountains.TopDownEngine.ProximityManager.AutomaticallyGrabControlledObjects = true

whether or not to automatically grab all ProximityManaged objects in the scene

◆ AutomaticallySetPlayerAsTarget

bool MoreMountains.TopDownEngine.ProximityManager.AutomaticallySetPlayerAsTarget = true

whether or not to automatically grab the player from the LevelManager once the scene loads

◆ ControlledObjects

List<ProximityManaged> MoreMountains.TopDownEngine.ProximityManager.ControlledObjects

the list of objects to check proximity with

◆ EvaluationFrequency

float MoreMountains.TopDownEngine.ProximityManager.EvaluationFrequency = 0.5f

the frequency, in seconds, at which to evaluate distances and enable/disable stuff

◆ ProximityTarget

Transform MoreMountains.TopDownEngine.ProximityManager.ProximityTarget

the target to detect proximity with

◆ RequireProximityTarget

bool MoreMountains.TopDownEngine.ProximityManager.RequireProximityTarget = true

in this mode, if there's no ProximityTarget, proximity managed objects will be disabled


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