Пример #1
0
        public override void DoActionMoving()
        {
            SceneGaming scene = Scene as SceneGaming;

            if (scene == null)
            {
                return;
            }

            if (_SkipTime.IsFull)
            {
                Rectangle checkRect = new Rectangle(Owner.Layout.Rectangle.X - 2, Owner.Layout.Rectangle.Y - 2, Owner.Layout.Rectangle.Width + 4, Owner.Layout.Rectangle.Height + 4);

                if (Owner.Status == ObjectStatus.Alive && Status == PropertyStatus.Enabled &&
                    (Owner.Propertys.Affix & SpecialStatus.Ghost) != SpecialStatus.Ghost)
                {
                    for (int i = 0; i < Owner.Container.Count; i++)
                    {
                        ObjectBase objectActive = Owner.Container[i];
                        if (objectActive.Status != ObjectStatus.Alive || Function.IsFriendly(objectActive.League, Owner.League))
                        {
                            continue;
                        }

                        // 特殊狀態判定 具碰撞 非鬼魂
                        if ((objectActive.Propertys.Affix & SpecialStatus.Collision) != SpecialStatus.Collision ||
                            (objectActive.Propertys.Affix & SpecialStatus.Ghost) == SpecialStatus.Ghost)
                        {
                            continue;
                        }

                        // 碰撞判定
                        if (!Function.IsCollison(Owner.Layout.CollisonShape, checkRect, objectActive.Layout.CollisonShape, objectActive.Layout.Rectangle))
                        {
                            continue;
                        }

                        scene.AddScoreToPlayer("擦身而過", 1000);
                        _SkipTime.Value = 0;
                        break;
                    }
                }
            }
            else
            {
                _SkipTime.Value += Scene.IntervalOfRound;
            }
            base.DoActionMoving();
        }
Пример #2
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);
 }
Пример #3
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();
        }
Пример #4
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();
        }
Пример #5
0
        public SceneSkill()
        {
            InitializeComponent();

            _Skills = new SkillBase[]
            {
                new SkillSprint(3000, Sec(0.7F), 0, 6000, true),
                new SkillShield(1, 6000, 0, Sec(2F), Sec(3F)),
                new SkillShockwave(6000, 0, Sec(1.5F), Sec(2.5F), Sec(0.1F), 4000, 300),
                new SkillBulletTime(2000, 9000, -1, Sec(3), 1),
                new SkillBait(6000, Sec(2F), Sec(2F), 400),
                new SkillShotgun(5, 1, 60, 5000, Sec(1F))
                //new SkillSleep(3000,Sec(0.5F),Sec(0.5F))
            };

            if (DeveloperOptions.Player_NoCast)
            {
                foreach (SkillBase skill in _Skills)
                {
                    skill.CostEnergy       = 0;
                    skill.CostEnergyPerSec = 0;
                }
            }

            if (DeveloperOptions.Player_NoCooldown)
            {
                foreach (SkillBase skill in _Skills)
                {
                    skill.Cooldown.Limit = 0;
                }
            }

            int len = _Skills.Length;

            _UISkillIcons = new ObjectUI[len];
            _UISkillInfos = new ObjectUI[len];
            for (int i = 0; i < len; i++)
            {
                int              left      = i % 2 * 270 + 30;
                int              top       = i / 2 * 100 + 120;
                DrawBase         skillDraw = _Skills[i].GetDrawObject(Color.FromArgb(120, 60, 0));
                DrawUISkillFrame drawFrame = new DrawUISkillFrame(Color.White, Color.FromArgb(210, 180, 50), 2, 10, SkillKeyType.None, skillDraw)
                {
                    StaticMode = true
                };
                _UISkillIcons[i]           = new ObjectUI(left, top, 75, 75, drawFrame);
                _UISkillIcons[i].GetFocus += (s, e) =>
                {
                    (s as ObjectUI).DrawObject.Colors.SetColor("Border", Color.Chocolate);
                    (s as ObjectUI).DrawObject.Scale = 1.1F;
                };
                _UISkillIcons[i].LostFocus += (s, e) =>
                {
                    (s as ObjectUI).DrawObject.Colors.SetColor("Border", Color.FromArgb(210, 180, 50));
                    (s as ObjectUI).DrawObject.Scale = 1F;
                };
                _UISkillIcons[i].Click += IconClick;

                DrawBase infoDraw = _Skills[i].GetInfoObject(Color.Chocolate, Color.Cornsilk, Color.FromArgb(180, 210, 180, 50));
                _UISkillInfos[i] = new ObjectUI(left + 85, top + 6, 170, 75, infoDraw);

                _UISkillIcons[i].Propertys.Add(new PropertyShadow(4, 6, 1, 1, 0.2F)
                {
                    RFix = -0.3F, GFix = -0.3F, BFix = -0.3F
                });

                if (GlobalScenes.ChoiceSkill1 != null && _Skills[i].ID == GlobalScenes.ChoiceSkill1.ID)
                {
                    Skill1 = drawFrame;
                    drawFrame.DrawButton = SkillKeyType.MouseButtonLeft;
                }
                else if (GlobalScenes.ChoiceSkill2 != null && _Skills[i].ID == GlobalScenes.ChoiceSkill2.ID)
                {
                    Skill2 = drawFrame;
                    drawFrame.DrawButton = SkillKeyType.MouseButtonRight;
                }

                UIObjects.Add(_UISkillIcons[i]);
                UIObjects.Add(_UISkillInfos[i]);
            }

            DrawUIText drawCommandOK          = new DrawUIText(Color.Black, Color.WhiteSmoke, Color.FromArgb(150, 255, 255, 255), Color.Black, 2, 10, "繼續", Global.CommandFont, GlobalFormat.MiddleCenter);
            DrawUIText drawCommandCancel      = new DrawUIText(Color.Black, Color.WhiteSmoke, Color.FromArgb(150, 255, 255, 255), Color.Black, 2, 10, "返回", Global.CommandFont, GlobalFormat.MiddleCenter);
            DrawUIText drawCommandOKHover     = new DrawUIText(Color.Black, Color.WhiteSmoke, Color.FromArgb(200, 255, 255, 220), Color.Black, 2, 10, "繼續", Global.CommandFont, GlobalFormat.MiddleCenter);
            DrawUIText drawCommandCancelHover = new DrawUIText(Color.Black, Color.WhiteSmoke, Color.FromArgb(200, 255, 255, 220), Color.Black, 2, 10, "返回", Global.CommandFont, GlobalFormat.MiddleCenter);

            _UICommandOK                     = new ObjectUI(0, 0, 150, 50, drawCommandOK);
            _UICommandCancel                 = new ObjectUI(0, 0, 150, 50, drawCommandCancel);
            _UICommandOK.DrawObjectHover     = drawCommandOKHover;
            _UICommandCancel.DrawObjectHover = drawCommandCancelHover;
            _UICommandOK.Propertys.Add(new PropertyShadow(-4, 4)
            {
                RFix = 0, GFix = 0, BFix = 0
            });
            _UICommandCancel.Propertys.Add(new PropertyShadow(4, 4)
            {
                RFix = 0, GFix = 0, BFix = 0
            });

            UIObjects.Add(_UICommandOK);
            UIObjects.Add(_UICommandCancel);

            _UICommandOK.Click += (x, e) =>
            {
                GlobalScenes.ChoiceSkill1 = Skill1 == null ? null : (Skill1.DrawObjectInside as DrawSkillBase).BindingSkill;
                GlobalScenes.ChoiceSkill2 = Skill2 == null ? null : (Skill2.DrawObjectInside as DrawSkillBase).BindingSkill;
                SceneGaming scene = GlobalScenes.ChoiceScene.CreateScene(GlobalScenes.ChoiceLevel);
                OnGoScene(scene);
            };

            _UICommandCancel.Click += (x, e) =>
            {
                OnGoScene(new SceneMain()
                {
                });
            };
        }
Пример #6
0
        public override void DoBeforeActionMove()
        {
            switch (Status)
            {
            case SkillStatus.Enabled:
            {
                if (Owner == null)
                {
                    Break();
                    return;
                }
                Status   = SkillStatus.Channeled;
                _MiniBar = new PropertyUI(-1, new Size(30, 6), new DrawUICounterBar(Color.FromArgb(160, 210, 100), Color.Black, Color.White, 1, true, Channeled));
                Owner.Propertys.Add(_MiniBar);
                PushSycle.Value = Scene.SceneIntervalOfRound;
                break;
            }

            case SkillStatus.Channeled:
                if (PushSycle.IsFull)
                {
                    LayoutSet checkRange = new LayoutSet()
                    {
                        CollisonShape = ShapeType.Ellipse,
                        Anchor        = DirectionType.Center,
                        X             = Owner.Layout.X,
                        Y             = Owner.Layout.Y,
                        Width         = Range,
                        Height        = Range
                    };

                    int hitCount = 0;
                    for (int i = 0; i < Owner.Container.Count; i++)
                    {
                        ObjectBase objectActive = Owner.Container[i];
                        if (objectActive == Owner)
                        {
                            continue;
                        }

                        // 範圍判定
                        if (!Function.IsCollison(objectActive.Layout, checkRange))
                        {
                            continue;
                        }

                        double angle     = Function.GetAngle(checkRange.CenterX, checkRange.CenterY, objectActive.Layout.CenterX, objectActive.Layout.CenterY);
                        double pushPower = PushPower * Function.GetDistance(checkRange.CenterX, checkRange.CenterY, objectActive.Layout.CenterX, objectActive.Layout.CenterY) / Range;
                        objectActive.MoveObject.AddToNextOffset(objectActive.MoveObject.GetOffsetByAngle(angle, PushPower));
                        hitCount++;
                    }

                    if (hitCount > 0)
                    {
                        if (hitCount > 4)
                        {
                            hitCount = 4;
                        }
                        SceneGaming scene = Scene as SceneGaming;
                        if (scene != null)
                        {
                            scene.AddScoreToPlayer("震盪衝擊", hitCount * 15);
                        }
                    }

                    Color      waveColor = Color.FromArgb(150, Owner.DrawObject.MainColor);
                    ObjectWave wave      = new ObjectWave(0, 0, 0, 0, Range, Range, Scene.Sec(0.15F), Scene.Sec(0.1F), new DrawPen(waveColor, ShapeType.Ellipse, 1), MoveNull.Value);
                    wave.Layout.Depend.SetObject(Owner);
                    wave.DiffusionOpacity = 0.1F;
                    wave.FadeOpacity      = 0.5F;
                    Owner.Container.Add(wave);
                    PushSycle.Value = 0;
                }
                else
                {
                    PushSycle.Value += Scene.SceneIntervalOfRound;
                }
                break;
            }

            base.DoBeforeActionMove();
        }