Exemplo n.º 1
0
 void EachTargets(System.Action <GPUParticleWorld> a)
 {
     if (m_targets.Length == 0)
     {
         GPUParticleWorld.GetInstances().ForEach(a);
     }
     else
     {
         foreach (var t in m_targets)
         {
             a(t);
         }
     }
 }
Exemplo n.º 2
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); });
        }
    }
Exemplo n.º 3
0
    void Update()
    {
        Vector3   s  = transform.localScale;
        Matrix4x4 bt = Matrix4x4.identity;

        bt.SetColumn(3, new Vector4(0.0f, 0.0f, 0.5f, 1.0f));
        bt          = Matrix4x4.Scale(new Vector3(s.x, s.y, s.z * range)) * bt;
        forceMatrix = transform.localToWorldMatrix * bt;

        CSForce force = new CSForce();

        force.info.shape_type = CSForceShape.Box;
        force.info.dir_type   = CSForceDirection.Directional;
        force.info.strength   = strength;
        force.info.direction  = transform.forward;
        CSImpl.BuildBox(ref force.box, forceMatrix, Vector3.one);
        GPUParticleWorld.GetInstances().ForEach((t) => { t.AddForce(ref force); });

        foreach (Transform child in transform)
        {
            child.Rotate(new Vector3(0.0f, 0.0f, 1.0f), strength * 0.33f);
        }
    }