Пример #1
0
        /// <summary>
        /// Starts timer with specified duration.
        /// </summary>
        /// <param name="duration">Duration.</param>
        public void Start(float duration)
        {
            DebugEx.VeryVerboseFormat("Timer.Start(duration = {0})", duration);

            if (duration >= 0f)
            {
                mDuration = duration;
                mTime     = 0f;
            }
            else
            {
                DebugEx.ErrorFormat("Invalid duration value: {0}", duration);
            }
        }
Пример #2
0
        /// <summary>
        /// Starts timer with specified duration and timeout action.
        /// </summary>
        /// <param name="onTimeout">On timeout action.</param>
        /// <param name="duration">Duration.</param>
        public void Start(UnityAction onTimeout, float duration)
        {
            DebugEx.VeryVerboseFormat("Timer.Start(onTimeout = {0}, duration = {1})", onTimeout, duration);

            if (duration >= 0f)
            {
                mDuration  = duration;
                mOnTimeout = onTimeout;
                mTime      = 0f;
            }
            else
            {
                DebugEx.ErrorFormat("Invalid duration value: {0}", duration);
            }
        }