public override IEnumerable <bool> E_Task() { for (; ;) { DDUtils.Approach(ref this.PutRate, 0.6, 0.999); if (DDUtils.Random.Real() < this.PutRate) { double r = DDUtils.AToBRate(this.RMin, this.RMax, DDUtils.Random.Real()); this.Snows.Add(new SnowInfo() { X = DDUtils.Random.Real() * DDConsts.Screen_W, Y = -10.0, R = r, XAdd = DDUtils.Random.Real() * -3.0, YAdd = r * 1.5, } .Task ); } this.Snows.ExecuteAllTask(); yield return(true); } }
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(); } } } }
/// <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)); } }
private IEnumerable <bool> E_DrawPiace(DrawPosInfo drawPos_1, DrawPosInfo drawPos_2, int frameMax) { foreach (DDScene scene in DDSceneUtils.Create(frameMax)) { double scRate = DDUtils.SCurve(scene.Rate); double x = GameConsts.FIELD_L + DDUtils.AToBRate(drawPos_1.X, drawPos_2.X, scRate); double y = GameConsts.FIELD_T + DDUtils.AToBRate(drawPos_1.Y, drawPos_2.Y, scRate); double rot = DDUtils.AToBRate(drawPos_1.Rot, drawPos_2.Rot, scRate); DDDraw.DrawBegin(this.Picture, x, y); DDDraw.DrawRotate(rot); DDDraw.DrawEnd(); yield return(true); } }
private IEnumerable <bool> Walk(double x) { double currX = this.X; double destX = x; double currY = this.Y; Action a_flush = () => { this.X = destX; this.Y = currY; }; const int STEP_NUM = 3; const double Y_SPAN = 10.0; for (int step = 0; step < STEP_NUM; step++) { foreach (DDScene scene in DDSceneUtils.Create(15)) { if (NovelAct.IsFlush) { a_flush(); yield break; } this.X = DDUtils.AToBRate(currX, destX, ((step * 2 + 0) + scene.Rate) / (STEP_NUM * 2)); this.Y = currY + Y_SPAN * (1.0 - DDUtils.Parabola(scene.Rate * 0.5 + 0.5)); this.P_Draw(); yield return(true); } foreach (DDScene scene in DDSceneUtils.Create(15)) { if (NovelAct.IsFlush) { a_flush(); yield break; } this.X = DDUtils.AToBRate(currX, destX, ((step * 2 + 1) + scene.Rate) / (STEP_NUM * 2)); this.Y = currY + Y_SPAN * (1.0 - DDUtils.Parabola(scene.Rate * 0.5 + 0.0)); this.P_Draw(); yield return(true); } } }
private IEnumerable <bool> E_Move(double sx, double sy, double dx, double dy, double sRot, double dRot) { foreach (DDScene scene in DDSceneUtils.Create(DDUtils.Random.GetRange(20, 60))) { DDDraw.SetBright(_color); DDDraw.DrawBegin( Ground.I.Picture.WhiteBox, DDUtils.AToBRate(sx, dx, DDUtils.SCurve(scene.Rate)), DDUtils.AToBRate(sy, dy, DDUtils.SCurve(scene.Rate)) ); DDDraw.DrawSetSize(TILE_W, TILE_H); DDDraw.DrawRotate(DDUtils.AToBRate(sRot, dRot, DDUtils.SCurve(scene.Rate))); DDDraw.DrawEnd(); DDDraw.Reset(); yield return(true); } }
public override void Draw() { if (this.ImageIndex == -1) { throw new DDError("画像を指定して下さい。"); } DDUtils.Approach(ref this.CurrDrawPosRate, this.DestDrawPosRate, 0.99995); D2Point lt = DDUtils.AToBRate(this.ImageLTStart, this.ImageLTEnd, this.CurrDrawPosRate); DDDraw.DrawRect( this.Images[this.ImageIndex], lt.X, lt.Y, this.ImageDrawSize.W, this.ImageDrawSize.H ); }
public override void Draw() { if (!EnemyCommon.IsOutOfScreen_ForDraw(this)) { double p = Math.Sin(DDEngine.ProcFrame / 10.0 + this.X + this.Y) * 0.5 + 0.5; // color phaese DDDraw.SetBright(new I3Color( SCommon.ToInt(DDUtils.AToBRate(Game.I.Map.Design.EnemyColor_Death_A.R, Game.I.Map.Design.EnemyColor_Death_B.R, p)), SCommon.ToInt(DDUtils.AToBRate(Game.I.Map.Design.EnemyColor_Death_A.G, Game.I.Map.Design.EnemyColor_Death_B.G, p)), SCommon.ToInt(DDUtils.AToBRate(Game.I.Map.Design.EnemyColor_Death_A.B, Game.I.Map.Design.EnemyColor_Death_B.B, p)) )); DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, SCommon.ToInt(this.X - DDGround.ICamera.X), SCommon.ToInt(this.Y - DDGround.ICamera.Y)); DDDraw.DrawSetSize(GameConsts.TILE_W, GameConsts.TILE_H); DDDraw.DrawEnd(); DDDraw.Reset(); this.Crash = DDCrashUtils.Rect_CenterSize(new D2Point(this.X, this.Y), new D2Size(GameConsts.TILE_W, GameConsts.TILE_H)); //Game.I.タイル接近_敵描画_Points.Add(new D2Point(this.X, this.Y)); // 地形の一部なので、追加しない。 } }
private IEnumerable <bool> スライド(double x, double y) { double currX = this.X; double destX = x; double currY = this.Y; double destY = y; foreach (DDScene scene in DDSceneUtils.Create(30)) { if (NovelAct.IsFlush) { this.X = destX; this.Y = destY; break; } this.X = DDUtils.AToBRate(currX, destX, DDUtils.SCurve(scene.Rate)); this.Y = DDUtils.AToBRate(currY, destY, DDUtils.SCurve(scene.Rate)); this.P_Draw(); yield return(true); } }
private void P_Draw() { if (FRAME_MAX < this.Frame) { Game.I.Enemies.Add(new Enemy_B0003(this.DestX, this.DestY)); this.DeadFlag = true; } if (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), 50.0)) { double x = DDUtils.AToBRate(this.X, this.DestX, DDUtils.SCurve(this.Frame * 1.0 / FRAME_MAX)); double y = DDUtils.AToBRate(this.Y, this.DestY, DDUtils.SCurve(this.Frame * 1.0 / FRAME_MAX)); DDDraw.SetBright(1.0, 0.0, 0.0); DDDraw.DrawBegin(Ground.I.Picture.Enemy_B0003, x - DDGround.ICamera.X, y - DDGround.ICamera.Y); DDDraw.DrawRotate(this.Frame * 10.0 / FRAME_MAX); DDDraw.DrawEnd(); DDDraw.Reset(); this.Crash = DDCrashUtils.Circle(new D2Point(x, y), 50.0); } this.Frame++; }
protected override IEnumerable <bool> E_Draw() { #if true foreach (DDScene scene in DDSceneUtils.Create(60)) { this.Crash = DDCrashUtils.Rect(D4Rect.LTRB( 0, DDUtils.AToBRate(GameConsts.FIELD_H - 30.0, -30.0, scene.Rate), GameConsts.FIELD_W, GameConsts.FIELD_H )); yield return(true); } #else // シンプル for (int c = 0; c < 10; c++) { this.Crash = DDCrashUtils.Rect(new D4Rect(0, 0, GameConsts.FIELD_W, GameConsts.FIELD_H)); yield return(true); } #endif }
private IEnumerable <bool> E_UpdateTarget() { const double MARGIN = 50.0; const int FRAME_MAX = 100; for (; ;) { foreach (DDScene scene in DDSceneUtils.Create(FRAME_MAX)) { this.Target_X = MARGIN; this.Target_Y = DDUtils.AToBRate(MARGIN, GameConsts.FIELD_H - MARGIN, scene.Rate); yield return(true); } foreach (DDScene scene in DDSceneUtils.Create(FRAME_MAX)) { this.Target_X = DDUtils.AToBRate(MARGIN, GameConsts.FIELD_W - MARGIN, scene.Rate); this.Target_Y = GameConsts.FIELD_H - MARGIN; yield return(true); } foreach (DDScene scene in DDSceneUtils.Create(FRAME_MAX)) { this.Target_X = GameConsts.FIELD_W - MARGIN; this.Target_Y = DDUtils.AToBRate(GameConsts.FIELD_H - MARGIN, MARGIN, scene.Rate); yield return(true); } foreach (DDScene scene in DDSceneUtils.Create(FRAME_MAX)) { this.Target_X = DDUtils.AToBRate(GameConsts.FIELD_W - MARGIN, MARGIN, scene.Rate); this.Target_Y = MARGIN; yield return(true); } } }
private void 基本設定() { DDSE[] seSamples = new DDSE[] { Ground.I.SE.Poka01, Ground.I.SE.Poka02, }; DDEngine.FreezeInput(); for (; ;) { // ==== // 入力判定ここから // ==== if ( DDInput.A.GetInput() == 1 || DDInput.B.GetInput() == 1 || DDMouse.R.GetInput() == -1 ) { this.Mode = Mode_e.END; break; } if (DDMouse.L.GetInput() == -1) { if (this.GetTabTitleCrash_拡張設定().IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y)))) { this.Mode = Mode_e.拡張設定; break; } if (this.LastHoveringButton == Ground.I.Picture.SettingButton_フルスクリーン) { DDMain.SetFullScreen(); } if (this.LastHoveringButton == Ground.I.Picture.SettingButton_ウィンドウ) { const int def_screen_w = DDConsts.Screen_W / 2; const int def_screen_h = DDConsts.Screen_H / 2; DDMain.SetScreenSize(def_screen_w, def_screen_h); } if (this.LastHoveringButton == Ground.I.Picture.SettingButton_デフォルトに戻す) { this.デフォルトに戻す(); } if (this.LastHoveringButton == Ground.I.Picture.SettingButton_戻る) { this.Mode = Mode_e.END; break; } } // ==== // 入力判定ここまで // ==== // ==== // 描画ここから // ==== this.BeforeDrawContents(); DDDraw.DrawSimple(Ground.I.Picture.基本設定枠, 0, 0); this.DrawTabTitles(false); this.DrawPrompt(100, 250, "画面モード"); this.DrawPrompt(100, 380, "BGM音量"); this.DrawPrompt(100, 510, "SE音量"); this.DrawPrompt(100, 640, "メッセージ表示速度"); this.DrawPrompt(100, 770, "メッセージウィンドウ透明度"); bool fullScreenFlag = DDGround.RealScreen_W == DDGround.MonitorRect.W && DDGround.RealScreen_H == DDGround.MonitorRect.H; this.DrawButton(1100, 280, Ground.I.Picture.SettingButton_フルスクリーン, fullScreenFlag); this.DrawButton(1550, 280, Ground.I.Picture.SettingButton_ウィンドウ, !fullScreenFlag); this.DrawTrackBar(1325, 410, "小", "大", DDGround.MusicVolume, volume => { DDGround.MusicVolume = volume; DDMusicUtils.UpdateVolume(); }); this.DrawTrackBar(1325, 540, "小", "大", DDGround.SEVolume, volume => { DDGround.SEVolume = volume; //DDSEUtils.UpdateVolume(); // v_20210215 -- メソッド終了時に全て更新する。 foreach (DDSE se in seSamples) { se.UpdateVolume(); } }, () => { DDUtils.Random.ChooseOne(seSamples).Play(); }); this.DrawTrackBar(1325, 670, "遅い", "速い", DDUtils.RateAToB(GameConsts.MESSAGE_SPEED_MIN, GameConsts.MESSAGE_SPEED_MAX, Ground.I.MessageSpeed), value => Ground.I.MessageSpeed = SCommon.ToInt( DDUtils.AToBRate(GameConsts.MESSAGE_SPEED_MIN, GameConsts.MESSAGE_SPEED_MAX, value) ) ); this.DrawTrackBar(1325, 800, "透明", "不透明", DDUtils.RateAToB(0, 100, Ground.I.MessageWindow_A_Pct), value => Ground.I.MessageWindow_A_Pct = SCommon.ToInt( DDUtils.AToBRate(0, 100, value) ) ); this.DrawUnderButtons(); // ==== // 描画ここまで // ==== DDEngine.EachFrame(); } DDEngine.FreezeInput(); DDSEUtils.UpdateVolume(); // v_20210215 }
public override void DrawTile(MapCell cell, int cell_x, int cell_y, double draw_x, double draw_y) { if (cell.Kind == MapCell.Kind_e.WALL || cell.IsCookie()) { // cell.敵接近_Rate 更新 { double rate = GetEnemyNearlyRate( DDGround.Camera.X + draw_x, DDGround.Camera.Y + draw_y ); DDUtils.Maxim(ref cell.敵接近_Rate, rate); cell.敵接近_Rate *= 0.97; } double p = cell.ColorPhase; if (this.市松tic) { if ((cell_x + cell_y) % 2 == 0) { p = p * 0.7; } else { p = p * 0.3 + 0.7; } } //DDDraw.SetAlpha(0.9 - cell.敵接近_Rate * 0.6); // old DDDraw.SetAlpha(this.WallAlpha * (1.0 - cell.敵接近_Rate * 0.5)); DDDraw.SetBright(new I3Color( SCommon.ToInt(DDUtils.AToBRate(this.Color_A.R, this.Color_B.R, p)), SCommon.ToInt(DDUtils.AToBRate(this.Color_A.G, this.Color_B.G, p)), SCommon.ToInt(DDUtils.AToBRate(this.Color_A.B, this.Color_B.B, p)) )); DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, draw_x, draw_y); DDDraw.DrawSetSize(GameConsts.TILE_W, GameConsts.TILE_H); DDDraw.DrawEnd(); DDDraw.Reset(); if (cell.IsCookie()) { DDDraw.SetBright(this.CookieAxisColor); DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, draw_x, draw_y); DDDraw.DrawSetSize(GameConsts.TILE_W / 2, GameConsts.TILE_H / 2); DDDraw.DrawEnd(); DDDraw.Reset(); } } else if (cell.Kind == MapCell.Kind_e.GOAL) { //double bright = // Math.Sin(DDEngine.ProcFrame / 37.0) * 0.3 + // Math.Sin(DDEngine.ProcFrame / 0.7) * 0.1 + // 0.6; double bright = Math.Sin(DDEngine.ProcFrame / 13.0) * 0.4 + 0.6; DDDraw.SetBright( bright * 0.5, bright * 0.9, bright * 1.0 ); DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, draw_x, draw_y); DDDraw.DrawSetSize(GameConsts.TILE_W, GameConsts.TILE_H); DDDraw.DrawEnd(); DDDraw.Reset(); } }