TopDown Engine v4.5
Loading...
Searching...
No Matches
MoreMountains.TopDownEngine.AutoRespawn Class Reference

Add this script to an object and it will automatically be reactivated and revived when the player respawns. More...

Inheritance diagram for MoreMountains.TopDownEngine.AutoRespawn:
MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.TopDownEngine.Respawnable MoreMountains.Tools.MMMonoBehaviour

Public Member Functions

delegate void OnReviveDelegate ()
virtual void OnPlayerRespawn (CheckPoint checkpoint, Character player)
 When the player respawns, we reinstate this agent.
virtual void Kill ()
 Kills this object, turning its parts off based on the settings set in the inspector.
virtual void Revive ()
 Revives this object, turning its parts back on again.

Public Attributes

bool RespawnOnPlayerRespawn = true
 if this is true, this object will respawn at its last position when the player revives
bool RepositionToInitOnPlayerRespawn = false
 if this is true, this object will be repositioned at its initial position when the player revives
bool DisableAllComponentsOnKill = false
 if this is true, all components on this object will be disabled on kill
bool DisableGameObjectOnKill = true
 if this is true, this gameobject will be disabled on kill
bool IgnoreCheckpointsAlwaysRespawn = true
 if this is true, the object will always respawn, whether or not it's associated to a checkpoint
List< CheckPointAssociatedCheckpoints
 if the player respawns at these checkpoints, the object will be respawned
float AutoRespawnDuration = 0f
 if this has a value superior to 0, this object will respawn at its last position X seconds after its death
int AutoRespawnAmount = 3
 the amount of times this object can auto respawn
int AutoRespawnRemainingAmount = 3
 the remaining amounts of respawns (readonly, controlled by the class at runtime)
GameObject RespawnEffect
 the effect to instantiate when the player respawns
AudioClip RespawnSfx
 the sfx to play when the player respawns
UnityEvent OnReviveEvent
 a Unity Event to trigger when respawning
OnReviveDelegate OnRevive

Protected Member Functions

virtual void Start ()
 On Start we grab our various components.
virtual void Update ()
 On Update we check whether we should be reviving this agent.
virtual void InstantiateRespawnEffect ()
 Instantiates the respawn effect at the object's position.
virtual void PlayRespawnSound ()
 Plays the respawn sound.

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

Detailed Description

Add this script to an object and it will automatically be reactivated and revived when the player respawns.

Member Function Documentation

◆ InstantiateRespawnEffect()

virtual void MoreMountains.TopDownEngine.AutoRespawn.InstantiateRespawnEffect ( )
protectedvirtual

Instantiates the respawn effect at the object's position.

◆ Kill()

virtual void MoreMountains.TopDownEngine.AutoRespawn.Kill ( )
virtual

Kills this object, turning its parts off based on the settings set in the inspector.

◆ OnPlayerRespawn()

virtual void MoreMountains.TopDownEngine.AutoRespawn.OnPlayerRespawn ( CheckPoint checkpoint,
Character player )
virtual

When the player respawns, we reinstate this agent.

Parameters
checkpointCheckpoint.
playerPlayer.

Implements MoreMountains.TopDownEngine.Respawnable.

◆ OnReviveDelegate()

delegate void MoreMountains.TopDownEngine.AutoRespawn.OnReviveDelegate ( )

◆ PlayRespawnSound()

virtual void MoreMountains.TopDownEngine.AutoRespawn.PlayRespawnSound ( )
protectedvirtual

Plays the respawn sound.

◆ Revive()

virtual void MoreMountains.TopDownEngine.AutoRespawn.Revive ( )
virtual

Revives this object, turning its parts back on again.

◆ Start()

virtual void MoreMountains.TopDownEngine.AutoRespawn.Start ( )
protectedvirtual

On Start we grab our various components.

◆ Update()

virtual void MoreMountains.TopDownEngine.AutoRespawn.Update ( )
protectedvirtual

On Update we check whether we should be reviving this agent.

Member Data Documentation

◆ _aiBrain

AIBrain MoreMountains.TopDownEngine.AutoRespawn._aiBrain
protected

◆ _character

Character MoreMountains.TopDownEngine.AutoRespawn._character
protected

◆ _collider2D

Collider2D MoreMountains.TopDownEngine.AutoRespawn._collider2D
protected

◆ _firstRespawn

bool MoreMountains.TopDownEngine.AutoRespawn._firstRespawn = true
protected

◆ _health

Health MoreMountains.TopDownEngine.AutoRespawn._health
protected

◆ _initialPosition

Vector3 MoreMountains.TopDownEngine.AutoRespawn._initialPosition
protected

◆ _otherComponents

MonoBehaviour [] MoreMountains.TopDownEngine.AutoRespawn._otherComponents
protected

◆ _renderer

Renderer MoreMountains.TopDownEngine.AutoRespawn._renderer
protected

◆ _reviving

bool MoreMountains.TopDownEngine.AutoRespawn._reviving = false
protected

◆ _timeOfDeath

float MoreMountains.TopDownEngine.AutoRespawn._timeOfDeath = 0f
protected

◆ AssociatedCheckpoints

List<CheckPoint> MoreMountains.TopDownEngine.AutoRespawn.AssociatedCheckpoints

if the player respawns at these checkpoints, the object will be respawned

◆ AutoRespawnAmount

int MoreMountains.TopDownEngine.AutoRespawn.AutoRespawnAmount = 3

the amount of times this object can auto respawn

◆ AutoRespawnDuration

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

◆ AutoRespawnRemainingAmount

int MoreMountains.TopDownEngine.AutoRespawn.AutoRespawnRemainingAmount = 3

the remaining amounts of respawns (readonly, controlled by the class at runtime)

◆ DisableAllComponentsOnKill

bool MoreMountains.TopDownEngine.AutoRespawn.DisableAllComponentsOnKill = false

if this is true, all components on this object will be disabled on kill

◆ DisableGameObjectOnKill

bool MoreMountains.TopDownEngine.AutoRespawn.DisableGameObjectOnKill = true

if this is true, this gameobject will be disabled on kill

◆ IgnoreCheckpointsAlwaysRespawn

bool MoreMountains.TopDownEngine.AutoRespawn.IgnoreCheckpointsAlwaysRespawn = true

if this is true, the object will always respawn, whether or not it's associated to a checkpoint

◆ OnRevive

OnReviveDelegate MoreMountains.TopDownEngine.AutoRespawn.OnRevive

◆ OnReviveEvent

UnityEvent MoreMountains.TopDownEngine.AutoRespawn.OnReviveEvent

a Unity Event to trigger when respawning

◆ RepositionToInitOnPlayerRespawn

bool MoreMountains.TopDownEngine.AutoRespawn.RepositionToInitOnPlayerRespawn = false

if this is true, this object will be repositioned at its initial position when the player revives

◆ RespawnEffect

GameObject MoreMountains.TopDownEngine.AutoRespawn.RespawnEffect

the effect to instantiate when the player respawns

◆ RespawnOnPlayerRespawn

bool MoreMountains.TopDownEngine.AutoRespawn.RespawnOnPlayerRespawn = true

if this is true, this object will respawn at its last position when the player revives

◆ RespawnSfx

AudioClip MoreMountains.TopDownEngine.AutoRespawn.RespawnSfx

the sfx to play when the player respawns


The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/Common/Scripts/Spawn/AutoRespawn.cs