void Update() { MeshRenderer mr = GetComponent <MeshRenderer>(); mr.material.SetVector("_GlowColor", glowColor); Vector3 pos = transform.position; pos.x = 9.5f; pos.y = Mathf.Cos(Time.time * 0.5f) * 3.0f; transform.position = pos; TestShooter ts = TestShooter.instance; { //const int num = 52; const int num = 16; MPGPParticle[] additional = new MPGPParticle[num]; for (int i = 0; i < additional.Length; ++i) { additional[i].velocity = new Vector3(Random.Range(-2.0f, -0.5f), Random.Range(-1.0f, 1.0f), 0.0f) * 4.0f; additional[i].position = new Vector3(pos.x - 1.4f, pos.y, 0.0f) + additional[i].velocity * 0.1f; } ts.fractions.AddParticles(additional); } }
void CBDestroy() { TestShooter ts = TestShooter.instance; switch (ts.gameMode) { case TestShooter.GameMode.BulletHell: DestroyBH(); break; case TestShooter.GameMode.Exception: DestroyEX(); break; } }
void Update() { ++frame; TestShooter ts = TestShooter.instance; switch (ts.gameMode) { case TestShooter.GameMode.BulletHell: UpdateBH(); break; case TestShooter.GameMode.Exception: UpdateEX(); break; } }
void OnGUI() { TestShooter ts = TestShooter.instance; if (ts.gameMode == TestShooter.GameMode.Exception) { Color blue = Color.blue; blue.a = 0.25f; Matrix4x4 mat = blowMatrix * Matrix4x4.Scale(new Vector3(0.0f, 1.0f, 1.0f)); matLine.SetPass(0); DrawWireCube(mat, blue); } }
void DestroyEX() { TestShooter ts = TestShooter.instance; Vector3 pos = transform.position; if (particles_to_add == null) { particles_to_add = new MPGPParticle[512]; } for (int i = 0; i < particles_to_add.Length; ++i) { particles_to_add[i].position = new Vector3(pos.x + R(0.5f), pos.y + R(0.5f), pos.z + R(0.5f)); particles_to_add[i].velocity = new Vector3(R(), R(), 0.0f) * 2.0f; } ts.fractions.AddParticles(particles_to_add); }
void DestroyBH() { TestShooter ts = TestShooter.instance; Vector3 pos = transform.position; if (particles_to_add == null) { particles_to_add = new MPGPParticle[512]; } for (int i = 0; i < particles_to_add.Length; ++i) { particles_to_add[i].position = new Vector3(pos.x, pos.y, 0.0f); particles_to_add[i].velocity = new Vector3(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f), 0.0f) * 8.0f; } ts.fractions.AddParticles(particles_to_add); }
void CBDestroy() { TestShooter ts = TestShooter.instance; if (!ts) { return; } Vector3 pos = transform.position; for (int i = 0; i < 6; ++i) { Vector3 r = transform.rotation * new Vector3(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f)); Instantiate(enemySmallCube, pos + r, transform.rotation); } }
void Blow() { TestShooter ts = TestShooter.instance; if (ts.gameMode == TestShooter.GameMode.Exception) { Vector3 pos = trans.position; float strength = 2000.0f; CSForce force = new CSForce(); force.info.shape_type = CSForceShape.Box; force.info.dir_type = CSForceDirection.Radial; force.info.strength = strength; force.info.center = pos - (trans.forward * 6.0f); CSImpl.BuildBox(ref force.box, blowMatrix, Vector3.one); GPUParticleWorld.GetInstances().ForEach((t) => { t.AddForce(ref force); }); } }
void Shot() { TestShooter ts = TestShooter.instance; if (ts.gameMode == TestShooter.GameMode.BulletHell) { Vector3 pos = transform.position; Vector3 dir = transform.forward; MPGPParticle[] additional = new MPGPParticle[26]; for (int i = 0; i < additional.Length; ++i) { additional[i].position = pos + dir * 0.5f; additional[i].velocity = (dir + new Vector3(Random.Range(-0.5f, 0.5f), Random.Range(-0.5f, 0.5f), 0.0f)) * 10.0f; } ts.fractions.AddParticles(additional); } else if (ts.gameMode == TestShooter.GameMode.Exception) { Instantiate(playerBullet, trans.position + trans.forward.normalized * 1.0f, trans.rotation); } }
void OnDisable() { instance = null; }
void OnEnable() { instance = this; }
void OnEnable() { instance = this; }
void OnDisable() { instance = null; }