/// <summary> /// Gets a runner form the pool with the specified duration. /// </summary> /// <param name="action">The action to run after the specified delay. (May be null.)</param> /// <param name="delay"> /// The number of seconds to wait before calling the action. [Limit: >=0] /// </param> /// <returns>A runner from the pool or a new runner if the pool is empty.</returns> public static DelayedActionRunner GetFromPool(System.Action action, float delay) { CheckForPool(); var result = m_Pool.GetPooledObject(); result.Reset(action, Mathf.Max(0, delay)); // Don't wan't accidental -1. return(result); }
/// <summary> /// Gets a timer form the pool with the specified duration. /// </summary> /// <param name="duration">The timer duration. (Seconds)</param> /// <returns>A timer reference the pool or a new timer if the pool is empty.</returns> public static SimpleTimer GetFromPool(float duration) { CheckForPool(); var result = m_Pool.GetPooledObject(); result.Reset(Mathf.Max(0, duration)); // Don't wan't accidental -1. return(result); }
/// <summary> /// Gets a timer form the pool with the specified duration. /// </summary> /// <param name="minimum"> /// The minimum number of seconds to run. /// [Limits: 0 <= value <= <paramref name="maximum"/>.] /// </param> /// <param name="maximum">The maximum number of seconds to run. [Limit: >= 0]</param> /// <returns> /// A timer from the pool that is ready to use, or a new timer if the pool is empty. /// </returns> public static SimpleRangeTimer GetFromPool(float minimum, float maximum) { CheckForPool(); var result = m_Pool.GetPooledObject(); // Don't wan't accidental -1 in parameters. result.Reset(Mathf.Max(0, minimum), Mathf.Max(0, maximum)); return(result); }