コード例 #1
0
ファイル: Stack.cs プロジェクト: longde123/grove
        public void PushTriggered()
        {
            if (_triggeredEffects.Count == 0)
            {
                return;
            }

            var active = _triggeredEffects
                         .Where(x => x.Controller == Players.Active)
                         .ToList();

            var passive = _triggeredEffects
                          .Where(x => x.Controller == Players.Passive)
                          .ToList();

            _triggeredEffects.Clear();

            if (active.Count > 0)
            {
                Enqueue(new PushTriggeredEffects(
                            Players.Active,
                            active));
            }

            if (passive.Count > 0)
            {
                Enqueue(new PushTriggeredEffects(
                            Players.Passive,
                            passive));
            }
        }
コード例 #2
0
        private void Deactivate()
        {
            // disable handlers, which will be triggered when
            // ending modifiers lifetimes
            Unsubscribe(this);

            // should be set at start or there will be an
            // infinite loop
            _isActivated.Value = false;

            // create a copy of lifetime to despose
            // since when endlife is called the original
            // can change
            var lifetimes = _lifetimes.ToArray();

            _lifetimes.Clear();

            foreach (var lifetime in lifetimes)
            {
                lifetime.EndLife();
            }

            // enable handlers back
            Subscribe(this);
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: longde123/grove
 public void Deal()
 {
     foreach (var damage in _assigned)
     {
         damage.Source.DealDamageTo(damage.Amount, _player, isCombat: true);
     }
     _assigned.Clear();
 }
コード例 #4
0
 private void RemoveAllScheduled()
 {
     foreach (var unit in _removeList)
     {
         RemovePermanently(unit);
     }
     _removeList.Clear();
 }
コード例 #5
0
        public void DealAssignedDamage()
        {
            foreach (var damage in _assignedDamage)
            {
                damage.Source.DealDamageTo(damage.Amount, _card, isCombat: true);
            }

            _assignedDamage.Clear();
        }
コード例 #6
0
        private void DeactivateSource()
        {
            foreach (var unit in _units)
            {
                _manaCache.Remove(unit);
            }

            _units.Clear();
            Unsubscribe(_p.ManaOutput);
        }
コード例 #7
0
        public void Disable()
        {
            foreach (var lifetime in _lifetimes)
            {
                lifetime.EndLife();
            }

            _lifetimes.Clear();
            _isEnabled.Value = false;
        }
コード例 #8
0
        public void EmptyManaPool()
        {
            foreach (var unit in _manaPool.Where(x => !x.HasSource))
            {
                RemovePermanently(unit);
            }

            lock (_manaPoolCountLock)
            {
                _manaPool.Clear();
            }

            RemoveAllScheduled();
        }
コード例 #9
0
ファイル: Combat.cs プロジェクト: longde123/grove
        public void RemoveAll()
        {
            foreach (var blocker in _blockers)
            {
                blocker.RemoveFromCombat();
            }

            foreach (var attacker in _attackers)
            {
                attacker.RemoveFromCombat();
            }

            _blockers.Clear();
            _attackers.Clear();
        }
コード例 #10
0
 public void ClearAssignedDamage()
 {
     _assignedDamage.Clear();
 }