TopDown Engine
v4.2
|
Add this script to an object and it will automatically be reactivated and revived when the player respawns. More...
Public Member Functions | |
delegate void | OnReviveDelegate () |
virtual void | OnPlayerRespawn (CheckPoint checkpoint, Character player) |
When the player respawns, we reinstate this agent. More... | |
virtual void | Kill () |
Kills this object, turning its parts off based on the settings set in the inspector More... | |
virtual void | Revive () |
Revives this object, turning its parts back on again More... | |
Public Attributes | |
bool | RespawnOnPlayerRespawn = true |
if this is true, this object will respawn at its last position when the player revives More... | |
bool | RepositionToInitOnPlayerRespawn = false |
if this is true, this object will be repositioned at its initial position when the player revives More... | |
bool | DisableAllComponentsOnKill = false |
if this is true, all components on this object will be disabled on kill More... | |
bool | DisableGameObjectOnKill = true |
if this is true, this gameobject will be disabled on kill More... | |
bool | IgnoreCheckpointsAlwaysRespawn = true |
if this is true, the object will always respawn, whether or not it's associated to a checkpoint More... | |
List< CheckPoint > | AssociatedCheckpoints |
if the player respawns at these checkpoints, the object will be respawned More... | |
float | AutoRespawnDuration = 0f |
if this has a value superior to 0, this object will respawn at its last position X seconds after its death More... | |
int | AutoRespawnAmount = 3 |
the amount of times this object can auto respawn More... | |
int | AutoRespawnRemainingAmount = 3 |
the remaining amounts of respawns (readonly, controlled by the class at runtime) More... | |
GameObject | RespawnEffect |
the effect to instantiate when the player respawns More... | |
AudioClip | RespawnSfx |
the sfx to play when the player respawns More... | |
UnityEvent | OnReviveEvent |
a Unity Event to trigger when respawning More... | |
OnReviveDelegate | OnRevive |
Protected Member Functions | |
virtual void | Start () |
On Start we grab our various components More... | |
virtual void | Update () |
On Update we check whether we should be reviving this agent More... | |
virtual void | InstantiateRespawnEffect () |
Instantiates the respawn effect at the object's position More... | |
virtual void | PlayRespawnSound () |
Plays the respawn sound. More... | |
Protected Attributes | |
MonoBehaviour[] | _otherComponents |
Collider2D | _collider2D |
Renderer | _renderer |
Character | _character |
Health | _health |
bool | _reviving = false |
float | _timeOfDeath = 0f |
bool | _firstRespawn = true |
Vector3 | _initialPosition |
AIBrain | _aiBrain |
Add this script to an object and it will automatically be reactivated and revived when the player respawns.
|
protectedvirtual |
Instantiates the respawn effect at the object's position
|
virtual |
Kills this object, turning its parts off based on the settings set in the inspector
|
virtual |
When the player respawns, we reinstate this agent.
checkpoint | Checkpoint. |
player | Player. |
Implements MoreMountains.TopDownEngine.Respawnable.
delegate void MoreMountains.TopDownEngine.AutoRespawn.OnReviveDelegate | ( | ) |
|
protectedvirtual |
Plays the respawn sound.
|
virtual |
Revives this object, turning its parts back on again
|
protectedvirtual |
On Start we grab our various components
|
protectedvirtual |
On Update we check whether we should be reviving this agent
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
List<CheckPoint> MoreMountains.TopDownEngine.AutoRespawn.AssociatedCheckpoints |
if the player respawns at these checkpoints, the object will be respawned
int MoreMountains.TopDownEngine.AutoRespawn.AutoRespawnAmount = 3 |
the amount of times this object can auto respawn
float MoreMountains.TopDownEngine.AutoRespawn.AutoRespawnDuration = 0f |
if this has a value superior to 0, this object will respawn at its last position X seconds after its death
int MoreMountains.TopDownEngine.AutoRespawn.AutoRespawnRemainingAmount = 3 |
the remaining amounts of respawns (readonly, controlled by the class at runtime)
bool MoreMountains.TopDownEngine.AutoRespawn.DisableAllComponentsOnKill = false |
if this is true, all components on this object will be disabled on kill
bool MoreMountains.TopDownEngine.AutoRespawn.DisableGameObjectOnKill = true |
if this is true, this gameobject will be disabled on kill
bool MoreMountains.TopDownEngine.AutoRespawn.IgnoreCheckpointsAlwaysRespawn = true |
if this is true, the object will always respawn, whether or not it's associated to a checkpoint
OnReviveDelegate MoreMountains.TopDownEngine.AutoRespawn.OnRevive |
UnityEvent MoreMountains.TopDownEngine.AutoRespawn.OnReviveEvent |
a Unity Event to trigger when respawning
bool MoreMountains.TopDownEngine.AutoRespawn.RepositionToInitOnPlayerRespawn = false |
if this is true, this object will be repositioned at its initial position when the player revives
GameObject MoreMountains.TopDownEngine.AutoRespawn.RespawnEffect |
the effect to instantiate when the player respawns
bool MoreMountains.TopDownEngine.AutoRespawn.RespawnOnPlayerRespawn = true |
if this is true, this object will respawn at its last position when the player revives
AudioClip MoreMountains.TopDownEngine.AutoRespawn.RespawnSfx |
the sfx to play when the player respawns