Core GameKit  3.2.9.0
The ultimate pooling / combat / spawning / variable plugin!
DarkTonic.CoreGameKit.Killable Class Reference

This class is used to set up Killable, used for combat objects with attack points and hit points. Also can be used for pickups such as coins and health packs. More...

Inheritance diagram for DarkTonic.CoreGameKit.Killable:

Public Member Functions

virtual void BecameVisible ()
 This gets called when the Killable becomes visible. More...
 
virtual void BecameInvisible ()
 This gets called when the Killable becomes invisible More...
 
virtual void ControllerColliderHit (GameObject hit, bool calledFromOtherKillable=false)
 This gets called when the Killable has a collision from a CharacterController. Do not call this. More...
 
void AddAttackPoints (int pointsToAdd)
 Call this method to add attack points to the Killable. More...
 
void AddHitPoints (int pointsToAdd)
 Call this method to add hit points to the Killable. More...
 
void FireRespawnEvents ()
 Gets called internally, you should never need to call this. More...
 
void StartDeathTimer ()
 Use this method to start the death timer. Timer will start from "now". More...
 
void StopDeathTimer ()
 Use this method to stop the death timer. More...
 
void TemporaryInvincibility (float seconds)
 Call this method to make your Killable invincible for X seconds. More...
 
virtual void ModifyWorldVariables (WorldVariableCollection modCollection, bool isDamage, bool fireAnyway=false)
 This method is used to change World Variable values during damage or destruction. This can be overridden in a subclass to do other things. More...
 
virtual bool DespawnPrefab ()
 Override this in a subclass if you want to use a network Destroy or something like that More...
 
virtual Transform SpawnPrefab (Transform prefabToSpawn, Vector3 spawnPos)
 Override this in a subclass if you want to use a network Instantiate or something like that More...
 
virtual Transform SpawnDeathPrefab (Transform deathPre, Vector3 spawnPos, Quaternion spawnRotation, Transform theParent)
 Override this in a subclass if you want to use a network Instantiate or something like that More...
 
virtual bool Despawn (TriggeredSpawner.EventType eType)
 Call this method to despawn the Killable. This is not the same as DestroyKillable. This will not spawn a death prefab and will not modify World Variables. More...
 
virtual bool DespawnOrRespawn ()
 Despawns or respawns depending on the setup option chosen. Except when Despawn Behavior is set to "Disable", in which case this game object is disabled instead. More...
 
virtual bool DespawnThis ()
 This handles just despawning the item, when it's decided that you don't want to just immediately respawn it. More...
 
void DestroyImmediately (string scenarioName=DestroyedText)
 This method can be called to immediately destroy the Killable (death delay will be ignored) More...
 
virtual void DestroyKillable (string scenarioName=DestroyedText, bool skipDeathDelay=false)
 Call this method when you want the Killable to die. The death prefab (if any) will be spawned and World Variable Modifiers will be executed. More...
 
virtual string DetermineScenario (string scenarioName)
 This method you can override in a subclass to add logic to decide which Scenario to use. More...
 
virtual bool IsInvincible ()
 Determines whether this instance is invincible. More...
 
virtual bool IsTemporarilyInvincible ()
 Determines whether this instance is temporarily invincible. More...
 
virtual void Knockback (Killable enemy)
 This will knock back (and up) this Killable based on the Knockback settings of Enemy passed in. More...
 
virtual void TakeDamage (int damagePoints)
 Call this method to inflict X points of damage to a Killable. More...
 
virtual void TakeDamage (int damagePoints, Killable enemy)
 Call this method to inflict X points of damage to a Killable. More...
 

Protected Member Functions

virtual void Despawned ()
 This method is automatically called just before the Killable is Despawned More...
 
virtual void _OnClick ()
 This method gets called when a Killable is clicked More...
 
virtual void _OnMouseDown ()
 This method gets called when a Killable has a mouse button clicked down. More...
 
virtual void DamagePrefabFailedSpawn (Transform prefabToSpawn)
 This method will be called when a Damage Prefab fails to spawn. More...
 
virtual void DamagePrefabSpawned (Transform spawnedDamagePrefab)
 This method will be called when a Damage Prefab spawns. More...
 
virtual void DamagePrevented (int pointsDamage, Killable enemyHitBy)
 This method is called when damage is prevents by Invincibility More...
 
virtual void DeathDelayStarted ()
 This method gets called when the death delay starts (good to override and play a death animation). More...
 
virtual void DeathPrefabFailedSpawn (Transform deathPre)
 This method gets called when a Death Prefab fails to spawn. More...
 
virtual void DeathPrefabSpawned (Transform spawnedDeathPrefab)
 This method gets called when a Death Prefab spawns. More...
 
virtual void ModifyDamageWorldVariables (List< WorldVariableModifier > mods)
 This method will be called when the Damage World Variable Modifiers are about to be modified. More...
 
virtual void ModifyDeathWorldVariables (List< WorldVariableModifier > mods)
 This method will be called when the Death World Variable Modifiers are about to be modified. More...
 
virtual bool ShouldDieFromNonDamageHit (Killable enemyKillable)
 This method will be used for "Any Hit" deaths if specified. You can override this to add additional criteria to a subclass. More...
 
virtual bool ShouldFireDamageVariableModifiers ()
 This will determine whether or not to use the "Damage World Variable Modifiers" that are set up whenever the Killable is damaged. More...
 
virtual bool ShouldFireDeathVariableModifiers ()
 This will determine whether or not to use the "Death World Variable Modifiers" that are set up whenever the Killable is damaged. More...
 
virtual void SpawnedOrAwake (bool spawned=true)
 This method gets called whenever the object is spawned or starts in a Scene (from Awake event) More...
 
virtual void SpawnerDestroyed ()
 This method gets called when the game object that spawned this Killable is destroyed. More...
 
virtual void TakingDamage (int damagePoints, Killable enemy)
 This method when damage is valid and is about to be inflicted (no invincibility). More...
 

Properties

List< KillableChildKillables [get]
 Returns a list of all Killables that are a child of this one. More...
 
int CurrentHitPoints [get, set]
 The current hit points. More...
 
Transform CurrentVanishPrefab [get]
 This returns the Vanish prefab for this Killable (spawned when it despawns if not "killed"). More...
 
Transform CurrentDealDamagePrefab [get]
 This returns the Deal Damage prefab for this Killable (spawned on things it damages only). More...
 
Transform CurrentInvinceHitPrefab [get]
 This returns the Invince Hit prefab for this Killable (spawned when it is hit while Invincible). More...
 
bool GameIsOverForKillable [get]
 This property will return true if the Game Over Behavior setting makes this Killable disabled. More...
 
bool IsDead [get]
 This will return if the Killable has died (maybe of use to other non-CGK scripts). More...
 
bool IsGravBody [get]
 Returns whether the Killable has a gravity rigidbody (3d or 2d) More...
 
Killable KilledBy [get]
 This property will return a reference to the Killable that dealt lethal damage to this one. More...
 
Vector3 RespawnPosition [get, set]
 Gets or sets the respawn position. Defaults to the location last spawned. More...
 
GameObject SpawnedFromObject [get]
 The game object this Killable was spawned from, if any. More...
 
Transform Trans [get]
 This property returns a cached lazy-lookup of the Transform component. More...
 
int TimesRespawned [get]
 This property returns the number of times this Killable has been respawned since it was first spawned. More...
 

Detailed Description

This class is used to set up Killable, used for combat objects with attack points and hit points. Also can be used for pickups such as coins and health packs.

Member Function Documentation

virtual void DarkTonic.CoreGameKit.Killable._OnClick ( )
protectedvirtual

This method gets called when a Killable is clicked

virtual void DarkTonic.CoreGameKit.Killable._OnMouseDown ( )
protectedvirtual

This method gets called when a Killable has a mouse button clicked down.

void DarkTonic.CoreGameKit.Killable.AddAttackPoints ( int  pointsToAdd)

Call this method to add attack points to the Killable.

Parameters
pointsToAddThe number of attack points to add.
void DarkTonic.CoreGameKit.Killable.AddHitPoints ( int  pointsToAdd)

Call this method to add hit points to the Killable.

Parameters
pointsToAddThe number of hit points to add to "current hit points".
virtual void DarkTonic.CoreGameKit.Killable.BecameInvisible ( )
virtual

This gets called when the Killable becomes invisible

virtual void DarkTonic.CoreGameKit.Killable.BecameVisible ( )
virtual

This gets called when the Killable becomes visible.

virtual void DarkTonic.CoreGameKit.Killable.ControllerColliderHit ( GameObject  hit,
bool  calledFromOtherKillable = false 
)
virtual

This gets called when the Killable has a collision from a CharacterController. Do not call this.

Parameters
hitThe game object being hit.
calledFromOtherKillableThe object calling this method
virtual void DarkTonic.CoreGameKit.Killable.DamagePrefabFailedSpawn ( Transform  prefabToSpawn)
protectedvirtual

This method will be called when a Damage Prefab fails to spawn.

Parameters
prefabToSpawnThe prefab that failed spawn.
virtual void DarkTonic.CoreGameKit.Killable.DamagePrefabSpawned ( Transform  spawnedDamagePrefab)
protectedvirtual

This method will be called when a Damage Prefab spawns.

Parameters
spawnedDamagePrefabThe prefab that spawned.
virtual void DarkTonic.CoreGameKit.Killable.DamagePrevented ( int  pointsDamage,
Killable  enemyHitBy 
)
protectedvirtual

This method is called when damage is prevents by Invincibility

Parameters
pointsDamageThe number of points prevented.
enemyHitByThe enemy that tried to inflict damage.
virtual void DarkTonic.CoreGameKit.Killable.DeathDelayStarted ( )
protectedvirtual

This method gets called when the death delay starts (good to override and play a death animation).

virtual void DarkTonic.CoreGameKit.Killable.DeathPrefabFailedSpawn ( Transform  deathPre)
protectedvirtual

This method gets called when a Death Prefab fails to spawn.

Parameters
deathPreThe Death Prefab that failed to spawn.
virtual void DarkTonic.CoreGameKit.Killable.DeathPrefabSpawned ( Transform  spawnedDeathPrefab)
protectedvirtual

This method gets called when a Death Prefab spawns.

Parameters
spawnedDeathPrefabThe spawned Death Prefab.
virtual bool DarkTonic.CoreGameKit.Killable.Despawn ( TriggeredSpawner.EventType  eType)
virtual

Call this method to despawn the Killable. This is not the same as DestroyKillable. This will not spawn a death prefab and will not modify World Variables.

Parameters
eTypeThe event type.
virtual void DarkTonic.CoreGameKit.Killable.Despawned ( )
protectedvirtual

This method is automatically called just before the Killable is Despawned

virtual bool DarkTonic.CoreGameKit.Killable.DespawnOrRespawn ( )
virtual

Despawns or respawns depending on the setup option chosen. Except when Despawn Behavior is set to "Disable", in which case this game object is disabled instead.

virtual bool DarkTonic.CoreGameKit.Killable.DespawnPrefab ( )
virtual

Override this in a subclass if you want to use a network Destroy or something like that

virtual bool DarkTonic.CoreGameKit.Killable.DespawnThis ( )
virtual

This handles just despawning the item, when it's decided that you don't want to just immediately respawn it.

void DarkTonic.CoreGameKit.Killable.DestroyImmediately ( string  scenarioName = DestroyedText)

This method can be called to immediately destroy the Killable (death delay will be ignored)

Parameters
scenarioName
virtual void DarkTonic.CoreGameKit.Killable.DestroyKillable ( string  scenarioName = DestroyedText,
bool  skipDeathDelay = false 
)
virtual

Call this method when you want the Killable to die. The death prefab (if any) will be spawned and World Variable Modifiers will be executed.

Parameters
scenarioName(optional) pass the name of an alternate scenario if you wish to use a different set of World Variable Modifiers from that scenario.
skipDeathDelayYou can pass true to skip the death delay and "destroy now"
virtual string DarkTonic.CoreGameKit.Killable.DetermineScenario ( string  scenarioName)
virtual

This method you can override in a subclass to add logic to decide which Scenario to use.

Parameters
scenarioNameThe default scenario is passed here by default (Destroyed).
Returns
The chosen Scenario name.
void DarkTonic.CoreGameKit.Killable.FireRespawnEvents ( )

Gets called internally, you should never need to call this.

virtual bool DarkTonic.CoreGameKit.Killable.IsInvincible ( )
virtual

Determines whether this instance is invincible.

Returns
true if this instance is invincible; otherwise, false.
virtual bool DarkTonic.CoreGameKit.Killable.IsTemporarilyInvincible ( )
virtual

Determines whether this instance is temporarily invincible.

Returns
true if this instance is temporarily invincible; otherwise, false.
virtual void DarkTonic.CoreGameKit.Killable.Knockback ( Killable  enemy)
virtual

This will knock back (and up) this Killable based on the Knockback settings of Enemy passed in.

Parameters
enemyThe enemy knocking back this Killable.
virtual void DarkTonic.CoreGameKit.Killable.ModifyDamageWorldVariables ( List< WorldVariableModifier >  mods)
protectedvirtual

This method will be called when the Damage World Variable Modifiers are about to be modified.

Parameters
modsThe World Variable Modifier collection
virtual void DarkTonic.CoreGameKit.Killable.ModifyDeathWorldVariables ( List< WorldVariableModifier >  mods)
protectedvirtual

This method will be called when the Death World Variable Modifiers are about to be modified.

Parameters
modsThe World Variable Modifier collection
virtual void DarkTonic.CoreGameKit.Killable.ModifyWorldVariables ( WorldVariableCollection  modCollection,
bool  isDamage,
bool  fireAnyway = false 
)
virtual

This method is used to change World Variable values during damage or destruction. This can be overridden in a subclass to do other things.

Parameters
modCollectionThe collection of World Variable modifications.
isDamageTrue if from damage, false otherwise.
fireAnywayOptional switch to ignore result of "ShouldFire" methods
virtual bool DarkTonic.CoreGameKit.Killable.ShouldDieFromNonDamageHit ( Killable  enemyKillable)
protectedvirtual

This method will be used for "Any Hit" deaths if specified. You can override this to add additional criteria to a subclass.

Parameters
enemyKillable
Returns
virtual bool DarkTonic.CoreGameKit.Killable.ShouldFireDamageVariableModifiers ( )
protectedvirtual

This will determine whether or not to use the "Damage World Variable Modifiers" that are set up whenever the Killable is damaged.

Returns
virtual bool DarkTonic.CoreGameKit.Killable.ShouldFireDeathVariableModifiers ( )
protectedvirtual

This will determine whether or not to use the "Death World Variable Modifiers" that are set up whenever the Killable is damaged.

Returns
virtual Transform DarkTonic.CoreGameKit.Killable.SpawnDeathPrefab ( Transform  deathPre,
Vector3  spawnPos,
Quaternion  spawnRotation,
Transform  theParent 
)
virtual

Override this in a subclass if you want to use a network Instantiate or something like that

Parameters
deathPreThe death prefab.
spawnPosThe position to spawn it in.
spawnRotationThe rotation to spawn it in.
theParentThe object to parent the spawned death prefab to.
Returns
The Transform of the spawned death prefab.
virtual void DarkTonic.CoreGameKit.Killable.SpawnedOrAwake ( bool  spawned = true)
protectedvirtual

This method gets called whenever the object is spawned or starts in a Scene (from Awake event)

Parameters
spawnedTrue if spawned, false if in the Scene at beginning.
virtual void DarkTonic.CoreGameKit.Killable.SpawnerDestroyed ( )
protectedvirtual

This method gets called when the game object that spawned this Killable is destroyed.

virtual Transform DarkTonic.CoreGameKit.Killable.SpawnPrefab ( Transform  prefabToSpawn,
Vector3  spawnPos 
)
virtual

Override this in a subclass if you want to use a network Instantiate or something like that

Parameters
prefabToSpawnThe prefab to spawn.
spawnPosThe position to spawn in.
Returns
The Transform of the spawned prefab.
void DarkTonic.CoreGameKit.Killable.StartDeathTimer ( )

Use this method to start the death timer. Timer will start from "now".

void DarkTonic.CoreGameKit.Killable.StopDeathTimer ( )

Use this method to stop the death timer.

virtual void DarkTonic.CoreGameKit.Killable.TakeDamage ( int  damagePoints)
virtual

Call this method to inflict X points of damage to a Killable.

Parameters
damagePointsThe number of points of damage to inflict.
virtual void DarkTonic.CoreGameKit.Killable.TakeDamage ( int  damagePoints,
Killable  enemy 
)
virtual

Call this method to inflict X points of damage to a Killable.

Parameters
damagePointsThe number of points of damage to inflict.
enemyThe other Killable that collided with this one.
virtual void DarkTonic.CoreGameKit.Killable.TakingDamage ( int  damagePoints,
Killable  enemy 
)
protectedvirtual

This method when damage is valid and is about to be inflicted (no invincibility).

Parameters
damagePointsNumber of damage points to take.
enemyThe enemy that dealt the damage.
void DarkTonic.CoreGameKit.Killable.TemporaryInvincibility ( float  seconds)

Call this method to make your Killable invincible for X seconds.

Parameters
secondsNumber of seconds to make your Killable invincible.

Property Documentation

List<Killable> DarkTonic.CoreGameKit.Killable.ChildKillables
get

Returns a list of all Killables that are a child of this one.

Transform DarkTonic.CoreGameKit.Killable.CurrentDealDamagePrefab
get

This returns the Deal Damage prefab for this Killable (spawned on things it damages only).

int DarkTonic.CoreGameKit.Killable.CurrentHitPoints
getset

The current hit points.

Transform DarkTonic.CoreGameKit.Killable.CurrentInvinceHitPrefab
get

This returns the Invince Hit prefab for this Killable (spawned when it is hit while Invincible).

Transform DarkTonic.CoreGameKit.Killable.CurrentVanishPrefab
get

This returns the Vanish prefab for this Killable (spawned when it despawns if not "killed").

bool DarkTonic.CoreGameKit.Killable.GameIsOverForKillable
get

This property will return true if the Game Over Behavior setting makes this Killable disabled.

bool DarkTonic.CoreGameKit.Killable.IsDead
get

This will return if the Killable has died (maybe of use to other non-CGK scripts).

bool DarkTonic.CoreGameKit.Killable.IsGravBody
get

Returns whether the Killable has a gravity rigidbody (3d or 2d)

Killable DarkTonic.CoreGameKit.Killable.KilledBy
get

This property will return a reference to the Killable that dealt lethal damage to this one.

Vector3 DarkTonic.CoreGameKit.Killable.RespawnPosition
getset

Gets or sets the respawn position. Defaults to the location last spawned.

The respawn position.

GameObject DarkTonic.CoreGameKit.Killable.SpawnedFromObject
get

The game object this Killable was spawned from, if any.

int DarkTonic.CoreGameKit.Killable.TimesRespawned
get

This property returns the number of times this Killable has been respawned since it was first spawned.

Transform DarkTonic.CoreGameKit.Killable.Trans
get

This property returns a cached lazy-lookup of the Transform component.


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