PixelCrushers.DialogueSystem.IncrementOnDestroy Class Reference

Increments an element of the Lua Variable[] table when the GameObject is destroyed or disabled, and then updates the quest tracker if it's attached to the Dialogue Manager object or its children. More...

Inheritance diagram for PixelCrushers.DialogueSystem.IncrementOnDestroy:
Collaboration diagram for PixelCrushers.DialogueSystem.IncrementOnDestroy:

Public Types

enum  IncrementOn { Destroy , Disable , Manually }
 

Public Member Functions

virtual void OnEnable ()
 Only listen for OnDestroy if the script has been enabled.
 
virtual void OnLevelWillBeUnloaded ()
 If the level is being unloaded, this GameObject will be destroyed.
 
virtual void OnApplicationQuit ()
 If the application is ending, don't listen, as this can log errors in the console.
 
virtual void OnDestroy ()
 When this object is destroyed, increment the counter and update the quest tracker if incrementOn is set to Destroy.
 
virtual void OnDisable ()
 When this object is disabled, increment the counter and update the quest tracker if incrementOn is set to Disable.
 
virtual void TryIncrement ()
 Try to increment variable if conditions are met.
 

Public Attributes

IncrementOn incrementOn = IncrementOn.Destroy
 
string variable = string.Empty
 The variable to increment.
 
int increment = 1
 The increment amount.
 
int min = 0
 The minimum value.
 
int max = 100
 The maximum value.
 
string alertMessage = string.Empty
 
float alertDuration = 0
 
Condition condition = new Condition()
 
UnityEvent onIncrement = new UnityEvent()
 

Protected Member Functions

virtual void Awake ()
 
virtual bool CanIncrement ()
 Are the conditions correct to increment?
 
virtual void IncrementNow ()
 Increments variable.
 

Protected Attributes

bool listenForOnDestroy = false
 
bool awakeMarkedForDestroy = false
 

Properties

virtual string actualVariableName [get]
 
string ActualVariableName [get]
 

Detailed Description

Increments an element of the Lua Variable[] table when the GameObject is destroyed or disabled, and then updates the quest tracker if it's attached to the Dialogue Manager object or its children.

This script is useful for kill quests or gathering quests.

Member Enumeration Documentation

◆ IncrementOn

Enumerator
Destroy 
Disable 
Manually 

Member Function Documentation

◆ Awake()

virtual void PixelCrushers.DialogueSystem.IncrementOnDestroy.Awake ( )
inlineprotectedvirtual

◆ CanIncrement()

virtual bool PixelCrushers.DialogueSystem.IncrementOnDestroy.CanIncrement ( )
inlineprotectedvirtual

Are the conditions correct to increment?

◆ IncrementNow()

virtual void PixelCrushers.DialogueSystem.IncrementOnDestroy.IncrementNow ( )
inlineprotectedvirtual

Increments variable.

Assumes conditions to increment have already been checked and passed.

◆ OnApplicationQuit()

virtual void PixelCrushers.DialogueSystem.IncrementOnDestroy.OnApplicationQuit ( )
inlinevirtual

If the application is ending, don't listen, as this can log errors in the console.

◆ OnDestroy()

virtual void PixelCrushers.DialogueSystem.IncrementOnDestroy.OnDestroy ( )
inlinevirtual

When this object is destroyed, increment the counter and update the quest tracker if incrementOn is set to Destroy.

◆ OnDisable()

virtual void PixelCrushers.DialogueSystem.IncrementOnDestroy.OnDisable ( )
inlinevirtual

When this object is disabled, increment the counter and update the quest tracker if incrementOn is set to Disable.

◆ OnEnable()

virtual void PixelCrushers.DialogueSystem.IncrementOnDestroy.OnEnable ( )
inlinevirtual

Only listen for OnDestroy if the script has been enabled.

◆ OnLevelWillBeUnloaded()

virtual void PixelCrushers.DialogueSystem.IncrementOnDestroy.OnLevelWillBeUnloaded ( )
inlinevirtual

If the level is being unloaded, this GameObject will be destroyed.

We don't want to count this in the variable, so disable the script.

◆ TryIncrement()

virtual void PixelCrushers.DialogueSystem.IncrementOnDestroy.TryIncrement ( )
inlinevirtual

Try to increment variable if conditions are met.

Member Data Documentation

◆ alertDuration

float PixelCrushers.DialogueSystem.IncrementOnDestroy.alertDuration = 0

◆ alertMessage

string PixelCrushers.DialogueSystem.IncrementOnDestroy.alertMessage = string.Empty

◆ awakeMarkedForDestroy

bool PixelCrushers.DialogueSystem.IncrementOnDestroy.awakeMarkedForDestroy = false
protected

◆ condition

Condition PixelCrushers.DialogueSystem.IncrementOnDestroy.condition = new Condition()

◆ increment

int PixelCrushers.DialogueSystem.IncrementOnDestroy.increment = 1

The increment amount.

To decrement, use a negative number.

◆ incrementOn

IncrementOn PixelCrushers.DialogueSystem.IncrementOnDestroy.incrementOn = IncrementOn.Destroy

◆ listenForOnDestroy

bool PixelCrushers.DialogueSystem.IncrementOnDestroy.listenForOnDestroy = false
protected

◆ max

int PixelCrushers.DialogueSystem.IncrementOnDestroy.max = 100

The maximum value.

◆ min

int PixelCrushers.DialogueSystem.IncrementOnDestroy.min = 0

The minimum value.

◆ onIncrement

UnityEvent PixelCrushers.DialogueSystem.IncrementOnDestroy.onIncrement = new UnityEvent()

◆ variable

string PixelCrushers.DialogueSystem.IncrementOnDestroy.variable = string.Empty

The variable to increment.

Property Documentation

◆ actualVariableName

virtual string PixelCrushers.DialogueSystem.IncrementOnDestroy.actualVariableName
getprotected

◆ ActualVariableName

string PixelCrushers.DialogueSystem.IncrementOnDestroy.ActualVariableName
getprotected

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