Пример #1
0
        private void CancelChanneledSkill(object channeledSkillObject)
        {
            //TODO: Don't remove channeled skills but expire them
            lock (_locker)
            {
                //wait for Update if in progress
                while (!_go)
                {
                    Monitor.Wait(_locker);
                }
                //Block updates and everything else until full addition of effects is done.
                //Otherwise yield returns that have a wait timer will mess up update collection and block forever
                _go = false;

                ChanneledSkillObject _channeledSkillObject = (ChanneledSkillObject)channeledSkillObject;
                var channeledSkill = _FindChannelingSkill(_channeledSkillObject.user, _channeledSkillObject.powerSNO);
                if (channeledSkill != null)
                {
                    channeledSkill.CloseChannel();
                    _channeledSkills.Remove(channeledSkill);
                }
                else
                {
                    Logger.Debug("cancel channel for power {0}, but it doesn't have an open channel to cancel", _channeledSkillObject.powerSNO);
                }
                //Release all threads waiting on this
                _go = true;
                Monitor.PulseAll(_locker);
            }
        }
Пример #2
0
        public void CancelChanneledSkill(Actor user, int powerSNO)
        {
            //Execute all cancels in a new thread to not block the update thread if it generates calls here during execution of some scripts

            ChanneledSkillObject _channeledSkillObject = new ChanneledSkillObject();

            _channeledSkillObject.user     = user;
            _channeledSkillObject.powerSNO = powerSNO;

            Thread cancelChanneledSkillThread = new Thread(CancelChanneledSkill);

            cancelChanneledSkillThread.CurrentCulture = CultureInfo.InvariantCulture;
            cancelChanneledSkillThread.Start(_channeledSkillObject);
        }
Пример #3
0
        public void CancelChanneledSkill(Actor user, int powerSNO)
        {
            //Execute all cancels in a new thread to not block the update thread if it generates calls here during execution of some scripts

            ChanneledSkillObject _channeledSkillObject = new ChanneledSkillObject();
            _channeledSkillObject.user = user;
            _channeledSkillObject.powerSNO = powerSNO;

            Thread cancelChanneledSkillThread = new Thread(CancelChanneledSkill);
            cancelChanneledSkillThread.CurrentCulture = CultureInfo.InvariantCulture;
            cancelChanneledSkillThread.Start(_channeledSkillObject);

        }