Corgi Engine  v8.8
MoreMountains.CorgiEngine.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.CorgiEngine.ProximityManager:
MoreMountains.CorgiEngine.CorgiMonoBehaviour MoreMountains.Tools.MMEventListener< CorgiEngineEvent >

Public Member Functions

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

float _lastEvaluationAt = 0f
 

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.CorgiEngine.ProximityManager.AddControlledObject ( ProximityManaged  newObject)
virtual

A public method used to add new controlled objects at runtime

Parameters
newObject

◆ EvaluateDistance()

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

Checks distances if needed

◆ GrabControlledObjects()

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

Grabs all proximity managed objects in the scene

◆ OnDisable()

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

On disable we stop listening for events

◆ OnEnable()

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

On enable we start listening for events

◆ OnMMEvent()

virtual void MoreMountains.CorgiEngine.ProximityManager.OnMMEvent ( CorgiEngineEvent  engineEvent)
virtual

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

Parameters
engineEvent

◆ SetPlayerAsTarget()

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

Grabs the player from the level manager

◆ Start()

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

On start we grab our controlled objects

◆ Update()

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

On Update we check our distances

Member Data Documentation

◆ _lastEvaluationAt

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

◆ AutomaticallyGrabControlledObjects

bool MoreMountains.CorgiEngine.ProximityManager.AutomaticallyGrabControlledObjects = true

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

◆ AutomaticallySetPlayerAsTarget

bool MoreMountains.CorgiEngine.ProximityManager.AutomaticallySetPlayerAsTarget = true

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

◆ ControlledObjects

List<ProximityManaged> MoreMountains.CorgiEngine.ProximityManager.ControlledObjects

the list of objects to check proximity with

◆ EvaluationFrequency

float MoreMountains.CorgiEngine.ProximityManager.EvaluationFrequency = 0.5f

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

◆ ProximityTarget

Transform MoreMountains.CorgiEngine.ProximityManager.ProximityTarget

the target to detect proximity with


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