コード例 #1
0
ファイル: ClashShield.cs プロジェクト: misaka5/DuckUtils
        private void DoZapping()
        {
            foreach (KeyValuePair <Duck, ZapState> p in zapState)
            {
                p.Value.Cooldown();
            }

            Vec2     hit;
            IAmADuck duck = Level.current.CollisionRay <IAmADuck>(barrelPosition, barrelPosition + barrelVector * ZapRange, out hit);

            Duck current = duck.ToDuck();

            if (current != null)
            {
                ZapState state = GetZapState(current);

                switch (state.Increase())
                {
                case ZapResult.Slowdown:
                    current.vSpeed *= SlowdownFactor;
                    current.hSpeed *= SlowdownFactor;
                    break;

                case ZapResult.Zap:
                    if (!current.dead)
                    {
                        current.Zap(this);
                    }
                    current.Swear();
                    break;

                case ZapResult.Death:
                    current.Destroy(new DTIncinerate(this));
                    state.Clear();
                    break;
                }
            }
        }