コード例 #1
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (int frame = 0; ; frame++)
            {
                this.Y -= 18.0;

                if (this.Y < 0.0)
                {
                    break;
                }

                DDDraw.SetAlpha(ShotConsts.A);
                DDDraw.DrawBegin(Ground.I.Picture2.D_LASER, this.X, this.Y);
                DDDraw.DrawZoom(1.0 + (0.5 * this.Level) / GameConsts.PLAYER_LEVEL_MAX);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Circle(
                    new D2Point(this.X, this.Y),
                    32.0 + (16.0 * this.Level) / GameConsts.PLAYER_LEVEL_MAX
                    );

                yield return(true);
            }
        }
コード例 #2
0
        protected override IEnumerable <bool> E_Draw()
        {
            double axisX = this.X;

            for (int frame = 0; ; frame++)
            {
                this.X    = axisX + Math.Sin(this.Rot) * this.XRate;
                this.Y   += this.YAdd;
                this.Rot += this.RotAdd;

                EnemyCommon.Shoot(this, this.ShotType);

                int koma = frame / 7;
                koma %= 2;

                DDDraw.SetMosaic();
                DDDraw.DrawBegin(Ground.I.Picture2.D_PUMPKIN_00[koma], this.X, this.Y);
                DDDraw.DrawZoom(2.0);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X - 1.0, this.Y + 3.0), 30.0);

                yield return(!EnemyCommon.IsEvacuated(this));
            }
        }
コード例 #3
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (int frame = 0; ; frame++)
            {
                double ax = 0.0;
                double ay = -20.0;

                DDUtils.Rotate(ref ax, ref ay, this.R);

                this.X += ax;
                this.Y += ay;

                if (DDUtils.IsOut(new D2Point(this.X, this.Y), new D4Rect(0, 0, GameConsts.FIELD_W, GameConsts.FIELD_H)))
                {
                    break;
                }

                DDDraw.SetAlpha(ShotConsts.A);
                DDDraw.DrawBegin(Ground.I.Picture2.D_SHOT, this.X, this.Y);
                DDDraw.DrawRotate(this.R);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Circle(
                    new D2Point(this.X, this.Y),
                    12.0
                    );

                yield return(true);
            }
        }
コード例 #4
0
        protected override IEnumerable <bool> E_Draw()
        {
            double ySpeed = 0.0;

            const double GRAVITY     = 1.0;
            const double SPEED_Y_MAX = 8.0;

            for (; ;)
            {
                this.Y += ySpeed;

                ySpeed += GRAVITY;
                ySpeed  = Math.Min(ySpeed, SPEED_Y_MAX);

                if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X, this.Y))).Tile.IsGround())                 // ? 地面に落ちた。
                {
                    break;
                }

                DDDraw.DrawCenter(Ground.I.Picture.Teki_a01_Shit01, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);

                this.Crash = DDCrashUtils.Point(new D2Point(this.X, this.Y));

                yield return(true);
            }
        }
コード例 #5
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (int frame = 0; ; frame++)
            {
                double ax = 0.0;
                double ay = -15.0;

                DDUtils.Rotate(ref ax, ref ay, this.R);

                this.X += ax;
                this.Y += ay;

                //if (DDUtils.IsOut(new D2Point(this.X, this.Y), new D4Rect(0, 0, GameConsts.FIELD_W, GameConsts.FIELD_H)))
                //    break;

                this.R += this.RAdd;
                DDUtils.Approach(ref this.RAdd, 0.0, this.RAddRatePerFrame);

                DDDraw.SetAlpha(ShotConsts.A * 2.0);
                DDDraw.SetBright(1.0, 0.3, 0.3);
                DDDraw.DrawBegin(Ground.I.Picture2.D_WAVESHOT, this.X, this.Y);
                DDDraw.DrawRotate(this.R);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Circle(
                    new D2Point(this.X, this.Y),
                    24.0
                    );

                yield return(true);
            }
        }
コード例 #6
0
        public override void Draw()
        {
            if (Game.I.FreezeEnemy)
            {
                goto startDraw;
            }

            this.IRot += this.IRotSpeed;

            this.IRot += IROT_360;
            this.IRot %= IROT_360;

startDraw:
            double rot = this.IRot * (Math.PI * 2.0) / IROT_360;

            double x = this.X + Math.Cos(rot) * R;
            double y = this.Y + Math.Sin(rot) * R;

            if (!EnemyCommon.IsOutOfScreen_ForDraw(new D2Point(x - DDGround.Camera.X, y - DDGround.Camera.Y)))
            {
                //DDDraw.SetBright(new I3Color(32, 192, 32)); // old
                DDDraw.SetBright(Game.I.Map.Design.EnemyColor_Cookie);
                DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, SCommon.ToInt(x - DDGround.ICamera.X), SCommon.ToInt(y - DDGround.ICamera.Y));
                DDDraw.DrawSetSize(GameConsts.TILE_W, GameConsts.TILE_H);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Rect_CenterSize(new D2Point(x, y), new D2Size(GameConsts.TILE_W, GameConsts.TILE_H));

                Game.I.タイル接近_敵描画_Points.Add(new D2Point(x, y));
            }
        }
コード例 #7
0
        protected override IEnumerable <bool> E_Draw()
        {
            const double CHARA_R = 8.0;

            for (; ;)
            {
                this.X += this.XAdd;
                this.Y += this.YAdd;

                // 壁衝突判定
                //if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X, this.Y))).Tile.IsWall())
                //    break;

                if (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), CHARA_R * 1.2))
                {
                    // 暫定_描画
                    {
                        DDDraw.DrawBegin(Ground.I.Picture.WhiteCircle, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                        DDDraw.DrawSetSize(CHARA_R * 2, CHARA_R * 2);
                        DDDraw.DrawEnd();

                        DDPrint.SetDebug((int)this.X - DDGround.ICamera.X, (int)this.Y - DDGround.ICamera.Y);
                        DDPrint.SetBorder(new I3Color(0, 0, 0));
                        DDPrint.Print("[敵弾]");
                        DDPrint.Reset();
                    }

                    this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), CHARA_R);
                }
                yield return(!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y)));
            }
        }
コード例 #8
0
        public override void Draw()
        {
            const double PL_CRASH_W = GameConsts.TILE_W - 1;
            const double PL_CRASH_H = GameConsts.TILE_H - 1;

            DDCrash crash = DDCrashUtils.Rect_CenterSize(
                new D2Point(this.X, this.Y),
                new D2Size(GameConsts.TILE_W, GameConsts.TILE_H)
                );
            DDCrash plCrash = DDCrashUtils.Rect_CenterSize(
                new D2Point(Game.I.Player.X, Game.I.Player.Y),
                new D2Size(PL_CRASH_W, PL_CRASH_H)
                );

            if (crash.IsCrashed(plCrash))
            {
                if (this.Goal方面)
                {
                    Game.I.行き先案内_Crashed_Goal方面 = true;
                }
                else
                {
                    Game.I.行き先案内_Crashed_Start方面 = true;
                }
            }
        }
コード例 #9
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (this.WaitFrame = 0; ; this.WaitFrame++)
            {
                while (DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), 50.0))                 // 画面外に居るときは休止する。
                {
                    yield return(true);
                }

                if (!this.Jump())
                {
                    this.FacingLeft = Game.I.Player.X < this.X;

                    if (
                        30 < this.WaitFrame &&
                        (
                            DDUtils.GetDistance(new D2Point(Game.I.Player.X, Game.I.Player.Y), new D2Point(this.X, this.Y)) < 300.0 ||
                            Math.Abs(Game.I.Player.Y - this.Y) < 32.0
                        ))
                    {
                        this.Jump = SCommon.Supplier(this.E_Jump(this.Random.Real() < 0.5 ? JUMP_SPEED : HI_JUMP_SPEED));
                    }

                    DDDraw.DrawBegin(Ground.I.Picture.Teki_a03_Jump01, this.X - DDGround.ICamera.X, this.Y - 16 - DDGround.ICamera.Y);
                    DDDraw.DrawZoom_X(this.FacingLeft ? 1.0 : -1.0);
                    DDDraw.DrawEnd();
                }

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y + 2.0), 20.0);

                yield return(true);
            }
        }
コード例 #10
0
        protected override IEnumerable <bool> E_Draw()
        {
            double axisX = this.X;
            double axisY = this.Y;

            for (int frame = 0; ; frame++)
            {
                axisX += this.XAdd;
                axisY += this.YAdd;
                DDUtils.Approach(ref this.R, 0.0, this.RApproachingRate);
                this.Rot += this.RotAdd;

                this.X = axisX + Math.Cos(this.Rot) * this.R;
                this.Y = axisY + Math.Sin(this.Rot) * this.R;

                EnemyCommon.Shoot(this, this.ShotType);

                int koma = frame / 5;
                koma %= 2;

                DDDraw.SetMosaic();
                DDDraw.DrawBegin(Ground.I.Picture2.D_PUMPKIN_00_GRBA[koma], this.X, this.Y);
                DDDraw.DrawZoom(3.0);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y + 4.0), 45.0);

                yield return(!EnemyCommon.IsEvacuated(this));
            }
        }
コード例 #11
0
        protected override IEnumerable <bool> E_Draw()
        {
            double a_mahoujin = 0.0;

            for (int frame = 0; ; frame++)
            {
                {
                    double rad = frame / 70.0;

                    DDUtils.Approach(ref this.X, GameConsts.FIELD_W / 2 + Math.Sin(rad) * 180.0, 0.93);
                    DDUtils.Approach(ref this.Y, GameConsts.FIELD_H / 7 + Math.Cos(rad) * 50.0, 0.93);
                }

                if (30 < frame && frame % 3 == 0)
                {
                    for (int c = 0; c < 3; c++)
                    {
                        double  rad = frame / 27.0 + (Math.PI * 2.0) * c / 3.0;
                        D2Point pt  = DDUtils.AngleToPoint(rad, 50.0);

                        EnemyCommon.TAMA_COLOR_e color = new EnemyCommon.TAMA_COLOR_e[]
                        {
                            EnemyCommon.TAMA_COLOR_e.CYAN,
                            EnemyCommon.TAMA_COLOR_e.YELLOW,
                            EnemyCommon.TAMA_COLOR_e.PURPLE,
                        }
                        [c];

                        Game.I.Enemies.Add(new Enemy_鍵山雛_Tama_01(this.X + pt.X, this.Y + pt.Y, rad + Math.PI / 2.0, color));
                        Game.I.Enemies.Add(new Enemy_鍵山雛_Tama_01(this.X + pt.X, this.Y + pt.Y, rad - Math.PI / 2.0, color));
                    }
                }

                {
                    const int TRANS_FRAME = 60;

                    if (frame == TRANS_FRAME)
                    {
                        // ボム消し
                        // このフレームにおけるボム当たり判定は既に展開しているので、ボスの当たり判定を展開する前のフレームで消す。
                        Game.I.Shots.RemoveAll(v => v.Kind == Shot.Kind_e.BOMB);

                        // 念のためリセット
                        //Game.I.BombUsed = false;
                        Game.I.PlayerWasDead = false;
                    }
                    else if (TRANS_FRAME < frame)
                    {
                        DDUtils.Approach(ref a_mahoujin, 1.0, 0.99);
                        this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 25.0);
                    }
                }

                EnemyCommon_鍵山雛.Draw(this.X, this.Y, true, a_mahoujin);
                EnemyCommon_鍵山雛.DrawOther(this);

                yield return(true);
            }
        }
コード例 #12
0
        protected override IEnumerable <bool> E_Draw()
        {
            double a_mahoujin = 0.0;

            for (int frame = 0; ; frame++)
            {
                DDUtils.Approach(ref this.X, GameConsts.FIELD_W / 2 + Math.Sin(frame / 101.0) * 20.0, 0.993);
                DDUtils.Approach(ref this.Y, GameConsts.FIELD_H / 2 + Math.Sin(frame / 103.0) * 20.0, 0.993);

                if (30 < frame && frame % 3 == 0)
                {
                    for (int c = 0; c < 2; c++)
                    {
                        double  rad = frame / 27.0 + (Math.PI * 2.0) * c / 2.0;
                        D2Point pt  = DDUtils.AngleToPoint(rad, 20.0);

                        Game.I.Enemies.Add(new Enemy_鍵山雛_Tama_02(this.X + pt.X, this.Y + pt.Y, rad, 0.9, EnemyCommon.TAMA_COLOR_e.RED));
                        Game.I.Enemies.Add(new Enemy_鍵山雛_Tama_02(this.X + pt.X, this.Y + pt.Y, rad, 0.0, EnemyCommon.TAMA_COLOR_e.GREEN));
                        Game.I.Enemies.Add(new Enemy_鍵山雛_Tama_02(this.X + pt.X, this.Y + pt.Y, rad, -0.9, EnemyCommon.TAMA_COLOR_e.BLUE));
                    }
                }

                if (30 < frame && frame % 20 == 0)
                {
                    for (int c = 0; c < 3; c++)
                    {
                        double  rad = DDUtils.GetAngle(Game.I.Player.X - this.X, Game.I.Player.Y - this.Y) + (Math.PI * 2.0) * (c * 2 + 1) / 6.0;
                        D2Point pt  = DDUtils.AngleToPoint(rad, 50.0);

                        Game.I.Enemies.Add(new Enemy_鍵山雛_Tama_03(this.X, this.Y, rad, EnemyCommon.TAMA_COLOR_e.PINK));
                    }
                }

                {
                    const int TRANS_FRAME = 60;

                    if (frame == TRANS_FRAME)
                    {
                        // ボム消し
                        // このフレームにおけるボム当たり判定は既に展開しているので、ボスの当たり判定を展開する前のフレームで消す。
                        Game.I.Shots.RemoveAll(v => v.Kind == Shot.Kind_e.BOMB);

                        // 念のためリセット
                        //Game.I.BombUsed = false;
                        Game.I.PlayerWasDead = false;
                    }
                    else if (TRANS_FRAME < frame)
                    {
                        DDUtils.Approach(ref a_mahoujin, 1.0, 0.99);
                        this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 25.0);
                    }
                }

                EnemyCommon_鍵山雛.Draw(this.X, this.Y, true, a_mahoujin);
                EnemyCommon_鍵山雛.DrawOther(this);

                yield return(true);
            }
        }
コード例 #13
0
        protected override IEnumerable <bool> E_Draw()
        {
            while (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y)))
            {
                this.X += 12.0 * (this.FacingLeft ? -1 : 1);

                switch (this.Level)
                {
                case 1:
                {
                    DDDraw.DrawCenter(Ground.I.Picture.Shot_Normal, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);

                    this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 10.0);
                }
                break;

                case 2:
                {
                    const double R = 14.0;

                    DDDraw.DrawBegin(Ground.I.Picture.WhiteCircle, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                    DDDraw.DrawSetSize(R, R);
                    DDDraw.DrawEnd();

                    this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), R);
                }
                break;

                case 3:
                {
                    const double R = 24.0;

                    DDDraw.DrawBegin(Ground.I.Picture.WhiteCircle, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                    DDDraw.DrawSetSize(R, R);
                    DDDraw.DrawEnd();

                    this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), R);
                }
                break;

                case 4:
                {
                    const double R = 48.0;

                    DDDraw.DrawBegin(Ground.I.Picture.WhiteCircle, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                    DDDraw.DrawSetSize(R, R);
                    DDDraw.DrawEnd();

                    this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), R);
                }
                break;

                default:
                    throw null;                             // never
                }
                yield return(true);
            }
        }
コード例 #14
0
        private static void OnibiDraw(FairyInfo fairy, int color)
        {
            int koma = (fairy.Frame / 4) % 4;

            DDDraw.DrawBegin(GetOnibiPicture(color, koma), fairy.Enemy.X, fairy.Enemy.Y);
            DDDraw.DrawZoom(2.0);
            DDDraw.DrawEnd();

            fairy.Enemy.Crash = DDCrashUtils.Circle(new D2Point(fairy.Enemy.X, fairy.Enemy.Y), 22.0);
        }
コード例 #15
0
 protected override IEnumerable <bool> E_Draw()
 {
     for (; ;)
     {
         this.X -= 3.0;
         DDDraw.DrawCenter(Ground.I.Picture.Enemy0001, this.X, this.Y);
         this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 48.0);
         yield return(!DDUtils.IsOutOfScreen(new D2Point(this.X, this.Y), 48.0));
     }
 }
コード例 #16
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (; ;)
            {
                DDDraw.DrawCenter(this.Picture, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 16.0);

                yield return(true);
            }
        }
コード例 #17
0
        private static void BigFairyDraw(FairyInfo fairy, int color)
        {
            if (fairy.Frame == 0)             // init
            {
                fairy.LastX = fairy.Enemy.X;
            }
            double xDiff = fairy.Enemy.X - fairy.LastX;

            fairy.LastX = fairy.Enemy.X;

            if (fairy.Frame % 7 == 0)
            {
                if (Math.Abs(xDiff) < SCommon.MICRO)                 // ? 左右に動いてない。
                {
                    DDUtils.CountDown(ref fairy.XMoveCount);
                }
                else if (xDiff < 0.0)                 // ? 左に動いてる。
                {
                    fairy.XMoveCount--;
                }
                else                 // ? 右に動いてる。
                {
                    fairy.XMoveCount++;
                }
                DDUtils.ToRange(ref fairy.XMoveCount, -2, 2);
            }
            int mode = DDUtils.Sign(fairy.XMoveCount);
            int koma;

            if (mode != 0)
            {
                koma = Math.Abs(fairy.XMoveCount) - 1;
            }
            else
            {
                koma = (fairy.Frame / 7) % 3;
            }

            if (1 <= fairy.Enemy.HP && fairy.Enemy.TransFrame == 0)             // ? 無敵ではない。
            {
                DDUtils.Approach(ref fairy.UntransRate, 0.5, 0.92);
            }

            DDDraw.SetAlpha(fairy.UntransRate);
            DDDraw.DrawBegin(Ground.I.Picture2.D_MAHOJIN_HAJIKE_00[5], fairy.Enemy.X, fairy.Enemy.Y);
            DDDraw.DrawRotate(fairy.Frame / 20.0);
            DDDraw.DrawZoom(0.4);
            DDDraw.DrawEnd();
            DDDraw.Reset();

            DDDraw.DrawCenter(GetBigFairyPicture(color, mode, koma), fairy.Enemy.X, fairy.Enemy.Y);

            fairy.Enemy.Crash = DDCrashUtils.Circle(new D2Point(fairy.Enemy.X, fairy.Enemy.Y), 30.0);
        }
コード例 #18
0
        protected override IEnumerable <bool> E_Draw()
        {
            double r;

            switch (this.TamaKind)
            {
            case EnemyCommon.TAMA_KIND_e.NORMAL: r = 8.0; break;

            case EnemyCommon.TAMA_KIND_e.BIG: r = 12.0; break;

            case EnemyCommon.TAMA_KIND_e.LARGE: r = 30.0; break;

            // TODO: その他の敵弾についてもここへ追加..

            default:
                throw null;                         // never
            }
            double xAdd;
            double yAdd;

            DDUtils.MakeXYSpeed(this.X, this.Y, Game.I.Player.X, Game.I.Player.Y, this.Speed, out xAdd, out yAdd);
            DDUtils.Rotate(ref xAdd, ref yAdd, this.Angle);

            DDPicture picture = EnemyCommon.GetTamaPicture(this.TamaKind, this.TamaColor);

            for (; ;)
            {
                this.X += xAdd;
                this.Y += yAdd;

                DDDraw.DrawCenter(picture, this.X, this.Y);

                if (this.AbsorbableWeapon != -1)                 // ? 吸収可能
                {
                    DDDraw.SetAlpha(0.5);
                    DDDraw.SetBright(0.0, 0.5, 1.0);
                    DDDraw.DrawBegin(Ground.I.Picture2.D_MAHOJIN_HAJIKE_00[5], this.X, this.Y);
                    DDDraw.DrawRotate(DDEngine.ProcFrame / 30.0);
                    DDDraw.DrawZoom(0.5);
                    DDDraw.DrawEnd();
                    DDDraw.Reset();

                    DDPrint.SetPrint((int)this.X, (int)this.Y);
                    DDPrint.SetBorder(new I3Color(0, 0, 100));
                    DDPrint.Print("[" + this.AbsorbableWeapon + "]");
                    DDPrint.Reset();
                }
                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), r);

                yield return(!EnemyCommon.IsEvacuated(this));
            }
        }
コード例 #19
0
        protected override IEnumerable <bool> E_Draw()
        {
            // ---- game_制御 ----

            Ground.I.Music.神さびた古戦場.Play();

            // ----

            int    boss_rot           = 0;
            double boss_approach_rate = 1.0;

            for (int frame = 0; ; frame++)
            {
                if (!_hitBack())
                {
                    double x = Math.Cos(boss_rot / 100.0);
                    double y = Math.Sin(boss_rot / 100.0);

                    boss_rot++;

                    x *= 0.4;
                    y *= 0.4;

                    x += 0.5;
                    y += 0.5;

                    x *= Game.I.Map.W * GameConsts.TILE_W;
                    y *= Game.I.Map.H * GameConsts.TILE_H;

                    DDUtils.Approach(ref this.X, x, boss_approach_rate);
                    DDUtils.Approach(ref this.Y, y, boss_approach_rate);
                    DDUtils.Approach(ref boss_approach_rate, 0.97, 0.99);

                    if (frame % 30 == 0)
                    {
                        Game.I.Enemies.Add(new Enemy_B神奈子_Tama(this.X, this.Y));
                    }

                    bool facingLeft = Game.I.Player.X < this.X;

                    DDDraw.DrawBegin(Ground.I.Picture2.Enemy_神奈子[0], this.X, this.Y);
                    DDDraw.DrawSlide(20.0, 10.0);
                    DDDraw.DrawZoom_X(facingLeft ? 1 : -1);
                    DDDraw.DrawEnd();
                }

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 80.0);

                yield return(true);
            }
        }
コード例 #20
0
        private void DrawTrackBar(int x, int y, string lwLabel, string hiLabel, double rate, Action <double> changed, Action pulse = null)
        {
            DDDraw.DrawBegin(Ground.I.Picture.TrackBar, x, y);
            DDCrash drawedCrash = DDDraw.DrawGetCrash();

            DDDraw.DrawEnd();

            DDPrint.SetPrint(x - Ground.I.Picture.TrackBar.Get_W() / 2 - lwLabel.Length * 32, y - 15);
            DDPrint.Print(lwLabel);

            DDPrint.SetPrint(x + Ground.I.Picture.TrackBar.Get_W() / 2, y - 15);
            DDPrint.Print(hiLabel);

            double span = Ground.I.Picture.TrackBar.Get_W() - Ground.I.Picture.TrackBar_つまみ.Get_W();

            span /= 2;
            double xMin = x - span;
            double xMax = x + span;

            double xつまみ = DDUtils.AToBRate(xMin, xMax, rate);

            DDDraw.DrawCenter(Ground.I.Picture.TrackBar_つまみ, xつまみ, y);

            if (drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
            {
                this.LastHoveringTrackBar = drawedCrash;
            }
            if (
                this.LastActiveTrackBar != null &&
                this.LastActiveTrackBar.Value.IsCrashed(DDCrashUtils.Point(new D2Point(x, y)))
                )
            {
                double rateNew = DDUtils.RateAToB(xMin, xMax, DDMouse.X);
                DDUtils.ToRange(ref rateNew, 0.0, 1.0);

                if (SCommon.MICRO < Math.Abs(rate - rateNew))
                {
                    changed(rateNew);
                }

                if (pulse != null)
                {
                    const int PULSE_FRM = 60;

                    if (DDEngine.ProcFrame % PULSE_FRM == 0)
                    {
                        pulse();
                    }
                }
            }
        }
コード例 #21
0
        protected override IEnumerable <bool> E_Draw()
        {
            while (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y)))
            {
                this.X += 12.0 * (this.FacingLeft ? -1 : 1);

                DDDraw.DrawBegin(Ground.I.Picture.Shot_Normal, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                DDDraw.DrawEnd();

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 10.0);

                yield return(true);
            }
        }
コード例 #22
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (; ;)
            {
                double speed       = 8.0;
                double nanameSpeed = speed / Consts.ROOT_OF_2;

                switch (this.Direction)
                {
                case 4: this.X -= speed; break;

                case 6: this.X += speed; break;

                case 8: this.Y -= speed; break;

                case 2: this.Y += speed; break;

                case 1:
                    this.X -= nanameSpeed;
                    this.Y += nanameSpeed;
                    break;

                case 3:
                    this.X += nanameSpeed;
                    this.Y += nanameSpeed;
                    break;

                case 7:
                    this.X -= nanameSpeed;
                    this.Y -= nanameSpeed;
                    break;

                case 9:
                    this.X += nanameSpeed;
                    this.Y -= nanameSpeed;
                    break;

                default:
                    throw null;                             // never
                }

                DDDraw.DrawBegin(Ground.I.Picture.Dummy, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                DDDraw.DrawZoom(0.1);
                DDDraw.DrawEnd();

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 5.0);

                yield return(!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y)));                // カメラの外に出たら(画面から見えなくなったら)消滅する。
            }
        }
コード例 #23
0
        public static string GetName(D2Point pt, string defval = null)
        {
            DDCrash ptCrash = DDCrashUtils.Point(pt);

            foreach (NamedCrash crash in Crashes)
            {
                if (crash.Crash.IsCrashed(ptCrash))
                {
                    return(crash.Name);
                }
            }

            return(defval);
        }
コード例 #24
0
        protected override IEnumerable <bool> E_Draw()
        {
            double x1;
            double x2;

            if (this.FacingLeft)
            {
                x1 = DDGround.ICamera.X;
                x2 = this.X;
            }
            else
            {
                x1 = this.X;
                x2 = DDGround.ICamera.X + DDConsts.Screen_W;
            }
            double y1 = this.Y - 2.0;
            double y2 = this.Y + 2.0;

            if (x2 < x1 + 2.0)
            {
                goto endFunc;
            }

            DDDraw.SetAlpha(0.2 + 0.1 * Math.Sin(DDEngine.ProcFrame / 2.0));
            DDDraw.SetBright(0.0, 1.0, 1.0);
            DDDraw.DrawRect_LTRB(
                Ground.I.Picture.WhiteBox,
                x1 - DDGround.ICamera.X,
                y1 - DDGround.ICamera.Y,
                x2 - DDGround.ICamera.X,
                y2 - DDGround.ICamera.Y
                );
            DDDraw.Reset();

            if (DDEngine.ProcFrame % 5 == 0)             // 間隔適当
            {
                this.Crash = DDCrashUtils.Rect(D4Rect.LTRB(x1, y1, x2, y2));
            }

            // 1回だけ true を返して1フレームだけ生存する必要がある。
            // -- 当たり判定時に、自弾リストに this が無いと this.Crash は参照されない。
            //
            yield return(true);            // 1フレームで消滅する。

endFunc:
            ;

            //yield break;
        }
コード例 #25
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (; ;)
            {
                this.X += 10;

                DDDraw.SetAlpha(0.5);
                DDDraw.DrawCenter(Ground.I.Picture.Shot0001, this.X, this.Y);
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 16.0);

                yield return(!DDUtils.IsOutOfScreen(new D2Point(this.X, this.Y), 16.0));
            }
        }
コード例 #26
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (; ;)
            {
                this.X += 8.0 * (this.FacingLeft ? -1 : 1);

                DDDraw.DrawBegin(Ground.I.Picture.Dummy, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                DDDraw.DrawZoom(0.1);
                DDDraw.DrawEnd();

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 5.0);

                yield return(true);
            }
        }
コード例 #27
0
        /// <summary>
        /// 当たり判定を配置する。
        /// 処理すべきこと:
        /// Game.I.PlayerCrashes への追加
        /// Game.I.GrazeCrashes への追加
        /// </summary>
        public void Put当たり判定()
        {
            const double GRAZE_R = 10.0;

            foreach (DDScene scene in DDSceneUtils.Create(5))
            {
                D2Point pt = DDUtils.AToBRate(
                    new D2Point(this.X, this.Y),
                    new D2Point(this.LastX, this.LastY),
                    scene.Rate
                    );

                Game.I.PlayerCrashes.Add(DDCrashUtils.Point(pt));
                Game.I.GrazeCrashes.Add(DDCrashUtils.Circle(pt, GRAZE_R));
            }
        }
コード例 #28
0
        protected override IEnumerable <bool> E_Draw()
        {
            D2Point speed = DDUtils.AngleToPoint(DDUtils.GetAngle(Game.I.Player.X - this.X, Game.I.Player.Y - this.Y), 8.0);

            for (; ;)
            {
                this.X += speed.X;
                this.Y += speed.Y;

                DDDraw.DrawCenter(Ground.I.Picture.Tama0001, this.X, this.Y);

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 16.0);

                yield return(!DDUtils.IsOutOfScreen(new D2Point(this.X, this.Y), 16.0));
            }
        }
コード例 #29
0
        protected override IEnumerable <bool> E_Draw()
        {
            bool   falling = false;
            double ySpeed  = 0.0;

            const double GRAVITY     = 0.5;
            const double SPEED_Y_MAX = 8.0;

            for (; ;)
            {
                if (
                    this.Y < Game.I.Player.Y &&
                    Math.Abs(Game.I.Player.X - this.X) < 50.0
                    )
                {
                    falling = true;
                }

                if (falling)
                {
                    this.Y += ySpeed;

                    ySpeed += GRAVITY;
                    ySpeed  = Math.Min(ySpeed, SPEED_Y_MAX);

                    I2Point pt = GameCommon.ToTablePoint(new D2Point(this.X, this.Y));

                    if (Game.I.Map.GetCell(pt).Tile.IsGround())                     // ? 地面に落ちた。
                    {
                        this.DeadFlag = true;

                        DDGround.EL.Add(SCommon.Supplier(this.E_地面に落ちた(
                                                             pt.X * GameConsts.TILE_W + GameConsts.TILE_W / 2,
                                                             pt.Y * GameConsts.TILE_H - GameConsts.TILE_H / 2
                                                             )));

                        break;
                    }
                }

                DDDraw.DrawCenter(Ground.I.Picture.Stage02_Chip_g04_01, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);

                this.Crash = DDCrashUtils.Rect_CenterSize(new D2Point(this.X, this.Y), new D2Size(16, 32));

                yield return(true);
            }
        }
コード例 #30
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (int frame = 0; ; frame++)
            {
                this.X += this.Speed.X;
                this.Y += this.Speed.Y;

                if (this.X < 0.0)
                {
                    this.Speed.X = Math.Abs(this.Speed.X);
                }
                else if (GameConsts.FIELD_W < this.X)
                {
                    this.Speed.X = -Math.Abs(this.Speed.X);
                }

                if (this.Y < 0.0)
                {
                    this.Speed.Y = Math.Abs(this.Speed.Y);
                }
                else
                {
                    this.Speed.Y += 0.03;                     // 重力加速度
                }
                if (this.AbsorbableWeapon != -1)              // ? 吸収可能
                {
                    DDDraw.SetAlpha(0.2);
                    DDDraw.SetBright(0.0, 0.5, 1.0);
                    DDDraw.DrawBegin(Ground.I.Picture2.D_MAHOJIN_HAJIKE_00[5], this.X, this.Y);
                    DDDraw.DrawRotate(DDEngine.ProcFrame / 30.0);
                    DDDraw.DrawZoom(1.2);
                    DDDraw.DrawEnd();
                    DDDraw.Reset();

                    DDPrint.SetPrint((int)this.X, (int)this.Y);
                    DDPrint.SetBorder(new I3Color(0, 0, 100));
                    DDPrint.Print("[" + this.AbsorbableWeapon + "]");
                    DDPrint.Reset();
                }

                DDDraw.DrawCenter(EnemyCommon.GetTamaPicture(EnemyCommon.TAMA_KIND_e.DOUBLE, this.Color), this.X, this.Y);

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 6.0);

                yield return(this.Y < GameConsts.FIELD_H);
            }
        }