protected override IEnumerable <bool> E_Draw() { const double CHARA_R = 20.0; double ySpeed = 0.0; for (int frame = 0; ; frame++) { while (DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), CHARA_R)) // 画面外に居るときは休止する。 { yield return(true); } const double GRAVITY = 1.0; const double Y_SPEED_MAX = 10.0; this.Y += ySpeed; ySpeed += GRAVITY; ySpeed = Math.Min(ySpeed, Y_SPEED_MAX); if (GameCommon.壁処理(ref this.X, ref this.Y, new D2Point[] { new D2Point(0.0, CHARA_R) })) { ySpeed = 0.0; } const int FRAME_DIV = 200; int frameDiv = frame / FRAME_DIV; int frameMod = frame % FRAME_DIV; this.防御中 = frameDiv % 2 == 0; if (!this.防御中) { if ( frameMod == 20 || frameMod == 60 || frameMod == 100 ) { #if true int xSign = Game.I.Player.X < this.X ? -1 : 1; Game.I.Enemies.Add(new Enemy_弾(this.X, this.Y, 3.5 * xSign, -3.5)); Game.I.Enemies.Add(new Enemy_弾(this.X, this.Y, 5.0 * xSign, 0.0)); Game.I.Enemies.Add(new Enemy_弾(this.X, this.Y, 3.5 * xSign, 3.5)); #else Game.I.Enemies.Add(Enemy_弾.Create自機狙い(this.X, this.Y, 5.0, -0.3)); Game.I.Enemies.Add(Enemy_弾.Create自機狙い(this.X, this.Y, 5.0)); Game.I.Enemies.Add(Enemy_弾.Create自機狙い(this.X, this.Y, 5.0, 0.3)); #endif } } //if (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), CHARA_R * 1.2)) // 画面外は休止 { // 暫定_描画 { DDDraw.SetBright(this.防御中 ? new I3Color(64, 192, 64) : new I3Color(255, 128, 128)); 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(); DDDraw.Reset(); DDPrint.SetDebug((int)this.X - DDGround.ICamera.X, (int)this.Y - DDGround.ICamera.Y); DDPrint.SetBorder(new I3Color(0, 0, 0)); DDPrint.Print(string.Format("[メット◆ル_{0}_{1}]", this.HP, this.防御中 ? "防" : "攻")); DDPrint.Reset(); } this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), CHARA_R); } yield return(true); } }
protected override IEnumerable <bool> E_Draw() { const double CHARA_R = 20.0; double ySpeed = 0.0; for (; ;) { if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X - CHARA_R, this.Y))).Tile.IsWall()) // ? 左側面接触 { this.FacingLeft = false; } if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X + CHARA_R, this.Y))).Tile.IsWall()) // ? 右側面接触 { this.FacingLeft = true; } if (this.端から落ちない) { const double 判定_X = 10.0; const double 判定_Y = CHARA_R + 1.0; if (!Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X - 判定_X, this.Y + 判定_Y))).Tile.IsWall()) // ? 左下足場無し -> 引き返す。 { this.FacingLeft = false; } if (!Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X + 判定_X, this.Y + 判定_Y))).Tile.IsWall()) // ? 右下足場なし -> 引き返す。 { this.FacingLeft = true; } } const double X_SPEED = 1.0; const double GRAVITY = 0.5; const double Y_SPEED_MAX = 10.0; this.X += X_SPEED * (this.FacingLeft ? -1 : 1); this.Y += ySpeed; ySpeed += GRAVITY; ySpeed = Math.Min(ySpeed, Y_SPEED_MAX); if (GameCommon.壁処理(ref this.X, ref this.Y, new D2Point[] { new D2Point(0.0, CHARA_R) })) { ySpeed = 0.0; } if (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), CHARA_R * 1.2)) { // 暫定_描画 { DDDraw.SetBright(new I3Color(64, 64, 255)); 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(); DDDraw.Reset(); DDPrint.SetPrint((int)this.X - DDGround.ICamera.X, (int)this.Y - DDGround.ICamera.Y); DDPrint.SetBorder(new I3Color(0, 0, 0)); DDPrint.Print("[ノコ◆コ_" + this.HP + "_" + (this.端から落ちない ? 1 : 0) + "]"); DDPrint.Reset(); } this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), CHARA_R); } yield return(true); } }