public void shoottama(Uchikata shootpatterni, List<Texture2D> tamatextureList, List<Tama> tamaList, int shoottamatexturei, Color color, List<SoundEffect> soundeffectList) { int i; Vector2 ichi; ichi = new Vector2(); switch (shootpatterni) { //打ち方,玉をうつタイミング(t,sw),いくつ,どこにどのようにうつか(shootingpatterni) case Uchikata.ShitaMassugu://まっすぐ if (t % (105 - level) == 0) { soundeffectList[6].Play(); makeTama(setTamaP(tamatextureList[shoottamatexturei], 0, size.Y / 2), new Vector2(0, 4), shoottamatexturei, tamaList, tamatextureList, 0, 2, color); } break; case Uchikata.HayaiShitaMassugu://速いまっすぐ if (t % (105 - level) == 0) { soundeffectList[7].Play(); makeTama(setTamaP(tamatextureList[shoottamatexturei], 0, size.Y / 2), new Vector2(0, 8), shoottamatexturei, tamaList, tamatextureList, 0, 2, color); } break; case Uchikata.SanWay://3way if (t % (105 - level) == 0) { soundeffectList[8].Play(); for (i = 0; i < 3; i++) { ichi = setTamaP(tamatextureList[shoottamatexturei], -60 + i * 60, 50); makeTama(ichi, new Vector2(2 - 2 * i, 4), 2, tamaList, tamatextureList, 0, 2, color); } } break; case Uchikata.HayaiSanWay://速い3way if (t % (105 - level) == 0) { soundeffectList[9].Play(); for (i = 0; i < 3; i++) { ichi = setTamaP(tamatextureList[shoottamatexturei], -60 + i * 60, 50); makeTama(ichi, new Vector2(2 - 2 * i, 8), 2, tamaList, tamatextureList, 0, 2, color); } } break; case Uchikata.Jikinerai://自機狙い if (t % (105 - level) == 0) { soundeffectList[10].Play(); makeTama(setTamaP(tamatextureList[shoottamatexturei], 0, size.Y / 2), new Vector2(0, 2), shoottamatexturei, tamaList, tamatextureList, 1, 2, color); } break; case Uchikata.HayaiJikinerai://速い自機狙い if (t % (105 - level) == 0) { soundeffectList[11].Play(); makeTama(setTamaP(tamatextureList[shoottamatexturei], 0, size.Y / 2), new Vector2(0, 4), shoottamatexturei, tamaList, tamatextureList, 1, 2, color); } break; case Uchikata.Ransya://乱射 if (t % 10 == 0) { soundeffectList[12].Play(); makeTama(setTamaP(tamatextureList[shoottamatexturei], 0, size.Y / 2), new Vector2(4 - cRandom.Next(8), cRandom.Next(4) + 1), shoottamatexturei, tamaList, tamatextureList, 0, 2, color); } break; case Uchikata.JikineraiRansya://自機狙い乱射 if (cRandom.Next(50) == 0) { soundeffectList[13].Play(); makeTama(setTamaP(tamatextureList[shoottamatexturei], 0, size.Y / 2), new Vector2(0, 2), shoottamatexturei, tamaList, tamatextureList, 1, 2, color); } break; case Uchikata.Zenhoi://全方位 if (t % 100 == 0) { soundeffectList[14].Play(); Vector2 v = new Vector2(0, 0); Vector2 p = new Vector2(0, 0); for (i = 0; i < level; i++) { p = setTamaP(tamatextureList[shoottamatexturei], i * (360 / level), size.Y / 2 + size.Length()); v.X = p.X - (position.X + size.X / 2); v.Y = p.Y - (position.Y + size.Y / 2); v.Normalize(); v *= 2; makeTama(setTamaP(tamatextureList[shoottamatexturei], i * (360 / level), size.Y / 2 + 50), v, shoottamatexturei, tamaList, tamatextureList, 0, 2, color); } } break; default: break; } }
/// <summary> /// 敵のコンストラクタ /// </summary> /// <param name="setposi">敵の初期位置</param> /// <param name="settexture">敵のテクスチャ</param> /// <param name="setsize">敵のサイズ</param> /// <param name="enemynum">敵のテクスチャの種類番号</param> /// <param name="ugokinum">うごきの番号</param> /// <param name="es">敵のステータスクラスHP, speed, haveItem, scoreをもつ</param> /// <param name="setshootpatterni">弾道,玉の出し方</param> /// <param name="setshoottamai">打つ球のテクスチャの種類番号</param> public Enemy(Vector2 setposi, Texture2D settexture, Vector2 setsize, int enemynum, int ugokinum, EnemyStatus es, int sethaveitem, Uchikata setshootpatterni, int setshoottamatexturei) { position = new Vector2(setposi.X, setposi.Y); texture = settexture; //うまくいかなかったらここ size = new Vector2(setsize.X, setsize.Y); HP = es.HP; subayasa = es.subayasa; exist = true; shokiposi = setposi; haveitem = sethaveitem; status = 1; enemyn = enemynum; ugokin = ugokinum; score = es.score; sw1 = new Stopwatch(); swforstatus = new Stopwatch(); shootpatterni = setshootpatterni; shoottamatexturei= setshoottamatexturei; t = 0; ugokiflag1 = true; level = 1; AP = es.AP; haittaflg = false; speed.X = subayasa; speed.Y = subayasa; hansyaflg = false; }
public void setUchikata(Uchikata u) { shootpatterni = u; return; }
/// <summary> /// 面に敵を配置する. /// pos: /// 最初に配置される位置 /// enenum: /// 0:スイカ 1:メロン 2:金魚 /// kidounum: /// 機の軌道 0:静止 1:→ 2:← 3:↘ 4:↙ 5:↓ 6:↑ 7:↓静止↑ 8:→← 9:←→ 10:↓←↑ 11:↓→↑ 12:自機狙い /// shootpattern: /// 弾の打ち方 0:まっすぐ前に 1:まっすぐ前に速く 2:3way 3:速い3way 4:自機狙い 5:速い自機狙い /// tamasyurui: /// 0:緑の弾 1:青い弾 /// </summary> /// <param name="pos"></param> /// <param name="enenum">0:スイカ 1:メロン 2:金魚</param> /// <param name="kidounum">機の軌道 0:静止 1:→ 2:← 3:↘ 4:↙ 5:↓ 6:↑ 7:↓静止↑ 8:→← 9:←→ 10:↓←↑ 11:↓→↑ 12:自機狙い</param> /// <param name="shootpattern">弾の打ち方 0:まっすぐ前に 1:まっすぐ前に速く 2:3way 3:速い3way 4:自機狙い 5:速い自機狙い</param> /// <param name="tamasyurui"></param> void makeEnemy(Vector2 pos, int enenum, int kidounum, Uchikata shootpattern, int tamasyurui, int haveitem) { Enemy ene = new Enemy(pos, enemyTextureList[enenum], new Vector2(enemyTextureList[enenum].Width, enemyTextureList[enenum].Height), enenum, kidounum, enemyStatusList[enenum], haveitem, shootpattern, tamasyurui); EnemyList.Add(ene); }