示例#1
0
 public void Bomb()
 {
     if (!Isボム発動中() && DDUtils.CountDown(ref Game.I.Status.ZanBomb))
     {
         Game.I.Shots.Add(new Shot_Bボム());
     }
 }
示例#2
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);
        }
示例#3
0
        public bool PlayerWasDead = false;         // 死亡すると true にセットされる。

        public void Perform()
        {
            DDUtils.Random = new DDRandom(1u, 1u, 1u, 1u);             // 電源パターン確保のため

            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            Func <bool> f_ゴミ回収 = SCommon.Supplier(this.E_ゴミ回収());

            // reset
            {
                RippleEffect.Clear();
                画面分割.Enabled = false;
            }

            this.Player.Reset(false);

            // ★★★★★ ステータス反映
            {
                this.Score        = this.Status.Score;
                this.Player.Power = this.Status.PlayerPower;
                this.Zanki        = this.Status.PlayerZanki;
                this.ZanBomb      = this.Status.PlayerZanBomb;
            }

            for (this.Frame = 0; ; this.Frame++)
            {
                if (!this.Script.EachFrame())                 // シナリオ進行
                {
                    break;
                }

                if (DDConfig.LOG_ENABLED)                 // チート機能
                {
                    if (DDKey.IsPound(DX.KEY_INPUT_PGUP))
                    {
                        this.Player.Power += GameConsts.PLAYER_POWER_PER_LEVEL;
                    }
                    if (DDKey.IsPound(DX.KEY_INPUT_PGDN))
                    {
                        this.Player.Power -= GameConsts.PLAYER_POWER_PER_LEVEL;
                    }
                    DDUtils.ToRange(ref this.Player.Power, 0, GameConsts.PLAYER_POWER_MAX);
                }

                if (DDInput.PAUSE.GetInput() == 1 && 10 < this.Frame)                 // ポーズ
                {
                    this.Pause();

                    if (this.Pause_RestartGame)
                    {
                        GameMaster.RestartFlag = true;
                        break;
                    }
                    if (this.Pause_ReturnToTitleMenu)
                    {
                        GameMaster.ReturnToTitleMenu = true;
                        break;
                    }
                }
                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_RETURN) == 1)
                {
                    this.DebugPause();
                }

                this.LastInput = this.Input;                 // 前回のプレイヤー入力を退避

                // プレイヤー入力
                {
                    this.Input.Dir2  = 1 <= DDInput.DIR_2.GetInput();
                    this.Input.Dir4  = 1 <= DDInput.DIR_4.GetInput();
                    this.Input.Dir6  = 1 <= DDInput.DIR_6.GetInput();
                    this.Input.Dir8  = 1 <= DDInput.DIR_8.GetInput();
                    this.Input.Slow  = 1 <= DDInput.A.GetInput();
                    this.Input.Shoot = 1 <= DDInput.B.GetInput();
                    this.Input.Bomb  = 1 <= DDInput.C.GetInput();
                }

                this.Player.LastX = this.Player.X;
                this.Player.LastY = this.Player.Y;

startBornPlayer:
                if (1 <= this.Player.BornFrame)                 // プレイヤー登場中の処理
                {
                    int frm = this.Player.BornFrame - 1;

                    if (GameConsts.PLAYER_BORN_FRAME_MAX < frm)
                    {
                        this.Player.BornFrame = 0;
                        goto endBornPlayer;
                    }
                    this.Player.BornFrame++;
                    double rate = (double)frm / GameConsts.PLAYER_BORN_FRAME_MAX;

                    if (frm == 0)                     // init
                    {
                        this.Player.BornFollowX = GameConsts.FIELD_W * 0.5;
                        this.Player.BornFollowY = GameConsts.FIELD_H * 1.2;
                    }

                    double approachingRate = 0.99 - 0.01 * frm;
                    DDUtils.ToRange(ref approachingRate, 0.0, 1.0);

                    DDUtils.Approach(ref this.Player.BornFollowX, this.Player.X, approachingRate);
                    DDUtils.Approach(ref this.Player.BornFollowY, this.Player.Y, approachingRate);
                }
endBornPlayer:

                //startDeadPlayer:
                if (1 <= this.Player.DeadFrame)                 // プレイヤー死亡中の処理
                {
                    int frm = this.Player.DeadFrame - 1;

                    if (GameConsts.PLAYER_DEAD_FRAME_MAX < frm)
                    {
                        if (this.Zanki <= 0)                         // 残機不足のため終了
                        {
                            GameMaster.ReturnToTitleMenu = true;
                            break;
                        }
                        this.Zanki--;
                        this.Player.Reset(true);
                        goto startBornPlayer;
                    }
                    this.Player.DeadFrame++;

                    if (frm == 0)                     // init
                    {
                        this.DeadPlayerMoment();
                        this.PlayerEffects.Add(SCommon.Supplier(Effects.PlayerDead(this.Player.X, this.Player.Y)));
                    }
                    goto endPlayerMove;
                }
                //endDeadPlayer:

                //startBombPlayer:
                if (1 <= this.Player.BombFrame)                 // ボム使用中の処理
                {
                    int frm = this.Player.BombFrame - 1;

                    if (GameConsts.PLAYER_BOMB_FRAME_MAX < frm)
                    {
                        this.Player.BombFrame = 0;
                        goto endBombPlayer;
                    }
                    this.Player.BombFrame++;

                    if (frm == 0)                     // init
                    {
                        this.Player.Bomb();
                    }
                }
endBombPlayer:

                //startPlayerMove:
                // プレイヤー移動
                {
                    bool d2 = this.Input.Dir2;
                    bool d4 = this.Input.Dir4;
                    bool d6 = this.Input.Dir6;
                    bool d8 = this.Input.Dir8;

                    double speed;

                    if (this.Input.Slow)
                    {
                        speed = 2.5;
                    }
                    else
                    {
                        speed = 5.0;
                    }

                    double nanameSpeed = speed / Math.Sqrt(2.0);

                    if (d2 && d4)                     // 左下
                    {
                        this.Player.X -= nanameSpeed;
                        this.Player.Y += nanameSpeed;
                    }
                    else if (d2 && d6)                     // 右下
                    {
                        this.Player.X += nanameSpeed;
                        this.Player.Y += nanameSpeed;
                    }
                    else if (d4 && d8)                     // 左上
                    {
                        this.Player.X -= nanameSpeed;
                        this.Player.Y -= nanameSpeed;
                    }
                    else if (d6 && d8)                     // 右上
                    {
                        this.Player.X += nanameSpeed;
                        this.Player.Y -= nanameSpeed;
                    }
                    else if (d2)                     // 下
                    {
                        this.Player.Y += speed;
                    }
                    else if (d4)                     // 左
                    {
                        this.Player.X -= speed;
                    }
                    else if (d6)                     // 右
                    {
                        this.Player.X += speed;
                    }
                    else if (d8)                     // 上
                    {
                        this.Player.Y -= speed;
                    }

                    DDUtils.ToRange(ref this.Player.X, 0.0, (double)GameConsts.FIELD_W);
                    DDUtils.ToRange(ref this.Player.Y, 0.0, (double)GameConsts.FIELD_H);

                    if (d4)                     // 左
                    {
                        DDUtils.Minim(ref this.Player.XMoveFrame, 0);
                        this.Player.XMoveFrame--;
                    }
                    else if (d6)                     // 右
                    {
                        DDUtils.Maxim(ref this.Player.XMoveFrame, 0);
                        this.Player.XMoveFrame++;
                    }
                    else
                    {
                        this.Player.XMoveFrame = 0;
                    }

                    if (d8)                     // 上
                    {
                        DDUtils.Minim(ref this.Player.YMoveFrame, 0);
                        this.Player.YMoveFrame--;
                    }
                    else if (d2)                     // 下
                    {
                        DDUtils.Maxim(ref this.Player.YMoveFrame, 0);
                        this.Player.YMoveFrame++;
                    }
                    else
                    {
                        this.Player.YMoveFrame = 0;
                    }

                    DDUtils.Approach(ref this.Player.XMoveRate, DDUtils.Sign(this.Player.XMoveFrame), 0.95);
                    DDUtils.Approach(ref this.Player.YMoveRate, DDUtils.Sign(this.Player.YMoveFrame), 0.95);
                }
endPlayerMove:

                if (this.Input.Slow)
                {
                    DDUtils.Maxim(ref this.Player.SlowFrame, 0);
                    this.Player.SlowFrame++;
                }
                else
                {
                    DDUtils.Minim(ref this.Player.SlowFrame, 0);
                    this.Player.SlowFrame--;
                }

                if (this.Input.Shoot)
                {
                    DDUtils.Maxim(ref this.Player.ShootFrame, 0);
                    this.Player.ShootFrame++;
                }
                else
                {
                    DDUtils.Minim(ref this.Player.ShootFrame, 0);
                    this.Player.ShootFrame--;
                }

                DDUtils.Approach(ref this.Player.SlowRate, this.Player.SlowFrame < 0 ? 0.0 : 1.0, 0.85);
                DDUtils.Approach(ref this.Player.ShootRate, this.Player.ShootFrame < 0 ? 0.0 : 1.0, 0.85);

                if (this.LastInput.Shoot && this.Input.Shoot && SCommon.IsRange(this.Player.SlowFrame, -1, 1))                 // ? ショット中に低速・高速を切り替えた。
                {
                    this.Player.ShootRate = 0.0;
                }

                // ----

                if (this.Input.Shoot && this.Player.DeadFrame == 0)                 // プレイヤー攻撃
                {
                    this.Player.Shoot();
                }
                if (this.Input.Bomb && this.Player.DeadFrame == 0 && this.Player.BombFrame == 0 && 1 <= this.ZanBomb)                 // ボム使用
                {
                    this.ZanBomb--;
                    this.Player.BombFrame = 1;
                }

                // 当たり判定 reset
                {
                    this.PlayerCrashes.Clear();
                    this.GrazeCrashes.Clear();
                    this.EnemyCrashes.Clear();
                    this.ShotCrashes.Clear();
                }

                this.Player.Put当たり判定();

                // ====
                // 描画ここから
                // ====

                // Swap
                {
                    DDSubScreen tmp = this.Field;
                    this.Field      = this.Field_Last;
                    this.Field_Last = tmp;
                }

                using (this.Field.Section())                 // フィールド描画
                {
                    // Walls
                    {
                        int filledIndex = -1;

                        for (int index = 0; index < this.Walls.Count; index++)
                        {
                            Wall wall = this.Walls[index];

                            if (!wall.Draw())
                            {
                                this.Walls[index] = null;
                            }
                            else if (wall.Filled)
                            {
                                filledIndex = index;
                            }
                        }
                        for (int index = 0; index < filledIndex; index++)
                        {
                            this.Walls[index] = null;
                        }

                        this.Walls.RemoveAll(v => v == null);
                    }

                    RippleEffect.EachFrame(this.Field);

                    this.EL_AfterDrawWalls.ExecuteAllTask();

                    // Shots
                    {
                        for (int index = 0; index < this.Shots.Count; index++)
                        {
                            Shot shot = this.Shots[index];

                            if (!shot.Draw())
                            {
                                this.Shots[index] = null;
                            }
                        }
                        this.Shots.RemoveAll(v => v == null);
                    }

                    this.EL_AfterDrawShots.ExecuteAllTask();

                    if (this.Player.DeadFrame == 0)
                    {
                        this.Player.Draw();
                    }

                    this.EL_AfterDrawPlayer.ExecuteAllTask();

                    // Enemies
                    {
                        foreach (Enemy.Kind_e kind in new Enemy.Kind_e[]
                        {
                            Enemy.Kind_e.ENEMY,
                            Enemy.Kind_e.TAMA,
                            Enemy.Kind_e.ITEM,
                        })
                        {
                            for (int index = 0; index < this.Enemies.Count; index++)
                            {
                                Enemy enemy = this.Enemies[index];

                                if (enemy != null && enemy.Kind == kind)
                                {
                                    if (!enemy.Draw())
                                    {
                                        this.Enemies[index] = null;
                                    }
                                }
                            }
                        }
                        this.Enemies.RemoveAll(v => v == null);
                    }

                    this.EnemyEffects.ExecuteAllTask();
                    this.PlayerEffects.ExecuteAllTask();

                    // 当たり判定表示
                    // -- デバッグ用だが、ボタン設定に割り当てがあるので、常に使えるようにする。
                    if (1 <= DDInput.R.GetInput())
                    {
                        this.Draw当たり判定();
                    }

                    画面分割.EachFrame(this.Field);
                }

                {
                    DDUtils.Approach(ref this.BackgroundSlideRate, this.Player.Y * 1.0 / GameConsts.FIELD_H, 0.99);                     // HACK

                    D4Rect rect = DDUtils.AdjustRectExterior(
                        new D2Size(GameConsts.FIELD_W, GameConsts.FIELD_H),
                        new D4Rect(0, 0, DDConsts.Screen_W, DDConsts.Screen_H),
                        this.BackgroundSlideRate
                        //this.Player.Y * 1.0 / GameConsts.FIELD_H
                        );

                    DDDraw.DrawRect(this.Field.ToPicture(), rect);
                }

                {
                    const int MARGIN = 5;

                    DDDraw.SetBright(0, 0, 0);
                    DDDraw.DrawRect(
                        Ground.I.Picture.WhiteBox,
                        GameConsts.FIELD_L - MARGIN,
                        GameConsts.FIELD_T - MARGIN,
                        GameConsts.FIELD_W + MARGIN * 2,
                        GameConsts.FIELD_H + MARGIN * 2
                        );
                    DDDraw.Reset();
                }

                DX.GraphFilter(
                    DDGround.MainScreen.GetHandle(),
                    DX.DX_GRAPH_FILTER_GAUSS,
                    16,
                    SCommon.ToInt(500.0)
                    );

                DDCurtain.DrawCurtain(-0.2);

                DDDraw.DrawSimple(this.Field.ToPicture(), GameConsts.FIELD_L, GameConsts.FIELD_T);
                this.DrawStatus();
                this.SurfaceManager.Draw();

                // ====
                // 描画ここまで
                // ====

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    if (!DDUtils.IsOut(new D2Point(enemy.X, enemy.Y), new D4Rect(0, 0, GameConsts.FIELD_W, GameConsts.FIELD_H)))                     // ? フィールド内
                    {
                        DDUtils.CountDown(ref enemy.TransFrame);
                        enemy.OnFieldFrame++;
                    }
                }

                this.当たり判定();

                if (this.AH_Grazed)
                {
                    if (
                        1 <= this.Player.BornFrame ||
                        1 <= this.Player.DeadFrame
                        )
                    {
                        // 登場中・死亡中は何もしない。
                    }
                    else
                    {
                        Ground.I.SE.SE_KASURI.Play();
                        this.Score++;
                    }
                }
                if (this.AH_PlayerCrashedFlag)
                {
                    if (
                        1 <= this.Player.BornFrame ||
                        1 <= this.Player.DeadFrame ||
                        1 <= this.Player.BombFrame
                        )
                    {
                        // 登場中・死亡中・ボム使用中は何もしない。
                    }
                    else
                    {
                        this.Player.DeadFrame = 1;                         // プレイヤー死亡
                        this.PlayerWasDead    = true;
                    }
                }

                if (Ground.I.HiScore < this.Score)
                {
                    if (Ground.I.HiScore + 10L < this.Score)
                    {
                        Ground.I.HiScore -= this.Score;
                        Ground.I.HiScore /= 2L;
                        Ground.I.HiScore += this.Score;
                    }
                    else
                    {
                        Ground.I.HiScore++;
                    }
                }

                f_ゴミ回収();

                this.Enemies.RemoveAll(v => v.HP == -1);
                this.Shots.RemoveAll(v => v.Vanished);

                DDEngine.EachFrame();

                // ★★★ ゲームループの終わり ★★★
            }

            DDUtils.Maxim(ref Ground.I.HiScore, this.Score);             // 確実な同期

            // ★★★★★ ステータス反映
            {
                this.Status.Score         = this.Score;
                this.Status.PlayerPower   = this.Player.Power;
                this.Status.PlayerZanki   = this.Zanki;
                this.Status.PlayerZanBomb = this.ZanBomb;
            }

            DDMain.KeepMainScreen();

            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(60, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(120))
            {
                DDDraw.DrawRect(DDGround.KeptMainScreen.ToPicture(), 0, 0, DDConsts.Screen_W, DDConsts.Screen_H);
                DDEngine.EachFrame();
            }

            // ★★★ end of Perform() ★★★
        }
示例#4
0
        public void Draw()
        {
            if (PlayerLookLeftFrm == 0 && DDUtils.Random.Real2() < 0.002)             // キョロキョロするレート
            {
                PlayerLookLeftFrm = 150 + (int)(DDUtils.Random.Real2() * 90.0);
            }

            DDUtils.CountDown(ref PlayerLookLeftFrm);

            double xZoom = this.FacingLeft ? -1 : 1;

            // 立ち >

            DDPicture picture = Ground.I.Picture.PlayerStands[120 < PlayerLookLeftFrm ? 1 : 0][(DDEngine.ProcFrame / 20) % 2];

            if (1 <= this.MoveFrame)
            {
                if (this.MoveSlow)
                {
                    picture = Ground.I.Picture.PlayerWalk[(DDEngine.ProcFrame / 10) % 2];
                }
                else
                {
                    picture = Ground.I.Picture.PlayerDash[(DDEngine.ProcFrame / 5) % 2];
                }
            }
            if (this.TouchGround == false)
            {
                picture = Ground.I.Picture.PlayerJump[0];
            }
            if (1 <= this.ShagamiFrame)
            {
                picture = Ground.I.Picture.PlayerShagami;
            }

            // < 立ち

            // 攻撃中 >

            if (1 <= this.AttackFrame)
            {
                picture = Ground.I.Picture.PlayerAttack;

                if (1 <= this.MoveFrame)
                {
                    if (this.MoveSlow)
                    {
                        picture = Ground.I.Picture.PlayerAttackWalk[(DDEngine.ProcFrame / 10) % 2];
                    }
                    else
                    {
                        picture = Ground.I.Picture.PlayerAttackDash[(DDEngine.ProcFrame / 5) % 2];
                    }
                }
                if (this.TouchGround == false)
                {
                    picture = Ground.I.Picture.PlayerAttackJump;
                }
                if (1 <= this.ShagamiFrame)
                {
                    picture = Ground.I.Picture.PlayerAttackShagami;
                }
            }

            // < 攻撃中

            if (this.DeadScene.IsFlaming())
            {
                int koma = IntTools.ToRange(this.DeadScene.Count / 20, 0, 1);

                if (this.TouchGround)
                {
                    koma *= 2;
                }

                koma *= 2;
                koma++;

                picture = Ground.I.Picture.PlayerDamage[koma];

                DDDraw.SetTaskList(DDGround.EL);
            }
            if (this.DamageScene.IsFlaming())
            {
                picture = Ground.I.Picture.PlayerDamage[0];
                xZoom  *= -1;
            }

            if (this.DamageScene.IsFlaming() || this.MutekiScene.IsFlaming())
            {
                DDDraw.SetTaskList(DDGround.EL);
                DDDraw.SetAlpha(0.5);
            }
            DDDraw.DrawBegin(
                picture,
                DoubleTools.ToInt(this.X - DDGround.ICamera.X),
                DoubleTools.ToInt(this.Y - DDGround.ICamera.Y) - 16
                );
            DDDraw.DrawZoom_X(xZoom);
            DDDraw.DrawEnd();
            DDDraw.Reset();

            // debug
            {
                DDDraw.DrawBegin(DDGround.GeneralResource.Dummy, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                DDDraw.DrawZoom(0.1);
                DDDraw.DrawRotate(DDEngine.ProcFrame * 0.01);
                DDDraw.DrawEnd();
            }
        }
示例#5
0
        protected override IEnumerable <bool> E_Draw()
        {
            const int SHOOTING_FRAME_MAX = 15;
            //const int SHOOTING_FRAME_MAX = 10; // old

            int shootingFrame = 0;             // 0 == 無効, 1~ == 射撃モーション (カウントダウン方式)

            // 梯子の中央に寄せる。
            // -- 複数箇所から new Attack_Ladder() されるので、ここでやるのが妥当
            Game.I.Player.X = GameCommon.ToTablePoint(new D2Point(Game.I.Player.X, 0.0)).X *GameConsts.TILE_W + GameConsts.TILE_W / 2;

            for (int frame = 0; ; frame++)
            {
                if (AttackCommon.CamSlide())
                {
                    goto endPlayer;
                }

                if (DDInput.DIR_8.GetInput() == 0 && 1 <= DDInput.A.GetInput()) // ? 上ボタンを離して、ジャンプボタン押下
                {
                    if (1 <= DDInput.DIR_2.GetInput())                          // ? 下ボタン押下 -> ジャンプしない。
                    {
                        Game.I.Player.JumpFrame = 0;
                        Game.I.Player.JumpCount = 0;

                        Game.I.Player.YSpeed = 0.0;
                    }
                    else                     // ? 下ボタンを離している -> ジャンプする。
                    {
                        Game.I.Player.JumpFrame = 1;
                        Game.I.Player.JumpCount = 1;

                        Game.I.Player.YSpeed = GameConsts.PLAYER_ジャンプ初速度;
                    }

                    // スライディングさせないために滞空状態にする。
                    // -- 入力猶予を考慮して、大きい値を設定する。
                    Game.I.Player.AirborneFrame = SCommon.IMAX / 2;

                    break;
                }

                if (1 <= DDInput.DIR_4.GetInput())
                {
                    Game.I.Player.FacingLeft = true;
                }

                if (1 <= DDInput.DIR_6.GetInput())
                {
                    Game.I.Player.FacingLeft = false;
                }

                // 移動
                if (shootingFrame == 0)                 // 射撃モーション時は移動出来ない。
                {
                    const double SPEED   = 2.5;
                    const double 加速_RATE = 0.5;

                    bool moved = false;

                    if (1 <= DDInput.DIR_8.GetInput())
                    {
                        Game.I.Player.Y -= Math.Min(SPEED, DDInput.DIR_8.GetInput() * 加速_RATE);
                        moved            = true;
                    }
                    if (1 <= DDInput.DIR_2.GetInput())
                    {
                        Game.I.Player.Y += Math.Min(SPEED, DDInput.DIR_2.GetInput() * 加速_RATE);
                        moved            = true;
                    }

                    if (moved)
                    {
                        // none
                    }
                }

                bool 攻撃ボタンを押した瞬間撃つ = Ground.I.ショットのタイミング == Ground.ショットのタイミング_e.ショットボタンを押し下げた時;
                bool shot          = false;

                if (1 <= DDInput.B.GetInput())
                {
                    if (攻撃ボタンを押した瞬間撃つ && DDInput.B.GetInput() == 1)
                    {
                        Game.I.Player.Shoot(1);
                        shot = true;
                    }
                    Game.I.Player.ShotChargePCT++;
                    DDUtils.Minim(ref Game.I.Player.ShotChargePCT, 100);
                }
                else
                {
                    int level     = GameCommon.ShotChargePCTToLevel(Game.I.Player.ShotChargePCT);
                    int chargePct = Game.I.Player.ShotChargePCT;
                    Game.I.Player.ShotChargePCT = 0;

                    if (攻撃ボタンを押した瞬間撃つ ? 2 <= level : 1 <= chargePct)
                    {
                        Game.I.Player.Shoot(level);
                        shot = true;
                    }
                }
                if (shot)
                {
                    shootingFrame = SHOOTING_FRAME_MAX;
                }
                else
                {
                    DDUtils.CountDown(ref shootingFrame);
                }

                //AttackCommon.ProcPlayer_移動();
                //AttackCommon.ProcPlayer_Fall();
                //AttackCommon.ProcPlayer_側面();
                AttackCommon.ProcPlayer_脳天();

                if (AttackCommon.ProcPlayer_接地())
                {
                    Game.I.Player.JumpFrame = 0;
                    Game.I.Player.JumpCount = 0;

                    Game.I.Player.YSpeed = 0.0;

                    break;
                }

                // ? 梯子の下に出た。
                if (
                    Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(Game.I.Player.X, Game.I.Player.Y + GameConsts.TILE_H * 0))).Tile.GetKind() != Tile.Kind_e.LADDER &&
                    Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(Game.I.Player.X, Game.I.Player.Y + GameConsts.TILE_H * 1))).Tile.GetKind() != Tile.Kind_e.LADDER
                    )
                {
                    Game.I.Player.JumpFrame = 0;
                    Game.I.Player.JumpCount = 0;

                    Game.I.Player.YSpeed = 0.0;

                    break;
                }
endPlayer:

                DDPicture picture;
                double xZoom;

                if (1 <= shootingFrame)
                {
                    picture = Ground.I.Picture.Chara_A01_Climb_Attack;
                    xZoom   = Game.I.Player.FacingLeft ? -1.0 : 1.0;
                }
                else
                {
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(Game.I.Player.X, Game.I.Player.Y))).Tile.GetKind() == Tile.Kind_e.LADDER)
                    {
                        picture = Ground.I.Picture.Chara_A01_Climb[(int)Game.I.Player.Y / 20 % 2];
                    }
                    else
                    {
                        picture = Ground.I.Picture.Chara_A01_Climb_Top;
                    }

                    xZoom = 1.0;
                }

                double x = Game.I.Player.X;
                double y = Game.I.Player.Y;

                // 整数化
                x = (int)x;
                y = (int)y;

                DDDraw.SetTaskList(Game.I.Player.Draw_EL);
                DDDraw.DrawBegin(
                    picture,
                    x - DDGround.ICamera.X,
                    y - DDGround.ICamera.Y
                    );
                DDDraw.DrawZoom_X(xZoom);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                yield return(true);
            }
        }
示例#6
0
        public void Draw()
        {
            if (PlayerLookLeftFrame == 0 && DDUtils.Random.Real() < 0.002)             // キョロキョロするレート
            {
                PlayerLookLeftFrame = 150 + (int)(DDUtils.Random.Real() * 90.0);
            }

            DDUtils.CountDown(ref PlayerLookLeftFrame);

            double xZoom = this.FacingLeft ? -1 : 1;

            // 立ち >

            DDPicture picture = Ground.I.Picture.PlayerStands[120 < PlayerLookLeftFrame ? 1 : 0][(DDEngine.ProcFrame / 20) % 2];

            if (1 <= this.MoveFrame)
            {
                if (this.MoveSlow)
                {
                    picture = Ground.I.Picture.PlayerWalk[(DDEngine.ProcFrame / 10) % 2];
                }
                else
                {
                    picture = Ground.I.Picture.PlayerDash[(DDEngine.ProcFrame / 5) % 2];
                }
            }
            if (1 <= this.AirborneFrame)
            {
                picture = Ground.I.Picture.PlayerJump[0];
            }
            if (1 <= this.ShagamiFrame)
            {
                picture = Ground.I.Picture.PlayerShagami;
            }

            // < 立ち

            // 攻撃中 >

            if (1 <= this.AttackFrame)
            {
                picture = Ground.I.Picture.PlayerAttack;

                if (1 <= this.MoveFrame)
                {
                    if (this.MoveSlow)
                    {
                        picture = Ground.I.Picture.PlayerAttackWalk[(DDEngine.ProcFrame / 10) % 2];
                    }
                    else
                    {
                        picture = Ground.I.Picture.PlayerAttackDash[(DDEngine.ProcFrame / 5) % 2];
                    }
                }
                if (1 <= this.AirborneFrame)
                {
                    picture = Ground.I.Picture.PlayerAttackJump;
                }
                if (1 <= this.ShagamiFrame)
                {
                    picture = Ground.I.Picture.PlayerAttackShagami;
                }
            }

            // < 攻撃中

            if (1 <= this.DeadFrame)
            {
                int koma = SCommon.ToRange(this.DeadFrame / 20, 0, 1);

                if (this.AirborneFrame == 0)
                {
                    koma *= 2;
                }

                koma *= 2;
                koma++;

                picture = Ground.I.Picture.PlayerDamage[koma];

                DDDraw.SetTaskList(DDGround.EL);
            }
            if (1 <= this.DamageFrame)
            {
                picture = Ground.I.Picture.PlayerDamage[0];
                xZoom  *= -1;
            }

            if (1 <= this.DamageFrame || 1 <= this.InvincibleFrame)
            {
                DDDraw.SetTaskList(DDGround.EL);
                DDDraw.SetAlpha(0.5);
            }
            DDDraw.DrawBegin(
                picture,
                SCommon.ToInt(this.X - DDGround.ICamera.X),
                SCommon.ToInt(this.Y - DDGround.ICamera.Y) - 16
                );
            DDDraw.DrawZoom_X(xZoom);
            DDDraw.DrawEnd();
            DDDraw.Reset();
        }