예제 #1
0
        public void AddTicker(IResource r)
        {
            Timer t = new Timer();
            t.SetTickRate(GameConfig.GetResourceTickRate(r));

            t.OnStart += t_OnStart;
            t.OnStop += t_OnStop;
            t.OnTick += t_OnTick;
            m_Timer.Add(new KeyValuePair<IResource, Timer>(r, t));
            t.SetTarget(-1);
            t.Start();
        }
예제 #2
0
        public void Add(Model.Buildings.IBuilding b,IBuildingFunction f)
        {
            CreateQueueView.Dispatch(new UnityEngine.Vector2(-Screen.width * 0.5f + 128 + m_Queue.Count * 128, 64),b);

            m_Queue.Add(new KeyValuePair<GameObject, IBuilding>(QueueElements.Last(), b));
            m_Functions.Add(new KeyValuePair<IBuildingFunction, IBuilding>(f, b));

            Timer t = new Timer();
            

            t.OnStart += t_OnStart;
            t.OnTick += t_OnTick;
            t.OnStop += t_OnStop;


            t.SetTarget(f.TimeRequired);
            m_Timers.Add(new KeyValuePair<GameObject, Timer>(QueueElements.Last(), t));
            m_BuildingTimers.Add(new KeyValuePair<IBuilding, ITimer>(b, t));

            t.Start();

            AddConstructionPrefab(b,f);
            
        }