Пример #1
0
        /// <summary>
        /// 移動所有者
        /// </summary>
        public virtual void Move()
        {
            float moveX = MoveX / Scene.SceneRoundPerSec / Resistance;
            float moveY = MoveY / Scene.SceneRoundPerSec / Resistance;

            if (MoveX != 0 || MoveY != 0)
            {
                ObjectActive ownerActive = Owner as ObjectActive;
                if (ownerActive != null && (ownerActive.Propertys.Affix & SpecialStatus.Movesplit) == SpecialStatus.Movesplit)
                {
                    // 移動距離大時分成多次移動,供碰撞用
                    int   partCount = (int)(Math.Max(Math.Abs(moveX / Owner.Layout.Width), Math.Abs(moveY / Owner.Layout.Height))) + 1;
                    float partX     = moveX / partCount;
                    float partY     = moveY / partCount;
                    for (int i = 0; i < partCount; i++)
                    {
                        Owner.Layout.X += partX;
                        Owner.Layout.Y += partY;
                        OnMoving();
                    }
                }
                else
                {
                    Owner.Layout.X += moveX;
                    Owner.Layout.Y += moveY;
                    OnMoving();
                }
            }
            OnAfterMove();
        }
Пример #2
0
        private void SceneWelcome_MouseDown(object sender, MouseEventArgs e)
        {
            EffectObjects.Add(new EffectShark(Sec(0.8F), 10));
            int ex = e.X;
            int ey = e.Y;

            for (int i = 0; i < GameObjects.Count; i++)
            {
                ObjectActive objectActive = GameObjects[i] as ObjectActive;
                if (objectActive != null)
                {
                    double distance = Function.GetDistance(e.X, e.Y, objectActive.Layout.CenterX, objectActive.Layout.CenterY);
                    if (distance < 100)
                    {
                        //objectActive.Life.Value = 0;
                        //objectActive.Life.Limit = Sec(0.05F);
                        objectActive.Propertys.Add(new PropertyDeadBroken(5, 2, 2, ObjectDeadType.Collision, 360, 200, 400, Sec(0.8F), Sec(1.4F)));
                        objectActive.Kill(null, ObjectDeadType.Collision);
                    }
                    else
                    {
                        double angle       = Function.GetAngle(e.X, e.Y, objectActive.Layout.CenterX, objectActive.Layout.CenterY);
                        PointF targetPoint = Function.GetOffsetPoint(objectActive.Layout.CenterX, objectActive.Layout.CenterY, angle, Width + Height);
                        objectActive.MoveObject.Target.SetObject(new PointObject(targetPoint));
                        objectActive.Propertys.Add(new PropertyFreeze(Sec(0.1F + (float)Global.Rand.NextDouble() * 0.2F)));
                    }
                    //objectActive.Speed *= 2;
                }
            }
            _TimerOfEnter.Enabled = true;
        }
Пример #3
0
        protected override void OnAfterAction()
        {
            if (_PlayerName != GlobalPlayer.PlayerName)
            {
                if (_PlayerName != null)
                {
                    LayoutSet layout = new LayoutSet()
                    {
                        Anchor = DirectionType.TopLeft,
                        X      = Layout.Rectangle.Left + 5,
                        Y      = Layout.Rectangle.Top + 18,
                        Width  = Layout.Width - 10,
                        Height = 24
                    };

                    DrawUIText drawObject = new DrawUIText(Color.Maroon, Color.Gray, Color.Empty, Color.Empty, 0, 0, _PlayerName, new Font("標楷體", 16), GlobalFormat.MiddleCenter)
                    {
                        TextPadding = new Padding(0, 0, 0, 0)
                    };
                    ObjectBase oldName = new ObjectActive(layout, 0, LeagueType.None, drawObject, MoveNull.Value);
                    oldName.Propertys.Add(new PropertyDeadBrokenShaping(_PlayerName.Length * 50, 2, 2, ObjectDeadType.All, 360, 10, 20, Scene.Sec(0.3F), Scene.Sec(0.5F)));

                    _DrawNameAlpha = 0;
                    Container.Add(oldName);
                }
                _PlayerName = GlobalPlayer.PlayerName;
            }

            base.OnAfterAction();
        }
Пример #4
0
        /// <summary>
        /// 綁定技能到所有人物件(集合>所有人>場景)
        /// </summary>
        /// <param name="owner">所有人</param>
        /// <param name="bindingLock">綁定後是否鎖定綁定功能</param>
        public void Binding(ObjectActive owner, bool bindingLock = false)
        {
            if (_Owner == owner)
            {
                return;
            }
            if (BindingLock)
            {
                throw new Exception("技能已被鎖定無法綁定");
            }

            Break();
            Container   = null;
            Owner       = owner;
            Scene       = null;
            BindingLock = bindingLock;
            OnBindingChanged();
        }
Пример #5
0
        /// <summary>
        /// 綁定技能集合到所有人物件(所有人>場景,由所有者綁定,除此之外勿使用此函數)
        /// </summary>
        public void Binding(ObjectActive owner, bool bindingLock = false)
        {
            if (_Owner == owner)
            {
                return;
            }
            if (BindingLock)
            {
                throw new Exception("技能集合已被鎖定無法綁定");
            }
            if (owner != null && owner.Skills != this)
            {
                throw new Exception("所有者的技能集合物件不符");
            }

            AllBreak();
            Owner       = owner;
            Scene       = null;
            BindingLock = bindingLock;
            OnBindingChanged();
        }
Пример #6
0
 public override void Release(ITargetability target)
 {
     if (Status == SkillStatus.Channeled)
     {
         PointF targetPoint = Scene.GetTargetPoint(DirectionType.Center);
         double angle = Function.GetAngle(Owner.Layout.CenterX, Owner.Layout.CenterY, targetPoint.X, targetPoint.Y);
         float partAngle = Radiation / (float)BulletCount;
         float shotAngle = (float)angle - (partAngle * BulletCount / 2);
         for (int i = 0; i < BulletCount; i++)
         {
             MoveStraight bulletMove = new MoveStraight(null, 1, 600, 1, 0, 1);
             ObjectActive bullet = new ObjectActive(Owner.Layout.CenterX, Owner.Layout.CenterY, 5, 5, Scene.Sec(0.5F), Owner.League, ShapeType.Ellipse, new DrawBrush(Owner.DrawObject.MainColor, ShapeType.Ellipse), bulletMove);
             bullet.Propertys.Add(new PropertyCollision(AttackPower));
             bullet.Propertys.Add(new PropertyDeadBroken(5, 2, 2, ObjectDeadType.All, 360, 40, 100, Scene.Sec(0.2F), Scene.Sec(0.3F)));
             bulletMove.Target.SetOffsetByAngle(shotAngle, 1000);
             bulletMove.Target.SetObject(bullet);
             bullet.Dead += (s, k, t) =>
             {
                 if (t == ObjectDeadType.Collision)
                 {
                     SceneGaming scene = Scene as SceneGaming;
                     if (scene != null)
                     {
                         scene.AddScoreToPlayer("擊中", 150);
                     }
                 }
             };
             Owner.Container.Add(bullet);
             shotAngle += partAngle;
         }
         Owner.MoveObject.AddToNextOffset(Function.GetOffsetPoint(0, 0, angle + 180, 500));
         Cursor.Position = Scene.PointToScreen(new Point((int)Owner.Layout.CenterX, (int)Owner.Layout.CenterY));
         Status = SkillStatus.Cooldown;
         OnEnd(SkillEndType.Finish);
     }
     base.Release(target);
 }
Пример #7
0
        /// <summary>
        /// 技能生效
        /// </summary>
        public override void DoBeforeAction()
        {
            switch (Status)
            {
            case SkillStatus.Enabled:
            {
                if (Owner == null || Owner.MoveObject.Target.TargetType == TargetType.None)
                {
                    Break();
                    return;
                }

                // 新增誘餌物件
                double angle = Function.GetAngle(Owner.Layout.CenterX, Owner.Layout.CenterY, Owner.MoveObject.Target.X, Owner.MoveObject.Target.Y);

                MoveStraight move = new MoveStraight(null, Owner.MoveObject.Resistance, BaitSpeed, 1, 0, 1F);
                move.Target.SetOffsetByAngle(angle, 1000);

                DrawBase draw = Owner.DrawObject.Copy();
                draw.Colors.Opacity = 0.6F;

                ObjectActive bait = new ObjectActive(Owner.Layout, BaitLife, Owner.League, draw, move);
                move.Target.SetObject(bait);

                bait.Propertys.Add(new PropertySpeeded(-1, -(BaitSpeed / (float)BaitLife * 800)));
                bait.Propertys.Add(new PropertyCollision(0));         // 強度碰撞

                // 新增雜訊物件
                int        noiseWidth  = Owner.Layout.Width + 2;
                int        noiseHeight = (int)(Owner.Layout.Height * 1.3F + 0.5F) + 5;
                DrawNoise  drawNoise   = new DrawNoise(Owner.DrawObject.MainColor, Color.White, 1);
                ObjectWave noise       = new ObjectWave(0, 0, noiseWidth, noiseHeight, noiseWidth * 3, noiseHeight * 3, -1, 0, drawNoise, MoveNull.Value);
                noise.DiffusionOpacity = 0;
                noise.Layout.Depend.SetObject(bait);
                Owner.Container.Add(bait);
                Owner.Container.Add(noise);

                // 將目標設為誘餌
                for (int i = 0; i < Owner.Container.Count; i++)
                {
                    ObjectBase objectBase = Owner.Container[i];
                    if (objectBase.Status != ObjectStatus.Alive || Function.IsFriendly(objectBase.League, Owner.League))
                    {
                        continue;
                    }
                    if (objectBase.MoveObject.Target.Object == Owner)
                    {
                        objectBase.MoveObject.Target.SetObject(bait);
                    }
                }

                bait.Dead += (s, e, t) =>
                {
                    noise.DiffusionTime.Limit = Scene.Sec(0.2F);
                    noise.DiffusionTime.Value = 0;

                    if (Owner == null)
                    {
                        return;
                    }
                    for (int i = 0; i < Owner.Container.Count; i++)
                    {
                        ObjectBase objectBase = Owner.Container[i];
                        if (objectBase.Status != ObjectStatus.Alive)
                        {
                            continue;
                        }
                        if (objectBase.MoveObject.Target.Object == s)
                        {
                            objectBase.MoveObject.Target.SetObject(Owner);
                        }
                    }

                    SceneGaming scene = Scene as SceneGaming;
                    if (t == ObjectDeadType.LifeEnd && scene != null)
                    {
                        scene.AddScoreToPlayer("誘餌生還", 300);
                    }
                };
                Status = SkillStatus.Cooldown;
            }
            break;
            }

            base.DoBeforeAction();
        }
Пример #8
0
        /// <summary>
        /// 技能生效
        /// </summary>
        public override void DoBeforeAction()
        {
            switch (Status)
            {
            case SkillStatus.Enabled:
            {
                if (Owner == null)
                {
                    Break();
                    return;
                }

                int effectWidth  = Owner.Layout.RectWidth + 12;
                int effectHeight = Owner.Layout.RectHeight + 12;
                effectWidth  += effectWidth % 2;
                effectHeight += effectHeight % 2;

                Color       color      = Owner.DrawObject.MainColor;
                Color       colorBack  = Color.FromArgb(50, color);
                DrawPolygon drawShield = new DrawPolygon(colorBack, color, 6, 1, 0)
                {
                    RotateEnabled = true
                };
                DrawPolygon drawScrap = new DrawPolygon(Color.Empty, color, 2, 1, 0)
                {
                    RotateEnabled = true
                };
                _ShieldObject = new ObjectActive(0, 0, effectWidth, effectHeight, -1, Owner.League, ShapeType.Ellipse, drawShield, MoveNull.Value);

                _ShieldObject.Propertys.Add(new PropertyRotate(-1, Global.Rand.Next(-360, 360), false, true));
                _ShieldObject.Propertys.Add(new PropertyDeadBroken(drawScrap, 6, 10, 10, ObjectDeadType.Collision, 360, 100, 150, Scene.Sec(0.4F), Scene.Sec(0.6F)));
                _ShieldObject.Propertys.Add(new PropertyDeadCollapse(drawScrap, 3, Scene.Sec(0.2F), Scene.Sec(0.05F), 10, 10, ObjectDeadType.LifeEnd, 100, 200, Scene.Sec(0.2F), Scene.Sec(0.3F)));
                _ShieldObject.Propertys.Add(new PropertyCollision(1));
                _ShieldObject.Layout.Depend.SetObject(Owner);
                Owner.Container.Add(_ShieldObject);

                _MiniBar       = new PropertyUI(-1, new Size(30, 6), new DrawUICounterBar(_BarColor, Color.Black, Color.White, 1, true, Channeled));
                _MiniBar.Affix = SpecialStatus.Ghost;           // 增加幽靈屬性

                Owner.Propertys.Add(_MiniBar);
                Status = SkillStatus.Channeled;
            }
            break;

            case SkillStatus.Channeled:
                if (_ShieldObject.Status != ObjectStatus.Alive)
                {
                    if (_ShieldObject.Life.Value < Scene.Sec(0.3F))
                    {
                        SceneGaming scene = Scene as SceneGaming;
                        if (scene != null)
                        {
                            scene.AddScoreToPlayer("千鈞一髮", 800);
                        }
                    }
                    this.Break();
                }
                break;
            }
            base.DoBeforeAction();
        }
Пример #9
0
        public SceneStand()
        {
            InitializeComponent();

            // 場景:畫面變黑暗
            WaveEvents.Add("@Dark", (n) =>
            {
                EffectObjects.Add(new EffectDyeing(Color.Black, Wave(0.5F), Wave(Math.Max(n - 1, 0)), Wave(0.5F)));
            });

            // 場景:邊界縮小
            WaveEvents.Add("@Shrink", (n) =>
            {
                double scaleX = Global.Rand.NextDouble();
                double scaleY = 1 - scaleX;

                int limitX     = (int)(scaleX * MainRectangle.Width * 0.4F);
                int limitY     = (int)(scaleY * MainRectangle.Height * 0.4F);
                int limitLeft  = Global.Rand.Next(0, limitX);
                int limitTop   = Global.Rand.Next(0, limitY);
                int limitRight = limitX - limitLeft;
                int limitDown  = limitY - limitTop;

                Padding shrinkPerRound = new Padding(limitLeft, limitTop, limitRight, limitDown);
                EffectObjects.Add(new EffectShrink(shrinkPerRound, Wave(0.5F), Wave(Math.Max(n - 1, 0)), Wave(0.5F)));
            });

            // 物件:追捕者
            WaveEvents.Add("Catcher", (n) =>
            {
                int roundIdx = Global.Rand.Next(4);
                for (int i = 0; i < n; i++)
                {
                    int size         = Global.Rand.Next(7, 12);
                    int offsetLimit  = size + Global.Rand.Next(5, 10);
                    float speed      = Global.Rand.Next(320, 380) * _SpeedFix;
                    float weight     = 0.3F + size * 0.1F;
                    int life         = Sec(3.5F * _LifeFix) + Global.Rand.Next(0, 5);
                    Point enterPoint = GetEnterPoint(roundIdx);

                    MoveStraight moveObject = new MoveStraight(PlayerObject, weight, speed, offsetLimit, 100, 0.5F);
                    ObjectActive newObject  = new ObjectActive(enterPoint.X, enterPoint.Y, size, size, life, LeagueType.Ememy1, ShapeType.Ellipse, new DrawBrush(Color.Red, ShapeType.Ellipse), moveObject);
                    newObject.Skills.Add(new SkillSprint(0, Sec(1.5F), 15, 0, true)
                    {
                        AutoCastObject = new AutoCastNormal(0.4F)
                    });
                    newObject.Skills.Add(new SkillSprint(0, Sec(0.5F), 5, 0, false)
                    {
                        AutoCastObject = new AutoCastNormal(3F)
                    });
                    newObject.Propertys.Add(new PropertyDeadBroken(15, 2, 2, ObjectDeadType.Collision, 30, 150, 400, Sec(0.5F), Sec(0.9F)));
                    newObject.Propertys.Add(new PropertyDeadCollapse(1, Sec(0.6F), Sec(0.01F), 2, 2, ObjectDeadType.LifeEnd, 50, 100, Sec(0.15F), Sec(0.25F)));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    GameObjects.Add(newObject);
                    roundIdx = ++roundIdx % 4;
                }
            });

            // 物件:快速追捕者 速度更快 更常使用加速
            WaveEvents.Add("Faster", (n) =>
            {
                int roundIdx = Global.Rand.Next(4);
                for (int i = 0; i < n; i++)
                {
                    int size         = Global.Rand.Next(6, 8);
                    int offsetLimit  = size + Global.Rand.Next(2, 4);
                    float speed      = Global.Rand.Next(400, 460) * _SpeedFix;
                    float weight     = 0.3F + size * 0.1F;
                    int life         = Sec(4.5F * _LifeFix) + Global.Rand.Next(0, 5);
                    Point enterPoint = GetEnterPoint(roundIdx);

                    MoveStraight moveObject = new MoveStraight(PlayerObject, weight, speed, offsetLimit, 100, 0.5F);
                    ObjectActive newObject  = new ObjectActive(enterPoint.X, enterPoint.Y, size, size, life, LeagueType.Ememy1, ShapeType.Ellipse, new DrawBrush(Color.Blue, ShapeType.Ellipse), moveObject);
                    newObject.Skills.Add(new SkillSprint(0, Sec(1F), 8, 0, true)
                    {
                        AutoCastObject = new AutoCastNormal(1F)
                    });
                    newObject.Skills.Add(new SkillSprint(0, Sec(0.5F), 4, 0, false)
                    {
                        AutoCastObject = new AutoCastNormal(3F)
                    });
                    newObject.Propertys.Add(new PropertyDeadBroken(15, 2, 2, ObjectDeadType.Collision, 20, 150, 400, Sec(0.5F), Sec(0.9F)));
                    newObject.Propertys.Add(new PropertyDeadCollapse(1, Sec(0.6F), Sec(0.01F), 2, 2, ObjectDeadType.LifeEnd, 50, 100, Sec(0.15F), Sec(0.25F)));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    GameObjects.Add(newObject);
                    roundIdx = ++roundIdx % 4;
                }
            });

            // 物件:流星 四面八方的直線前進物件
            WaveEvents.Add("Meteor", (n) =>
            {
                int roundIdx = Global.Rand.Next(4);
                for (int i = 0; i < n; i++)
                {
                    int size         = 10;
                    int movesCount   = 6;
                    float speed      = 500 * _SpeedFix;
                    float weight     = 0.3F + size * 0.1F;
                    int life         = Sec(10F);
                    Point enterPoint = GetEnterPoint(roundIdx);

                    double angel            = Function.GetAngle(enterPoint.X, enterPoint.Y, PlayerObject.Layout.CenterX, PlayerObject.Layout.CenterY) + Global.Rand.Next(-20, 20);
                    MoveStraight moveObject = new MoveStraight(null, weight, speed, movesCount, 0, 1F);
                    moveObject.Target.SetOffsetByAngle(angel, 1000F);
                    ObjectActive newObject = new ObjectActive(enterPoint.X, enterPoint.Y, size, size, life, LeagueType.Ememy1, ShapeType.Ellipse, new DrawBrush(Color.Orchid, ShapeType.Ellipse), moveObject);
                    newObject.Propertys.Add(new PropertyDeadBroken(15, 2, 2, ObjectDeadType.Collision, 20, 150, 400, Sec(0.5F), Sec(0.9F)));
                    newObject.Propertys.Add(new PropertyDeadCollapse(1, Sec(0.6F), Sec(0.01F), 2, 2, ObjectDeadType.LifeEnd, 50, 100, Sec(0.15F), Sec(0.25F)));
                    newObject.Propertys.Add(new PropertySmoking(-1, Sec(0.2F)));
                    newObject.Propertys.Add(new PropertyFreeze(Sec(0.2F * i)));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    newObject.Propertys.Add(new PropertyOutClear());
                    moveObject.Target.SetObject(newObject);
                    GameObjects.Add(newObject);
                    roundIdx = ++roundIdx % 4;
                }
            });

            // 物件:水平牆壁(有缺口)
            WaveEvents.Add("WallA", (n) =>
            {
                List <ObjectActive> objects = new List <ObjectActive>();
                for (int i = 0; i < MainRectangle.Height + 60; i += 30)
                {
                    int movesCount          = 6;
                    float speed             = 700 * (10 + n) / 10F;
                    float weight            = 3;
                    int life                = Sec(10F);
                    MoveStraight moveObject = new MoveStraight(null, weight, speed, movesCount, 0, 1F);
                    moveObject.Target.SetOffsetByXY(1000F, 0);
                    DrawBrush drawObject = new DrawBrush(Color.Orchid, ShapeType.Rectangle)
                    {
                        RotateEnabled = false
                    };
                    //DrawPolygon drawObject = new DrawPolygon(Color.Orchid, Color.Orchid, 2, 5, 0) { RotateEnabled = false };
                    ObjectActive newObject = new ObjectActive(-50, MainRectangle.Top + i - 20, 5, 28, life, LeagueType.Ememy1, ShapeType.Ellipse, drawObject, moveObject);
                    //newObject.Propertys.Add(new PropertyRotate(-1, 780, false, true));
                    //newObject.Propertys.Add(new PropertyDeadBroken(new DrawBrush(Color.Orchid, ShapeType.Rectangle), 15, 6, 6, ObjectDeadType.Collision | ObjectDeadType.LifeEnd, 20, 200, 600, Sec(0.6F), Sec(1.2F)));
                    newObject.Propertys.Add(new PropertyDeadBrokenShaping(15, 6, 6, ObjectDeadType.Collision | ObjectDeadType.LifeEnd, 20, 100, 300, Sec(0.6F), Sec(1.2F)));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    newObject.Propertys.Add(new PropertyOutClear());
                    moveObject.Target.SetObject(newObject);
                    GameObjects.Add(newObject);
                    objects.Add(newObject);
                }

                int clearCount = 2;
                int clearIndex = Global.Rand.Next(1, objects.Count - 2 - clearCount + 1);
                for (int i = 0; i < clearCount; i++)
                {
                    objects[clearIndex + i].Kill(null, ObjectDeadType.Clear);
                }
            });

            // 物件:水平牆壁(交錯)
            WaveEvents.Add("WallB", (n) =>
            {
                List <ObjectActive> objects = new List <ObjectActive>();
                int midRand   = 50;
                int cot       = MainRectangle.Height + 60 / 30;
                int offsetMid = 100 / cot;
                for (int i = 0; i < MainRectangle.Height + 60; i += 30)
                {
                    int movesCount = 6;
                    float speed    = 700 * (10 + n) / 10F;
                    float weight   = 3;
                    int life       = Sec(10F);
                    int enterX;
                    int moveX;
                    if (Global.Rand.Next(100) > midRand)
                    {
                        enterX   = -50;
                        moveX    = 1000;
                        midRand += offsetMid;
                    }
                    else
                    {
                        enterX   = Width + 50;
                        moveX    = -1000;
                        midRand -= offsetMid;
                    }

                    MoveStraight moveObject = new MoveStraight(null, weight, speed, movesCount, 0, 1F);
                    moveObject.Target.SetOffsetByXY(moveX, 0);
                    DrawPolygon drawObject = new DrawPolygon(Color.Orchid, Color.Orchid, 2, 5, 0)
                    {
                        RotateEnabled = true
                    };
                    ObjectActive newObject = new ObjectActive(enterX, MainRectangle.Top + i - 20, 28, 28, life, LeagueType.Ememy1, ShapeType.Ellipse, drawObject, moveObject);
                    newObject.Propertys.Add(new PropertyRotate(-1, 780, false, true));
                    newObject.Propertys.Add(new PropertyDeadBrokenShaping(15, 6, 6, ObjectDeadType.Collision | ObjectDeadType.LifeEnd, 20, 100, 300, Sec(0.6F), Sec(1.2F)));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    newObject.Propertys.Add(new PropertyOutClear());
                    moveObject.Target.SetObject(newObject);
                    GameObjects.Add(newObject);
                    objects.Add(newObject);
                }
            });

            // 物件:序列 排列成直線的追捕者
            WaveEvents.Add("Series", (n) =>
            {
                Point enterPoint = GetEnterPoint();
                int size         = Global.Rand.Next(10, 12);
                int movesCount   = 6;
                float speed      = Global.Rand.Next(300, 400) * _SpeedFix;
                float weight     = 0.3F + size * 0.1F;
                int life         = Sec(6F * _LifeFix) + Global.Rand.Next(0, 5);

                ObjectActive target     = PlayerObject;
                ObjectActive lastObject = null;
                for (int i = 0; i < n; i++)
                {
                    MoveStraight moveObject = new MoveStraight(target, weight, speed, movesCount, 30, 1F);
                    ObjectActive newObject  = new ObjectActive(enterPoint.X, enterPoint.Y, size, size, life, LeagueType.Ememy1, ShapeType.Ellipse, new DrawBrush(Color.DarkOrange, ShapeType.Ellipse), moveObject);
                    newObject.Propertys.Add(new PropertyFreeze(Sec(i * 0.05F)));
                    newObject.Propertys.Add(new PropertyDeadBroken(15, 2, 2, ObjectDeadType.Collision, 40, 150, 400, Sec(0.5F), Sec(0.9F)));
                    newObject.Propertys.Add(new PropertyDeadCollapse(1, Sec(0.2F), Sec(0.01F), 2, 2, ObjectDeadType.LifeEnd, 50, 100, Sec(0.15F), Sec(0.25F)));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    GameObjects.Add(newObject);
                    target = newObject;
                    speed += 10;
                    life  -= 50;
                    if (lastObject != null)
                    {
                        lastObject.Dead += (x, e, t) =>
                        {
                            newObject.MoveObject.Target.SetObject((x as ObjectActive).MoveObject.Target.Object);
                        };
                    }
                    lastObject = newObject;
                }
            });

            // 物件:轟炸機
            WaveEvents.Add("Bomber", (n) =>
            {
                int roundIdx = Global.Rand.Next(4);
                for (int i = 0; i < n; i++)
                {
                    Point enterPoint = GetEnterPoint(roundIdx);
                    int size         = Global.Rand.Next(28, 34);
                    int movesCount   = 6;
                    float speed      = Global.Rand.Next(300, 380);
                    float weight     = 0.3F + size * 0.1F;
                    double angle     = Function.GetAngle(enterPoint.X, enterPoint.Y, MainRectangle.Left + MainRectangle.Width / 2, MainRectangle.Top + MainRectangle.Height / 2) + Global.Rand.Next(-20, 20);
                    int life         = Sec(10F);

                    MoveStraight moveObject = new MoveStraight(null, weight, speed, movesCount, 30, 1F);
                    DrawPic drawObject      = new DrawPic(Color.Black, Properties.Resources.Bomber, (float)angle);
                    drawObject.Colors.RFix  = 0.7F;
                    drawObject.Colors.BFix  = 0.5F;
                    //DrawPolygon drawObject = new DrawPolygon(Color.SlateBlue, Color.SlateBlue, 3, 1, (float)angle);
                    ObjectActive newObject = new ObjectActive(enterPoint.X, enterPoint.Y, size, size, life, LeagueType.Ememy1, ShapeType.Ellipse, drawObject, moveObject);
                    moveObject.Target.SetOffsetByAngle(angle, 1000);
                    moveObject.Target.SetObject(newObject);

                    newObject.Propertys.Add(new PropertyAlert(-1));
                    newObject.Propertys.Add(new PropertyDeadBroken(30, 2, 2, ObjectDeadType.Collision, 40, 150, 400, Sec(0.5F), Sec(0.9F)));
                    newObject.Propertys.Add(new PropertyCollision(10));
                    newObject.Propertys.Add(new PropertyShadow(4, 6));
                    newObject.Propertys.Add(new PropertyBomber(-1, Sec(0.2F), 3, 8, 8, 5, 80, Sec(1F), Sec(1.4F)));
                    newObject.Propertys.Add(new PropertyOutClear());
                    GameObjects.Add(newObject);
                    roundIdx = ++roundIdx % 4;
                }
            });

            // 物件:攔截者 不會加速 但速度會越來越快
            WaveEvents.Add("Blocker", (n) =>
            {
                int roundIdx = Global.Rand.Next(4);
                for (int i = 0; i < n; i++)
                {
                    int size         = Global.Rand.Next(14, 17);
                    int movesCount   = 2;
                    float weight     = 0.3F + size * 0.1F;
                    float speed      = 200 * _SpeedFix;
                    int life         = Sec(6F * _LifeFix) + Global.Rand.Next(0, 5);
                    Point enterPoint = GetEnterPoint(roundIdx);

                    MoveStraight moveObject = new MoveStraight(PlayerObject, weight, speed, movesCount, 100, 0.5F);
                    DrawPolygon drawObject  = new DrawPolygon(Color.Fuchsia, Color.Fuchsia, 3, 1, 0)
                    {
                        RotateEnabled = true, Resistance = weight
                    };
                    ObjectActive newObject = new ObjectActive(enterPoint.X, enterPoint.Y, size, size, life, LeagueType.Ememy1, ShapeType.Ellipse, drawObject, moveObject);
                    newObject.Propertys.Add(new PropertyRotate(-1, 360, false, false));
                    newObject.Propertys.Add(new PropertyDeadBroken(15, 2, 2, ObjectDeadType.Collision, 60, 150, 400, Sec(0.5F), Sec(0.9F)));
                    newObject.Propertys.Add(new PropertyDeadCollapse(1, Sec(0.6F), Sec(0.01F), 2, 2, ObjectDeadType.LifeEnd, 50, 100, Sec(0.15F), Sec(0.25F)));
                    newObject.Propertys.Add(new PropertyCollision(10));
                    newObject.Propertys.Add(new PropertySpeeded(-1, 100));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    GameObjects.Add(newObject);
                    roundIdx = ++roundIdx % 4;
                }
            });

            // 物件:地雷
            WaveEvents.Add("Mine", (n) =>
            {
                int roundIdx = Global.Rand.Next(4);
                for (int i = 0; i < n; i++)
                {
                    int size       = Global.Rand.Next(16, 20);
                    int movesCount = Global.Rand.Next(10, 15);
                    float speed    = Global.Rand.Next(200, 300);
                    float weight   = 0.3F + size * 0.1F;
                    int life       = Sec(4);

                    Point enterPoint = Point.Empty;
                    int targetX      = 0, targetY = 0;
                    switch (roundIdx)
                    {
                    case 0:
                        enterPoint = GetEnterPoint(DirectionType.Left);
                        targetX    = MainRectangle.Left + Global.Rand.Next(MainRectangle.Width / 2);
                        targetY    = MainRectangle.Top + Global.Rand.Next(MainRectangle.Height);
                        break;

                    case 1:
                        enterPoint = GetEnterPoint(DirectionType.Right);
                        targetX    = MainRectangle.Left + MainRectangle.Width / 2 + Global.Rand.Next(MainRectangle.Width / 2);
                        targetY    = MainRectangle.Top + Global.Rand.Next(MainRectangle.Height);
                        break;

                    case 2:
                        enterPoint = GetEnterPoint(DirectionType.Top);
                        targetX    = MainRectangle.Left + Global.Rand.Next(MainRectangle.Width);
                        targetY    = MainRectangle.Top + Global.Rand.Next(MainRectangle.Height / 2);
                        break;

                    case 3:
                        enterPoint = GetEnterPoint(DirectionType.Bottom);
                        targetX    = MainRectangle.Left + Global.Rand.Next(MainRectangle.Width);
                        targetY    = MainRectangle.Top + MainRectangle.Height / 2 + Global.Rand.Next(MainRectangle.Height / 2);
                        break;
                    }

                    MoveStraight moveObject = new MoveStraight(new PointObject(targetX, targetY), weight, speed, movesCount, 100, 0.5F);
                    DrawPic drawObject      = new DrawPic(Color.Black, Properties.Resources.Mine, 0)
                    {
                        RotateEnabled = true, Resistance = weight
                    };
                    ObjectActive newObject = new ObjectActive(enterPoint.X, enterPoint.Y, size, size, life, LeagueType.Ememy1, ShapeType.Ellipse, drawObject, moveObject);
                    newObject.Propertys.Add(new PropertyRotate(-1, 280, false, false));
                    newObject.Propertys.Add(new PropertyDeadExplosion(10, 0, 1, LeagueType.Chaos, Color.FromArgb(180, 225, 70, 40), 0.15F, 0.1F, 5, ObjectDeadType.Collision | ObjectDeadType.LifeEnd));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    GameObjects.Add(newObject);
                    roundIdx = ++roundIdx % 4;
                }
            });

            // 物件:分裂地雷
            WaveEvents.Add("MineSplit", (n) =>
            {
                int size       = Global.Rand.Next(28, 30);
                int movesCount = Global.Rand.Next(10, 15);
                float speed    = Global.Rand.Next(200, 300);
                float weight   = 0.3F + size * 0.1F;
                int life       = Sec(4);

                Point enterPoint = GetEnterPoint();
                int targetX      = MainRectangle.Left + MainRectangle.Width / 2 + Global.Rand.Next(-40, 40);
                int targetY      = MainRectangle.Top + MainRectangle.Height / 2 + Global.Rand.Next(-40, 40);

                MoveStraight moveObject = new MoveStraight(new PointObject(targetX, targetY), weight, speed, movesCount, 100, 0.5F);
                DrawPic drawObject      = new DrawPic(Color.Black, Properties.Resources.Mine, 0)
                {
                    RotateEnabled = true, Resistance = weight
                };
                drawObject.Colors.BFix = 0.5F;
                ObjectActive newObject = new ObjectActive(enterPoint.X, enterPoint.Y, size, size, life, LeagueType.Ememy1, ShapeType.Ellipse, drawObject, moveObject);
                newObject.Propertys.Add(new PropertyRotate(-1, 280, false, false));
                newObject.Propertys.Add(new PropertyDeadExplosion(10, 0, 1, LeagueType.None, Color.FromArgb(180, 225, 70, 40), 0.15F, 0.1F, 5, ObjectDeadType.Collision | ObjectDeadType.LifeEnd));
                newObject.Propertys.Add(new PropertyCollision(1));
                newObject.Propertys.Add(new PropertyShadow(2, 3));
                newObject.Dead += (x, e, t) =>
                {
                    float partAngle = 360F / n;
                    float baseAngle = Global.Rand.Next(360);
                    for (int i = 0; i < n; i++)
                    {
                        int size2                = Global.Rand.Next(16, 18);
                        float speed2             = Global.Rand.Next(150, 250);
                        float weight2            = 0.3F + size2 * 0.1F;
                        int life2                = Sec(1.5F);
                        MoveStraight moveObject2 = new MoveStraight(null, weight2, speed2, movesCount, 0, 1F);
                        moveObject2.Target.SetOffsetByAngle(baseAngle, 1000);
                        DrawPic drawObject2 = new DrawPic(Color.Black, Properties.Resources.Mine, 0)
                        {
                            RotateEnabled = true, Resistance = weight2
                        };
                        drawObject2.Colors.BFix = 0.5F;
                        ObjectActive newObject2 = new ObjectActive(x.Layout.CenterX, x.Layout.CenterY, size2, size2, life2, LeagueType.Ememy1, ShapeType.Ellipse, drawObject2, moveObject2);
                        newObject2.Propertys.Add(new PropertyRotate(-1, 280, false, false));
                        newObject2.Propertys.Add(new PropertyDeadExplosion(10, 0, 1, LeagueType.None, Color.FromArgb(180, 225, 70, 40), 0.15F, 0.1F, 5, ObjectDeadType.Collision | ObjectDeadType.LifeEnd));
                        newObject2.Propertys.Add(new PropertyCollision(1));
                        newObject2.Propertys.Add(new PropertyShadow(2, 3));
                        moveObject2.Target.SetObject(newObject2);

                        newObject2.Dead += (x2, e2, t2) =>
                        {
                            float baseAngle2 = Global.Rand.Next(360);
                            for (int j = 0; j < n; j++)
                            {
                                int size3                = Global.Rand.Next(8, 10);
                                float speed3             = Global.Rand.Next(150, 250);
                                float weight3            = 0.3F + size3 * 0.1F;
                                int life3                = Sec(1.5F);
                                MoveStraight moveObject3 = new MoveStraight(null, weight3, speed3, movesCount, 0, 1F);
                                moveObject3.Target.SetOffsetByAngle(baseAngle2, 1000);
                                DrawPic drawObject3 = new DrawPic(Color.Black, Properties.Resources.Mine, 0)
                                {
                                    RotateEnabled = true, Resistance = weight3
                                };
                                drawObject3.Colors.BFix = 0.5F;
                                ObjectActive newObject3 = new ObjectActive(x2.Layout.CenterX, x2.Layout.CenterY, size3, size3, life3, LeagueType.Ememy1, ShapeType.Ellipse, drawObject3, moveObject3);
                                newObject3.Propertys.Add(new PropertyRotate(-1, 280, false, false));
                                newObject3.Propertys.Add(new PropertyDeadExplosion(10, 0, 1, LeagueType.None, Color.FromArgb(180, 225, 70, 40), 0.15F, 0.1F, 5, ObjectDeadType.Collision | ObjectDeadType.LifeEnd));
                                newObject3.Propertys.Add(new PropertyCollision(1));
                                newObject3.Propertys.Add(new PropertyShadow(2, 3));
                                moveObject3.Target.SetObject(newObject2);
                                GameObjects.Add(newObject3);
                                baseAngle2 += partAngle;
                            }
                        };

                        GameObjects.Add(newObject2);
                        baseAngle += partAngle;
                    }
                };
                GameObjects.Add(newObject);
            });
        }
Пример #10
0
        protected override void OnLoadComplete()
        {
            base.OnLoadComplete();

            int   drawWidth  = 400;
            int   drawHeight = 150;
            int   drawLeft   = (Width - drawWidth) / 2;
            int   drawTop    = (Height - drawHeight) / 2;
            int   partCountX = _StringPoint[0].Length;
            int   partCountY = _StringPoint.Length;
            int   partWidth  = drawWidth / partCountX;
            int   partHeight = drawHeight / partCountY;
            float delay      = 0;

            int[,] map = new int[partCountX, partCountY];
            // 建立關連圖
            for (int x = 0; x < partCountX; x++)
            {
                for (int y = 0; y < partCountY; y++)
                {
                    if (_StringPoint[y][x] == '0')
                    {
                        bool checkRight  = x + 1 < partCountX;
                        bool checkBottom = y + 1 < partCountY;
                        bool checkLeft   = x - 1 >= 0;

                        if (checkRight)
                        {
                            map[x + 1, y] |= 1; // 右
                        }

                        if (checkBottom)
                        {
                            map[x, y + 1] |= 2; // 下
                        }

                        if (checkRight && checkBottom)
                        {
                            map[x + 1, y + 1] |= 4; // 右下
                        }

                        if (checkLeft && checkBottom)
                        {
                            map[x - 1, y + 1] |= 8; // 左下
                        }
                    }
                    else
                    {
                        map[x, y] = -1;
                    }
                }
            }

            byte[] linkIdx     = { 0, 1, 2, 4, 8 };
            int[]  linkOffsetX = { 0, -1, 0, -1, 1 };
            int[]  linkOffsetY = { 0, 0, -1, -1, -1 };
            for (int x = 0; x < partCountX; x++)
            {
                for (int y = 0; y < partCountY; y++)
                {
                    int mapValue = map[x, y];
                    if (mapValue >= 0)
                    {
                        Point        enterPoint  = GetEnterPoint();
                        int          size        = Global.Rand.Next(6, 8);
                        int          speed       = Global.Rand.Next(1800, 2200);
                        PointF       targetPoint = new PointF(drawLeft + x * partWidth, drawTop + y * partHeight);
                        MoveStraight moveObject  = new MoveStraight(new PointObject(targetPoint), 1, speed, 1, 100, 1F);
                        ObjectActive bigBall     = new ObjectActive(enterPoint.X, enterPoint.Y, size, size, -1, LeagueType.None, ShapeType.Ellipse, new DrawPen(Color.FromArgb(150, 0, 0, 0), ShapeType.Ellipse, 4), moveObject);
                        bigBall.Propertys.Add(new PropertyFreeze(Sec(delay)));
                        GameObjects.Add(bigBall);

                        for (int i = 0; i < linkIdx.Length; i++)
                        {
                            if ((mapValue & linkIdx[i]) == linkIdx[i])
                            {
                                int smallballCount = Global.Rand.Next(2, 3);
                                for (int n = 0; n < smallballCount; n++)
                                {
                                    Point        enterPoint2 = GetEnterPoint();
                                    int          size2       = Global.Rand.Next(3, 8);
                                    int          speed2      = Global.Rand.Next(1400, 1600);
                                    float        fx          = 1 - size2 * 0.02F;
                                    int          targetFixX  = (partWidth * linkOffsetX[i] / 2) + (int)((0.5F - Global.Rand.NextDouble()) * partWidth * fx + 0.5F);
                                    int          targetFixY  = (partHeight * linkOffsetY[i] / 2) + (int)((0.5F - Global.Rand.NextDouble()) * partHeight * fx + 0.5F);
                                    PointF       target2     = new PointF(targetPoint.X + targetFixX, targetPoint.Y + targetFixY);
                                    MoveStraight moveObject2 = new MoveStraight(new PointObject(target2), 1, speed2, 1, 100, 1F);
                                    Color        color2      = Color.FromArgb(Global.Rand.Next(200), Global.Rand.Next(200), Global.Rand.Next(200));
                                    ObjectActive smallBall   = new ObjectActive(enterPoint2.X, enterPoint2.Y, size2, size2, -1, LeagueType.None, ShapeType.Ellipse, new DrawBrush(color2, ShapeType.Ellipse), moveObject2);
                                    smallBall.Propertys.Add(new PropertyFreeze(Sec(0.75F + (float)Global.Rand.NextDouble() * 0.5F)));
                                    GameObjects.Add(smallBall);
                                }
                            }
                        }
                    }
                    delay += 0.003F;
                }
            }
        }
Пример #11
0
        public SceneDisco()
        {
            InitializeComponent();

            // 場景:畫面變黑暗
            WaveEvents.Add("@Dark", (n) =>
            {
                EffectObjects.Add(new EffectDyeing(Color.Black, Wave(0.1F), Wave(Math.Max(n, 0)), Wave(0.1F)));
            });

            // 場景:邊界縮小
            WaveEvents.Add("@Shrink", (n) =>
            {
                double scaleX = Global.Rand.NextDouble();
                double scaleY = 1 - scaleX;

                int limitX     = (int)(scaleX * MainRectangle.Width * 0.4F);
                int limitY     = (int)(scaleY * MainRectangle.Height * 0.4F);
                int limitLeft  = Global.Rand.Next(0, limitX);
                int limitTop   = Global.Rand.Next(0, limitY);
                int limitRight = limitX - limitLeft;
                int limitDown  = limitY - limitTop;

                Padding shrinkPerRound = new Padding(limitLeft, limitTop, limitRight, limitDown);
                EffectObjects.Add(new EffectShrink(shrinkPerRound, Wave(0.1F), Wave(Math.Max(n, 0)), Wave(0.1F)));
            });

            // 物件:追捕者
            WaveEvents.Add("Catcher", (n) =>
            {
                int roundIdx = Global.Rand.Next(4);
                for (int i = 0; i < n; i++)
                {
                    int size         = Global.Rand.Next(9, 11);
                    int offsetLimit  = 10;
                    float speed      = Global.Rand.Next(200, 240) * _SpeedFix;
                    float weight     = 0.3F + size * 0.1F;
                    int life         = Sec(6F * _LifeFix) + Global.Rand.Next(0, 5);
                    Point enterPoint = GetEnterPoint(roundIdx);

                    MoveFrog moveObject    = new MoveFrog(PlayerObject, weight, speed, offsetLimit, Sec(1F));
                    ObjectActive newObject = new ObjectActive(enterPoint.X, enterPoint.Y, size, size, life, LeagueType.Ememy1, ShapeType.Ellipse, new DrawBrush(Color.Red, ShapeType.Ellipse), moveObject);
                    newObject.Propertys.Add(new PropertyDeadBroken(15, 2, 2, ObjectDeadType.Collision, 20, 150, 400, Sec(0.5F), Sec(0.9F)));
                    newObject.Propertys.Add(new PropertyDeadCollapse(1, Sec(0.6F), Sec(0.01F), 2, 2, ObjectDeadType.LifeEnd, 50, 100, Sec(0.15F), Sec(0.25F)));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    GameObjects.Add(newObject);
                    roundIdx = ++roundIdx % 4;
                }
            });

            // 物件:快速追捕者 移動間格減半
            WaveEvents.Add("Faster", (n) =>
            {
                int roundIdx = Global.Rand.Next(4);
                for (int i = 0; i < n; i++)
                {
                    int size         = Global.Rand.Next(6, 8);
                    int offsetLimit  = 10;
                    float speed      = Global.Rand.Next(275, 320) * _SpeedFix;
                    float weight     = 0.3F + size * 0.1F;
                    int life         = Sec(4.5F * _LifeFix) + Global.Rand.Next(0, 5);
                    Point enterPoint = GetEnterPoint(roundIdx);

                    MoveFrog moveObject    = new MoveFrog(PlayerObject, weight, speed, offsetLimit, Sec(0.5F));
                    ObjectActive newObject = new ObjectActive(enterPoint.X, enterPoint.Y, size, size, life, LeagueType.Ememy1, ShapeType.Ellipse, new DrawBrush(Color.Blue, ShapeType.Ellipse), moveObject);
                    newObject.Propertys.Add(new PropertyDeadBroken(15, 2, 2, ObjectDeadType.Collision, 20, 150, 400, Sec(0.5F), Sec(0.9F)));
                    newObject.Propertys.Add(new PropertyDeadCollapse(1, Sec(0.6F), Sec(0.01F), 2, 2, ObjectDeadType.LifeEnd, 50, 100, Sec(0.15F), Sec(0.25F)));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    GameObjects.Add(newObject);
                    roundIdx = ++roundIdx % 4;
                }
            });

            // 物件:蜻蜓 固定方向且會左右擺動
            WaveEvents.Add("Dragonfly", (n) =>
            {
                for (int i = 0; i < n; i++)
                {
                    int size         = Global.Rand.Next(14, 18);
                    int offsetLimit  = 10;
                    float speed      = Global.Rand.Next(220, 260) * _SpeedFix;
                    float weight     = 0.3F + size * 0.1F;
                    int life         = -1;
                    Point enterPoint = GetEnterPoint(DirectionType.Right);

                    MoveFrog moveObject    = new MoveFrog(null, weight, speed, offsetLimit, Sec(1F));
                    DrawPolygon drawObject = new DrawPolygon(Color.BlueViolet, Color.BlueViolet, 3, 0, 0)
                    {
                        RotateEnabled = true
                    };
                    ObjectActive newObject = new ObjectActive(enterPoint.X, enterPoint.Y, size, size, life, LeagueType.Ememy1, ShapeType.Ellipse, drawObject, moveObject);
                    newObject.Propertys.Add(new PropertyDeadBroken(15, 2, 2, ObjectDeadType.Collision, 20, 150, 400, Sec(0.5F), Sec(0.9F)));
                    newObject.Propertys.Add(new PropertyDeadCollapse(1, Sec(0.6F), Sec(0.01F), 2, 2, ObjectDeadType.LifeEnd, 50, 100, Sec(0.15F), Sec(0.25F)));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    newObject.Propertys.Add(new PropertyOutClear());
                    newObject.Propertys.Add(new PropertyDelay(Sec(0.5F), new PropertyDrunken(-1, Sec(1F), -45, 45, Global.Rand.Next(2) == 0 ? 100 : -100)));
                    newObject.Propertys.Add(new PropertyRotateTarget(-1, 400, true));
                    moveObject.Target.SetObject(newObject);
                    moveObject.Target.SetOffsetByXY(-1000, 0);
                    GameObjects.Add(newObject);
                }
            });

            // 物件:水平牆壁
            WaveEvents.Add("WallA", (n) =>
            {
                List <ObjectActive> objects = new List <ObjectActive>();
                for (int i = 0; i < MainRectangle.Height + 60; i += 30)
                {
                    int movesCount      = 6;
                    float speed         = 300 * (10 + n) / 10F;
                    float weight        = 3;
                    int life            = -1;
                    MoveFrog moveObject = new MoveFrog(null, weight, speed, movesCount, Sec(1));
                    moveObject.Target.SetOffsetByXY(1000F, 0);
                    DrawBrush drawObject = new DrawBrush(Color.Orchid, ShapeType.Rectangle)
                    {
                        RotateEnabled = false
                    };
                    ObjectActive newObject = new ObjectActive(-50, MainRectangle.Top + i - 20, 5, 28, life, LeagueType.Ememy1, ShapeType.Ellipse, drawObject, moveObject);
                    newObject.Propertys.Add(new PropertyDeadBrokenShaping(15, 6, 6, ObjectDeadType.Collision | ObjectDeadType.LifeEnd, 20, 100, 300, Sec(0.6F), Sec(1.2F)));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    newObject.Propertys.Add(new PropertyOutClear());
                    moveObject.Target.SetObject(newObject);
                    GameObjects.Add(newObject);
                    objects.Add(newObject);
                }

                int clearCount = 2;
                int clearIndex = Global.Rand.Next(1, objects.Count - 2 - clearCount + 1);
                for (int i = 0; i < clearCount; i++)
                {
                    objects[clearIndex + i].Kill(null, ObjectDeadType.Clear);
                }
            });

            // 物件:箭雨(水平)
            WaveEvents.Add("Arrow", (n) =>
            {
                int baseTop = Global.Rand.Next(MainRectangle.Top - 20, MainRectangle.Top + MainRectangle.Height + 20 - ((n - 1) * 30));
                for (int i = 0; i < n; i++)
                {
                    int movesCount          = 12;
                    float weight            = 3;
                    int life                = -1;// Sec(10F);
                    MoveStraight moveObject = new MoveStraight(null, weight, 500, movesCount, 0, 1F);
                    moveObject.Target.SetOffsetByXY(1000F, 0);
                    DrawPolygon drawObject = new DrawPolygon(Color.Orchid, Color.Empty, 3, 1, 90F)
                    {
                        RotateEnabled = false
                    };
                    ObjectActive newObject = new ObjectActive(-30, baseTop, 25, 25, life, LeagueType.Ememy1, ShapeType.Ellipse, drawObject, moveObject);
                    newObject.Skills.Add(new SkillSprint(0, Sec(1F), 0, (int)(400000), false)
                    {
                        AutoCastObject = new AutoCastNormal(100), Status = SkillStatus.Cooldown
                    });
                    newObject.Propertys.Add(new PropertySpeeded(Sec(1F), -300));
                    newObject.Propertys.Add(new PropertyDeadBrokenShaping(15, 6, 6, ObjectDeadType.Collision | ObjectDeadType.LifeEnd, 20, 100, 300, Sec(0.6F), Sec(1.2F)));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    newObject.Propertys.Add(new PropertyOutClear());
                    moveObject.Target.SetObject(newObject);

                    GameObjects.Add(newObject);
                    baseTop += 30;
                }
            });

            // 物件:炸彈陣列
            WaveEvents.Add("BoomGrid", (n) =>
            {
                List <ObjectActive> objects = new List <ObjectActive>();
                for (int i = 0; i < MainRectangle.Height + 60; i += 120)
                {
                    int movesCount      = 6;
                    float speed         = 300 * (10 + n) / 10F;
                    float weight        = 3;
                    int life            = -1;
                    MoveFrog moveObject = new MoveFrog(null, weight, speed, movesCount, Sec(1));
                    moveObject.Target.SetOffsetByXY(1000F, 0);
                    DrawBrush drawObject = new DrawBrush(Color.Orchid, ShapeType.Rectangle)
                    {
                        RotateEnabled = false
                    };
                    ObjectActive newObject = new ObjectActive(-50, MainRectangle.Top + i - 20, 5, 28, life, LeagueType.Ememy1, ShapeType.Ellipse, drawObject, moveObject);
                    newObject.Propertys.Add(new PropertyDeadBrokenShaping(15, 6, 6, ObjectDeadType.Collision | ObjectDeadType.LifeEnd, 20, 100, 300, Sec(0.6F), Sec(1.2F)));
                    newObject.Propertys.Add(new PropertyCollision(1));
                    newObject.Propertys.Add(new PropertyShadow(2, 3));
                    newObject.Propertys.Add(new PropertyOutClear());
                    moveObject.Target.SetObject(newObject);
                    GameObjects.Add(newObject);
                    objects.Add(newObject);
                }

                int clearCount = 2;
                int clearIndex = Global.Rand.Next(1, objects.Count - 2 - clearCount + 1);
                for (int i = 0; i < clearCount; i++)
                {
                    objects[clearIndex + i].Kill(null, ObjectDeadType.Clear);
                }
            });
        }