Ejemplo n.º 1
0
    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);
        }
    }
Ejemplo n.º 2
0
    void CBDestroy()
    {
        TestShooter ts = TestShooter.instance;

        switch (ts.gameMode)
        {
        case TestShooter.GameMode.BulletHell: DestroyBH(); break;

        case TestShooter.GameMode.Exception: DestroyEX(); break;
        }
    }
Ejemplo n.º 3
0
    void Update()
    {
        ++frame;

        TestShooter ts = TestShooter.instance;

        switch (ts.gameMode)
        {
        case TestShooter.GameMode.BulletHell: UpdateBH(); break;

        case TestShooter.GameMode.Exception: UpdateEX(); break;
        }
    }
Ejemplo n.º 4
0
    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);
        }
    }
Ejemplo n.º 5
0
    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);
    }
Ejemplo n.º 6
0
    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);
    }
Ejemplo n.º 7
0
    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);
        }
    }
Ejemplo n.º 8
0
    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); });
        }
    }
Ejemplo n.º 9
0
    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);
        }
    }
Ejemplo n.º 10
0
 void OnDisable()
 {
     instance = null;
 }
Ejemplo n.º 11
0
 void OnEnable()
 {
     instance = this;
 }
Ejemplo n.º 12
0
 void OnEnable()
 {
     instance = this;
 }
Ejemplo n.º 13
0
 void OnDisable()
 {
     instance = null;
 }