TopDown Engine v4.5
Loading...
Searching...
No Matches
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< T > MoreMountains.Tools.MMEventListener< T > MoreMountains.Tools.MMEventListenerBase

Public Member Functions

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

Public Attributes

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

Protected Member Functions

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

Static Protected Member Functions

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

Protected Attributes

float _lastEvaluationAt = 0f

Additional Inherited Members

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

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()

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:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Managers/ProximityManager.cs