Insanely huge initial commit

This commit is contained in:
2026-02-21 17:04:05 -08:00
parent 9cdd36191a
commit 613d75914a
22525 changed files with 4035207 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
using UnityEngine;
using System.Collections;
namespace MoreMountains.Tools
{
/// <summary>
/// Add this component to an object and it'll be auto destroyed X seconds after its Start()
/// </summary>
[AddComponentMenu("More Mountains/Tools/Activation/MMTimedDestruction")]
public class MMTimedDestruction : MonoBehaviour
{
/// the possible destruction modes
public enum TimedDestructionModes { Destroy, Disable }
/// the destruction mode for this object : destroy or disable
public TimedDestructionModes TimeDestructionMode = TimedDestructionModes.Destroy;
/// The time (in seconds) before we destroy the object
public float TimeBeforeDestruction=2;
/// <summary>
/// On Start(), we schedule the object's destruction
/// </summary>
protected virtual void Start ()
{
StartCoroutine(Destruction());
}
/// <summary>
/// Destroys the object after TimeBeforeDestruction seconds
/// </summary>
protected virtual IEnumerator Destruction()
{
yield return MMCoroutine.WaitFor(TimeBeforeDestruction);
if (TimeDestructionMode == TimedDestructionModes.Destroy)
{
Destroy(gameObject);
}
else
{
gameObject.SetActive(false);
}
}
}
}