Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.Trigger Class Reference

Base class for triggers. This handles the character assignment logic. Although you don't need to extend your triggers from this class it may be useful to ensure compatability with other classes in the kit. More...

Inheritance diagram for PlatformerPro.Trigger:
PlatformerPro.PersistableObject PlatformerPro.PlatformerProMonoBehaviour PlatformerPro.ConditionTrigger PlatformerPro.OneWayTrigger PlatformerPro.ProximityTrigger PlatformerPro.TimerTrigger PlatformerPro.TriggerCombiner PlatformerPro.TriggerPlatformTrigger PlatformerPro.UnityTrigger

Public Attributes

TriggerTarget[] receivers
 The Targets that receive the triggers actions. More...
 
bool actAsSwitch
 If true this trigger will have an on/off state and the trigger actions will only be sent if they match the on/off state. More...
 
bool startSwitchAsOn
 If true the switch starts in the on state. More...
 
bool sendSwitchEventsOnLoad = true
 
bool oneShot
 Fire this trigger once only then disable? More...
 
float autoLeaveTime
 Time after enter in which leave will be automatically triggered. Ignored if 0 or smaller. More...
 
MonoBehaviour requiredComponent
 If this is not null (none) then the required MonoBehaviour must be active and enabled before trigger will activate. More...
 
bool useDefaultPersistence
 Does this Item get persistence defaults form the Game manager? More...
 
- Public Attributes inherited from PlatformerPro.PersistableObject
bool enablePersistence
 Should we enable persistence? More...
 
string guid = System.Guid.NewGuid().ToString()
 Unique ID for this object. You shoulnd't need to edit this, use editor debug mode if you must. More...
 
GameObject target
 GameObject to apply persitence settings to, defaults to self. More...
 
PersistableObjectType persistenceImplementation
 How do we implement the persistence settings. More...
 
bool defaultStateIsDisabled
 If true then the obejct starts disabled. More...
 
string spawnedObjectName
 If this item was spawned then save the name of the prefab here. More...
 

Static Public Attributes

static Color GizmoColor = new Color (1, 0.64f, 0, 0.5f)
 Default color to use when draing Trigger gizmos. More...
 

Protected Member Functions

virtual void OnTriggerEntered (Character character, bool onOffState)
 Raises the trigger entered event. More...
 
virtual void OnTriggerExited (Character character)
 Raises the trigger exited event. More...
 
override void PostInit ()
 Initialise the sensor. More...
 
virtual bool EnterTrigger (Character character)
 Character entered proximity. More...
 
virtual void DoEnterTrigger (Character character)
 Do the trigger work More...
 
virtual void SavePersistenceData ()
 Gets the extra persistence data which is used to save platform state. NOTE: Generally you should override ExtraPersistenceData to save a different set of data. More...
 
override void ApplyCustomPersistence (PersistableObjectData data)
 Custom persistable implementation. Override to customise. More...
 
virtual bool ConditionsMet (Character character)
 Are the conditions for firing this trigger met? More...
 
virtual bool ExitConditionsMet (Character character)
 Are the conditions for exiting trigger met. More...
 
virtual IEnumerator DoLeaveAfterDelay (Character character, float delay)
 Does the autoleave action. Cancelled by the leave being triggerd. More...
 
virtual bool LeaveTrigger (Character character)
 Character leaves the trigger. More...
 
virtual void DoLeaveTrigger (Character character)
 Does the actual work for leavinga trigger. More...
 
- Protected Member Functions inherited from PlatformerPro.PersistableObject
virtual void SetPersistenceDefaults ()
 Sets the persistence defaults. More...
 
virtual void ProcessState ()
 Processes the persisted state. More...
 
virtual void ApplyExtraPersistenceData (PersistableObjectData data)
 Apply any extra data. This differs from custom persistence, as custom persistence must control both data and ctivation state. More...
 

Protected Attributes

IEnumerator autoLeaveRoutine
 Stores the autoleave routine. More...
 
AdditionalCondition[] conditions
 Cached list of all additional conditions. More...
 
bool onOffState
 Are we on or off? true = on. More...
 

Static Protected Attributes

static bool isLoaded
 Have we reloaded characters. More...
 

Properties

bool SwitchState [get]
 
- Properties inherited from PlatformerPro.PersistableObject
virtual string ExtraPersistenceData [get]
 Gets the extra persistence data. More...
 
- Properties inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual string Header [get]
 Gets the header string used to describe the component. More...
 
virtual string DocLink [get]
 Gets a link to documentation site. More...
 
virtual string VideoLink [get]
 Gets a link to a youtube video. More...
 
virtual string Deprecated [get]
 If non-null this component is deprecated. The string shows a message indicating how it should be replaced. More...
 

Events

System.EventHandler< CharacterEventArgsTriggerEntered
 Event for trigger enter. More...
 
System.EventHandler< CharacterEventArgsTriggerExited
 Event for trigger leave. More...
 

Additional Inherited Members

- Public Member Functions inherited from PlatformerPro.PersistableObject
void SetPersistenceState (bool state)
 Sets the persistence state. More...
 
void SetPersistenceState (bool state, string extraPersistenceData)
 Sets the persistence state, overriding extra persistence data More...
 
- Public Member Functions inherited from PlatformerPro.PlatformerProMonoBehaviour
virtual void Validate (PlatformerProMonoBehaviour myTarget)
 Override this method if you want to provide custom validation. The actual code should be surrounded by the if UNITY_EDITOR / endif directive. More...
 

Detailed Description

Base class for triggers. This handles the character assignment logic. Although you don't need to extend your triggers from this class it may be useful to ensure compatability with other classes in the kit.

Member Function Documentation

◆ ApplyCustomPersistence()

override void PlatformerPro.Trigger.ApplyCustomPersistence ( PersistableObjectData  data)
protectedvirtual

Custom persistable implementation. Override to customise.

Parameters
dataData.

Reimplemented from PlatformerPro.PersistableObject.

◆ ConditionsMet()

virtual bool PlatformerPro.Trigger.ConditionsMet ( Character  character)
protectedvirtual

Are the conditions for firing this trigger met?

Parameters
characterCharacter.

◆ DoEnterTrigger()

virtual void PlatformerPro.Trigger.DoEnterTrigger ( Character  character)
protectedvirtual

Do the trigger work

Parameters
characterCharacter.

◆ DoLeaveAfterDelay()

virtual IEnumerator PlatformerPro.Trigger.DoLeaveAfterDelay ( Character  character,
float  delay 
)
protectedvirtual

Does the autoleave action. Cancelled by the leave being triggerd.

Parameters
characterCharacter.
delayDelay.

◆ DoLeaveTrigger()

virtual void PlatformerPro.Trigger.DoLeaveTrigger ( Character  character)
protectedvirtual

Does the actual work for leavinga trigger.

Parameters
characterCharacter.

◆ EnterTrigger()

virtual bool PlatformerPro.Trigger.EnterTrigger ( Character  character)
protectedvirtual

Character entered proximity.

Parameters
characterCharacter. NOTE: This can be null if triggered by something that is not a character.

Reimplemented in PlatformerPro.ConditionTrigger.

◆ ExitConditionsMet()

virtual bool PlatformerPro.Trigger.ExitConditionsMet ( Character  character)
protectedvirtual

Are the conditions for exiting trigger met.

Returns
true, if conditions are met, false otherwise.
Parameters
characterCharacter.

◆ LeaveTrigger()

virtual bool PlatformerPro.Trigger.LeaveTrigger ( Character  character)
protectedvirtual

Character leaves the trigger.

Parameters
characterCharacter. NOTE: This can be null if triggered by something that is not a character.

Reimplemented in PlatformerPro.ConditionTrigger.

◆ OnTriggerEntered()

virtual void PlatformerPro.Trigger.OnTriggerEntered ( Character  character,
bool  onOffState 
)
protectedvirtual

Raises the trigger entered event.

Parameters
characterCharacter.

◆ OnTriggerExited()

virtual void PlatformerPro.Trigger.OnTriggerExited ( Character  character)
protectedvirtual

Raises the trigger exited event.

Parameters
characterCharacter.

◆ PostInit()

override void PlatformerPro.Trigger.PostInit ( )
protectedvirtual

Initialise the sensor.

Reimplemented from PlatformerPro.PersistableObject.

◆ SavePersistenceData()

virtual void PlatformerPro.Trigger.SavePersistenceData ( )
protectedvirtual

Gets the extra persistence data which is used to save platform state. NOTE: Generally you should override ExtraPersistenceData to save a different set of data.

Member Data Documentation

◆ actAsSwitch

bool PlatformerPro.Trigger.actAsSwitch

If true this trigger will have an on/off state and the trigger actions will only be sent if they match the on/off state.

◆ autoLeaveRoutine

IEnumerator PlatformerPro.Trigger.autoLeaveRoutine
protected

Stores the autoleave routine.

◆ autoLeaveTime

float PlatformerPro.Trigger.autoLeaveTime

Time after enter in which leave will be automatically triggered. Ignored if 0 or smaller.

◆ conditions

AdditionalCondition [] PlatformerPro.Trigger.conditions
protected

Cached list of all additional conditions.

◆ GizmoColor

Color PlatformerPro.Trigger.GizmoColor = new Color (1, 0.64f, 0, 0.5f)
static

Default color to use when draing Trigger gizmos.

◆ isLoaded

bool PlatformerPro.Trigger.isLoaded
staticprotected

Have we reloaded characters.

◆ oneShot

bool PlatformerPro.Trigger.oneShot

Fire this trigger once only then disable?

◆ onOffState

bool PlatformerPro.Trigger.onOffState
protected

Are we on or off? true = on.

◆ receivers

TriggerTarget [] PlatformerPro.Trigger.receivers

The Targets that receive the triggers actions.

◆ requiredComponent

MonoBehaviour PlatformerPro.Trigger.requiredComponent

If this is not null (none) then the required MonoBehaviour must be active and enabled before trigger will activate.

◆ sendSwitchEventsOnLoad

bool PlatformerPro.Trigger.sendSwitchEventsOnLoad = true

◆ startSwitchAsOn

bool PlatformerPro.Trigger.startSwitchAsOn

If true the switch starts in the on state.

◆ useDefaultPersistence

bool PlatformerPro.Trigger.useDefaultPersistence

Does this Item get persistence defaults form the Game manager?

Property Documentation

◆ SwitchState

bool PlatformerPro.Trigger.SwitchState
get

Event Documentation

◆ TriggerEntered

System.EventHandler<CharacterEventArgs> PlatformerPro.Trigger.TriggerEntered

Event for trigger enter.

◆ TriggerExited

System.EventHandler<CharacterEventArgs> PlatformerPro.Trigger.TriggerExited

Event for trigger leave.


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