Пример #1
0
        public void Add(ITurnQueue queueContent)
        {
            int key = _time + queueContent.Time;

            if (!_queueContent.ContainsKey(key))
            {
                _queueContent.Add(key, new List <ITurnQueue>());
            }
            _queueContent[key].Add(queueContent);
        }
Пример #2
0
        public void Remove(ITurnQueue scheduleable)
        {
            KeyValuePair <int, List <ITurnQueue> > scheduleableListFound
                = new KeyValuePair <int, List <ITurnQueue> >(-1, null);

            foreach (var scheduleablesList in _queueContent)
            {
                if (scheduleablesList.Value.Contains(scheduleable))
                {
                    scheduleableListFound = scheduleablesList;
                    break;
                }
            }
            if (scheduleableListFound.Value != null)
            {
                scheduleableListFound.Value.Remove(scheduleable);
                if (scheduleableListFound.Value.Count <= 0)
                {
                    _queueContent.Remove(scheduleableListFound.Key);
                }
            }
        }
Пример #3
0
        public void ActivateMobs()
        {
            ITurnQueue turnQueue = Game.TurnQueue.Get();

            if (turnQueue is Player)
            {
                IsPlayerTurn = true;
                Game.TurnQueue.Add(Player.GetInstance());
            }
            else
            {
                Monster monster = turnQueue as Monster;

                if (monster != null)
                {
                    monster.PerformAction(this);
                    Game.TurnQueue.Add(monster);
                }

                ActivateMobs();
            }
        }