protected override void OnRegistered() { int width = Program.ObjWidth; GameLayer.AddObject(new Goal(new asd.Vector2DF(23 * width, 16 * width))); Random r = new Random(); Random rand = new Random(); //重複なし乱数配列生成 int[] array = new int[16]; for (int i = 0; i < 16; i++) { array[i] = i; } for (int i = 0; i < 16; i++) { int x = r.Next(16); int t = array[i]; array[i] = array[x]; array[x] = t; } for (int i = 2; i < 23; i++) { for (int j = 0; j < 16; j++) { int p = rand.Next(10); if (p == 0) { GameLayer.AddObject(new EnemyYellow(new asd.Vector2DF(width * i, width * array[j] + width))); } if (p == 1) { GameLayer.AddObject(new EnemyRed(new asd.Vector2DF(width * i, width * array[j] + width))); } if (p == 2) { GameLayer.AddObject(new WhiteWall(new asd.Vector2DF(width * i, width * array[j] + width))); } if (p == 3) { ; GameLayer.AddObject(new YellowWall(new asd.Vector2DF(width * i, width * array[j] + width))); } if (p == 4) { GameLayer.AddObject(new WhiteWall(new asd.Vector2DF(width * i, width * array[j] + width))); } if (p == 5) { GameLayer.AddObject(new EnemyWhite(new asd.Vector2DF(width * i, width * array[j] + width))); } else { //何も作らない } } } GameLayer.AddObject(new Explain(new asd.Vector2DF(Program.WindowSizeX - Program.ObjWidth * 3.5f, Program.WindowSizeY / 2))); GameLayer.AddObject(new Player(new asd.Vector2DF(width, 10 * width))); }
protected override void OnRegistered() { GameLayer.AddObject(new Goal(new asd.Vector2DF(23 * CellLarge, 10 * CellLarge))); Random r = new Random(); Random rand = new Random(); //重複なし乱数配列生成 int[] array = new int[16]; for (int i = 0; i < 16; i++) { array[i] = i; } for (int i = 0; i < 16; i++) { int x = r.Next(16); int t = array[i]; array[i] = array[x]; array[x] = t; } for (int i = 2; i < 23; i++) { for (int j = 0; j < 16; j++) { int p = rand.Next(13); if (p == 0 || p == 1) { GameLayer.AddObject(new YellowWall(new asd.Vector2DF(CellLarge * i, CellLarge * array[j] + CellLarge))); } if (p == 2 || p == 3) { GameLayer.AddObject(new WhiteWall(new asd.Vector2DF(CellLarge * i, CellLarge * array[j] + CellLarge))); } if (p == 4 || p == 5) { GameLayer.AddObject(new EnemyWhite(new asd.Vector2DF(CellLarge * i, CellLarge * array[j] + CellLarge))); } if (p == 6 || p == 7) { GameLayer.AddObject(new EnemyYellow(new asd.Vector2DF(CellLarge * i, CellLarge * array[j] + CellLarge))); } } } GameLayer.AddObject(new Player(new asd.Vector2DF(CellLarge, 10 * CellLarge))); }
private void updateStage() { if (EnemyQueues[Stage].Count > 0 && Stage < 10) { if (Gamecount % DequeueCount == 0 && Gamecount > RestCount) { IsStageMoving = true; GameLayer.AddObject(EnemyQueues[Stage].Dequeue()); } } else if (EnemyQueues[Stage].Count == 0 && EnemyExists == false) { IsStageMoving = false; Stage++; StageText.Text = ("Stage" + Stage); if (Stage == 10 && !IsSceneChanging) { if (PlayingBgmId.HasValue) { asd.Engine.Sound.FadeOut(PlayingBgmId.Value, 1.0f); PlayingBgmId = null; } IsSceneChanging = true; IsClear = true; asd.Engine.ChangeSceneWithTransition(new ClearScene(), new asd.TransitionFade(1, 1)); } if (!(TitleScene.EasyMode)) { switch (Stage) { case 1: DequeueCount = 90; break; case 2: DequeueCount = 70; break; case 3: DequeueCount = 50; break; case 4: DequeueCount = 40; break; case 5: DequeueCount = 35; break; case 6: DequeueCount = 30; break; case 7: DequeueCount = 30; break; case 8: DequeueCount = 20; break; case 9: DequeueCount = 20; break; } } Gamecount = 0; } ++Gamecount; if (Gamecount > 100000) { Gamecount = 0; } }
protected override void OnUpdated() { ClickSystem.Create();//クリックでUnit作成 if (TitleScene.HardMode) { if (Gamecount % 188 == 0 && Gamecount > 0) { switch (Stage) { case 0: case 1: case 2: GameLayer.AddObject(new EnemyGreen(new asd.Vector2DF(Rand.Next(0, 12) * 50 + 25, 0))); break; case 3: case 4: case 5: GameLayer.AddObject(new EnemyPink(new asd.Vector2DF(Rand.Next(0, 12) * 50 + 25, 0))); break; case 6: case 7: GameLayer.AddObject(new EnemyBlue(new asd.Vector2DF(Rand.Next(7, 12) * 50 + 25, 0))); break; case 8: GameLayer.AddObject(new EnemyBlue(new asd.Vector2DF(Rand.Next(7, 12) * 50 + 25, 0))); GameLayer.AddObject(new EnemyBlue(new asd.Vector2DF(Rand.Next(0, 12) * 50 + 25, 0))); break; case 9: GameLayer.AddObject(new EnemyRed(new asd.Vector2DF(Rand.Next(0, 4) * 50 + 25, 0))); GameLayer.AddObject(new EnemyOrange(new asd.Vector2DF(Rand.Next(5, 8) * 50 + 25, 0))); GameLayer.AddObject(new EnemyBlue(new asd.Vector2DF(Rand.Next(8, 12) * 50 + 25, 0))); break; } } } if (IsClear == false) { if (!PlayingBgmId.HasValue) { MusicCount++; } if (MusicCount == 120) { PlayingBgmId = asd.Engine.Sound.Play(BGM); asd.Engine.Sound.SetVolume((int)PlayingBgmId, 0.2f); asd.Engine.Sound.SetIsPlaybackSpeedEnabled((int)PlayingBgmId, true); MusicCount = 0; } //最大HPが20%を切ったらBPMを上げる if (PlayerHP.HP <= PlayerHP.MaxHP / 5 && PlayingBgmId.HasValue) { asd.Engine.Sound.SetPlaybackSpeed((int)PlayingBgmId, 1.5f); } else if (PlayerHP.HP > PlayerHP.MaxHP / 5 && PlayingBgmId.HasValue) { asd.Engine.Sound.SetPlaybackSpeed((int)PlayingBgmId, 1.0f); } if (PlayerHP.HP <= 0 && !IsSceneChanging) { IsSceneChanging = true; if (PlayingBgmId.HasValue) { asd.Engine.Sound.FadeOut(PlayingBgmId.Value, 0.5f); PlayingBgmId = null; } asd.Engine.Sound.SetVolume(asd.Engine.Sound.Play(GameOverSound), 0.2f); asd.Engine.ChangeSceneWithTransition(new GameOverScene(), new asd.TransitionFade(1, 1)); } EnemyCheck(); updateStage(); switch (ClickSystem.ClickedNumber) { case 0: UnitText.Text = Status.Instance.SnowmanStatus.Name + "\n" + Status.Instance.SnowmanStatus.Comment + "\n物理攻撃," + Snowman.AttackST + " 体力," + Snowman.MAXHPST + " コスト," + Snowman.CostST; break; case 1: UnitText.Text = Status.Instance.KaneStatus.Name + "\n" + Status.Instance.KaneStatus.Comment + "\n物理攻撃," + Kane.AttackST + " 体力," + Kane.MAXHPST + " コスト," + Kane.CostST; break; case 2: UnitText.Text = Status.Instance.DogStatus.Name + "\n" + Status.Instance.DogStatus.Comment + "\n物理攻撃," + Dog.AttackST + " 体力," + Dog.MAXHPST + " 生成コスト," + Dog.CostST + "\n弾威力," + Dog.BulletATK + " 攻撃範囲," + Dog.maxrangeST; break; case 3: UnitText.Text = Status.Instance.StrongDogStatus.Name + "\n" + Status.Instance.StrongDogStatus.Comment + "\n物理攻撃," + StrongDog.AttackST + " 体力," + StrongDog.MAXHPST + " 生成コスト," + StrongDog.CostST + "\n弾威力," + StrongDog.BulletATK + " 攻撃範囲," + StrongDog.MaxRangeST; break; case 4: UnitText.Text = Status.Instance.HumanStatus.Name + "\n" + Status.Instance.HumanStatus.Comment + "\n物理攻撃," + Human.AttackST + " 体力," + Human.MAXHPST + " 生成コスト," + Human.CostST + "\n弾威力," + Human.BulletATK; break; case 5: UnitText.Text = Status.Instance.StronghumanStatus.Name + "\n" + Status.Instance.StronghumanStatus.Comment + "\n物理攻撃," + Human3Way.AttackST + " 体力," + Human3Way.MAXHPST + " 生成コスト," + Human3Way.CostST + "\n弾威力," + Human3Way.BulletATK; break; case 6: UnitText.Text = Status.Instance.KinokoStatus.Name + "\n" + Status.Instance.KinokoStatus.Comment + "\n物理攻撃," + Kinoko.AttackST + " 体力," + Kinoko.MAXHPST + " 生成コスト," + Kinoko.CostST + "\n回復範囲," + Kinoko.MaxRangeST; break; case 7: UnitText.Text = Status.Instance.PoisonKinokoStatus.Name + "\n" + Status.Instance.PoisonKinokoStatus.Comment + "\n物理攻撃," + PoisonKinoko.AttackST + " 体力," + PoisonKinoko.MAXHPST + " 生成コスト," + PoisonKinoko.CostST + "\n攻撃範囲," + PoisonKinoko.MaxRangeST; break; case 8: UnitText.Text = Status.Instance.KirakiraStatus.Name + "\n" + Status.Instance.KirakiraStatus.Comment + "\n物理攻撃," + Kirakira.AttackST + " 体力," + Kirakira.MAXHPST + " 生成コスト," + Kirakira.CostST; break; case 9: UnitText.Text = Status.Instance.HanaStatus.Name + "\n" + Status.Instance.HanaStatus.Comment + "\n物理攻撃," + Hana.attackST + " 体力," + Hana.MAXHPST + " 生成コスト," + Hana.CostST + "\n弾威力," + Hana.BulletATK; break; case 10: UnitText.Text = Status.Instance.WallStatus.Name + "\n" + Status.Instance.WallStatus.Comment + "\n物理攻撃," + Wall.AttackST + " 体力," + Wall.MAXHPST + " 生成コスト," + Wall.CostST; break; case 11: UnitText.Text = Status.Instance.StrongWallStatus.Name + "\n" + Status.Instance.StrongWallStatus.Comment + "\n物理攻撃," + StrongWall.AttackST + " 体力," + StrongWall.MAXHPST + " 生成コスト," + StrongWall.CostST; break; } } }
/// <summary> /// 数字から物体へ /// </summary> /// <param name="pos">作り出す位置</param> /// <param name="makingNum"></param> protected void MakeSomething(asd.Vector2DF pos, int makingNum) { bool canMake = true; foreach (var obj in GameLayer.Objects) { if (obj.Position == pos && !(obj is Arrow)) { canMake = false; } //流れてくるのはArrowのみ else if (obj.Position == pos && EnemyToNum(obj) == makingNum) { canMake = false; } } if (canMake || makingNum == 100) { switch (makingNum) { case 0: GameLayer.AddObject(new EnemyRed(pos)); break; case 1: GameLayer.AddObject(new EnemyWhite(pos)); break; case 2: GameLayer.AddObject(new EnemyYellow(pos)); break; case 3: GameLayer.AddObject(new Wall(pos)); break; case 4: GameLayer.AddObject(new WhiteWall(pos)); break; case 5: GameLayer.AddObject(new YellowWall(pos)); break; case 6: GameLayer.AddObject(new UpArrow(pos)); break; case 7: GameLayer.AddObject(new RightArrow(pos)); break; case 8: GameLayer.AddObject(new DownArrow(pos)); break; case 9: GameLayer.AddObject(new LeftArrow(pos)); break; case 10: if (!IsPlayerExist && IsStageMaking) { GameLayer.AddObject(new PlayerTexture(pos)); IsPlayerExist = true; } else if (!IsPlayerExist && !IsStageMaking) { GameLayer.AddObject(new Player(pos)); IsPlayerExist = true; //ステージ生成時にplayerが2個生成されなくなる } break; case 11: if (!IsGoalExist) { GameLayer.AddObject(new Goal(pos)); IsGoalExist = true; } break; case 12: GameLayer.AddObject(new WarpZone(pos, pos)); break; case 100: foreach (var obj in GameLayer.Objects) { if (obj.Position == pos) { if (obj is PlayerTexture) { IsPlayerExist = false; } if (obj is Goal) { IsGoalExist = false; } obj.Dispose(); } } break; } } }
protected override void OnRegistered() { base.OnRegistered(); var arrayDown = new[] { new { x = 1, y = 4 }, new { x = 2, y = 4 }, new { x = 3, y = 4 }, new { x = 1, y = 8 }, new { x = 2, y = 8 }, new { x = 3, y = 8 }, new { x = 5, y = 4 }, new { x = 6, y = 4 }, new { x = 7, y = 4 }, new { x = 9, y = 4 }, new { x = 10, y = 4 }, new { x = 11, y = 4 }, new { x = 13, y = 4 }, new { x = 14, y = 4 }, new { x = 15, y = 4 } }; var arrayUp = new[] { new { x = 5, y = 12 }, new { x = 7, y = 12 }, new { x = 6, y = 12 }, new { x = 9, y = 12 }, new { x = 10, y = 12 }, new { x = 11, y = 12 }, new { x = 1, y = 12 }, new { x = 2, y = 12 }, new { x = 3, y = 12 }, new { x = 5, y = 8 }, new { x = 6, y = 8 }, new { x = 7, y = 8 }, new { x = 17, y = 8 }, new { x = 18, y = 8 }, new { x = 19, y = 8 }, new { x = 17, y = 12 }, new { x = 18, y = 12 }, new { x = 19, y = 12 }, new { x = 21, y = 4 }, new { x = 22, y = 4 }, new { x = 23, y = 4 } }; var arrayLeft = new[] { new { x = 8, y = 1 }, new { x = 8, y = 2 }, new { x = 8, y = 3 }, new { x = 12, y = 1 }, new { x = 12, y = 2 }, new { x = 12, y = 3 }, new { x = 12, y = 5 }, new { x = 12, y = 6 }, new { x = 12, y = 7 }, new { x = 12, y = 13 }, new { x = 12, y = 14 }, new { x = 12, y = 15 }, new { x = 12, y = 16 }, new { x = 16, y = 1 }, new { x = 16, y = 2 }, new { x = 16, y = 3 }, new { x = 16, y = 5 }, new { x = 16, y = 6 }, new { x = 16, y = 7 }, new { x = 20, y = 1 }, new { x = 20, y = 2 }, new { x = 20, y = 3 }, new { x = 20, y = 9 }, new { x = 20, y = 10 }, new { x = 20, y = 11 }, new { x = 20, y = 13 }, new { x = 20, y = 14 }, new { x = 20, y = 15 }, new { x = 20, y = 16 } }; var arrayRight = new[] { new { x = 4, y = 1 }, new { x = 4, y = 2 }, new { x = 4, y = 3 }, new { x = 4, y = 5 }, new { x = 4, y = 6 }, new { x = 4, y = 7 }, new { x = 4, y = 9 }, new { x = 4, y = 10 }, new { x = 4, y = 11 }, new { x = 8, y = 9 }, new { x = 8, y = 10 }, new { x = 8, y = 11 }, new { x = 12, y = 9 }, new { x = 12, y = 10 }, new { x = 12, y = 11 }, new { x = 16, y = 9 }, new { x = 16, y = 10 }, new { x = 16, y = 11 }, new { x = 20, y = 5 }, new { x = 20, y = 6 }, new { x = 20, y = 7 } }; var yellowWallArray = new[] { new { x = 13, y = 8 }, new { x = 14, y = 8 }, new { x = 15, y = 8 }, new { x = 17, y = 4 }, new { x = 18, y = 4 }, new { x = 19, y = 4 }, new { x = 21, y = 8 }, new { x = 22, y = 8 }, new { x = 23, y = 8 }, new { x = 21, y = 12 }, new { x = 22, y = 12 }, new { x = 23, y = 12 }, new { x = 8, y = 5 }, new { x = 8, y = 6 }, new { x = 8, y = 7 }, new { x = 8, y = 13 }, new { x = 8, y = 14 }, new { x = 8, y = 15 }, new { x = 8, y = 16 }, new { x = 16, y = 13 }, new { x = 16, y = 14 }, new { x = 16, y = 15 }, new { x = 16, y = 16 } }; var arrayWall = new[] { new { x = 4, y = 4 }, new { x = 8, y = 4 }, new { x = 12, y = 4 }, new { x = 16, y = 4 }, new { x = 20, y = 4 }, new { x = 4, y = 8 }, new { x = 8, y = 8 }, new { x = 12, y = 8 }, new { x = 16, y = 8 }, new { x = 20, y = 8 }, new { x = 4, y = 12 }, new { x = 8, y = 12 }, new { x = 12, y = 12 }, new { x = 16, y = 12 }, new { x = 20, y = 12 } }; var arrayWhiteWall = new[] { new { x = 9, y = 8 }, new { x = 10, y = 8 }, new { x = 11, y = 8 }, new { x = 4, y = 13 }, new { x = 4, y = 14 }, new { x = 4, y = 15 }, new { x = 4, y = 16 }, new { x = 13, y = 12 }, new { x = 14, y = 12 }, new { x = 15, y = 12 } }; var enemyWhiteArray = new[] { new { x = 10, y = 2 }, new { x = 22, y = 14 }, }; var enemyYellowArray = new[] { new { x = 2, y = 10 }, new { x = 18, y = 2 }, }; GameLayer.AddObject(new Goal(new asd.Vector2DF(14 * Width + Width / 2, 14 * Width + Width / 2))); foreach (var p in arrayDown) { GameLayer.AddObject(new DownArrow(new asd.Vector2DF(p.x * Width + Width / 2, p.y * Width + Width / 2))); } foreach (var p in arrayUp) { GameLayer.AddObject(new UpArrow(new asd.Vector2DF(p.x * Width + Width / 2, p.y * Width + Width / 2))); } foreach (var p in arrayLeft) { GameLayer.AddObject(new LeftArrow(new asd.Vector2DF(p.x * Width + Width / 2, p.y * Width + Width / 2))); } foreach (var p in arrayRight) { GameLayer.AddObject(new RightArrow(new asd.Vector2DF(p.x * Width + Width / 2, p.y * Width + Width / 2))); } foreach (var p in enemyWhiteArray) { GameLayer.AddObject(new EnemyWhite(new asd.Vector2DF(p.x * Width + Width / 2, p.y * Width + Width / 2))); } foreach (var p in enemyYellowArray) { GameLayer.AddObject(new EnemyYellow(new asd.Vector2DF(p.x * Width + Width / 2, p.y * Width + Width / 2))); } foreach (var p in arrayWhiteWall) { GameLayer.AddObject(new WhiteWall(new asd.Vector2DF(p.x * Width + Width / 2, p.y * Width + Width / 2))); } foreach (var p in yellowWallArray) { GameLayer.AddObject(new YellowWall(new asd.Vector2DF(p.x * Width + Width / 2, p.y * Width + Width / 2))); } foreach (var p in arrayWall) { GameLayer.AddObject(new Wall(new asd.Vector2DF(p.x * Width + Width / 2, p.y * Width + Width / 2))); } GameLayer.AddObject(new Player(new asd.Vector2DF(2 * Width + Width / 2, 2 * Width + Width / 2))); }