wangguan
2020-12-26 1fe72e022dad01d87d64ba90d22db110029b8136
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using Core.Utilities;
using UnityEngine;
 
namespace TowerDefense.Level
{
    /// <summary>
    /// Basic implementation of intro: a delay
    /// </summary>
    public class TimedLevelIntro : LevelIntro
    {
        /// <summary>
        /// The delay
        /// </summary>
        public float time = 5f;
 
        /// <summary>
        /// Timer object used to track the delayed
        /// </summary>
        protected Timer m_Timer;
 
        /// <summary>
        /// Set up the timer and make it fire the SafelyCallIntroCompleted event
        /// </summary>
        protected void Awake()
        {
            m_Timer = new Timer(time, SafelyCallIntroCompleted);
        }
 
        /// <summary>
        /// Tick the timer and disable it on completion
        /// </summary>
        protected void Update()
        {
            if (m_Timer != null)
            {
                if (m_Timer.Tick(Time.deltaTime))
                {
                    m_Timer = null;
                }
            }
        }
    }
}