Loading...
Searching...
No Matches
AdventureCore.TriggerArea< TArea, TItem > Class Template Referenceabstract

Detailed Description

generic base class for trigger areas that are entered by trigger items
in unity gameobjects that are destroyed do not exit collision which can be annoying
by having scripts on both sides of the collision and registering with each other we can make sure to always get enter and exit
either implement a custom script that performs some logic with the participants(like lock on, damage)
or use the GenericTriggerArea to add logic to the events in the inspector(traps in AdventureSouls)
keep in mind this is meant for triggers not collisions, if you have problems getting the events check https://docs.unity3d.com/Manual/CollidersOverview.html

Template Parameters
TArea
TItem
Type Constraints
TArea :TriggerArea 
TArea :TArea 
TArea :TItem 
TItem :TriggerItem 
TItem :TArea 
TItem :TItem 
Inheritance diagram for AdventureCore.TriggerArea< TArea, TItem >:

Public Member Functions

virtual void AddItem (TItem item)
 
virtual void RemoveItem (TItem item)
 

Public Attributes

UnityEvent< TItem > ItemAdded
 
UnityEvent< TItem > ItemRemoved
 
UnityEvent ItemsChanged
 

Protected Member Functions

virtual void OnEnable ()
 
virtual void OnDisable ()
 
virtual void OnTriggerEnter2D (Collider2D collision)
 
virtual void OnTriggerExit2D (Collider2D collision)
 
virtual void OnTriggerEnter (Collider other)
 
virtual void OnTriggerExit (Collider other)
 
void clear ()
 
virtual void tryAdd (Component component)
 
virtual void tryRemove (Component component)
 
virtual void onItemAdded (TItem item)
 
virtual void onItemRemoved (TItem item)
 

Protected Attributes

Dictionary< TItem, int > _items = new Dictionary<TItem, int>()
 

Properties

IEnumerable< TItem > Items [get]