Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine.SceneManagement;
- using PathologicalGames;
- namespace SpartanFist
- {
- public class TimedAutoDespawner : AutoDespawner
- {
- protected float despawnTimeRemaining = 0.0f;
- protected bool despawnRequested = false;
- const float DefaultDespawnTime = 1.0f;
- public virtual void SetDespawnTime(float newTime) { despawnTimeRemaining = newTime; }
- public virtual void ForceDespawn() { despawnRequested = true; }
- protected virtual void OnEnable()
- {
- despawnTimeRemaining = DefaultDespawnTime;
- despawnRequested = false;
- }
- protected override bool ShouldDespawn(float deltaTime)
- {
- despawnTimeRemaining -= deltaTime;
- if (despawnTimeRemaining <= 0.0f || despawnRequested)
- {
- return true;
- }
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment