Exemple #1
0
    void Update()
    {
        Vector3   zero = Vector3.zero;
        Vector3   one  = Vector3.one;
        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;
        MPGPImpl.BuildBox(ref force.box, ref forceMatrix, ref zero, ref one);
        MPGPWorld.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);
        }
    }
    public override void OnEnable()
    {
        m_world = GetComponent<MPGPWorld>();
        m_max_instances = m_world.GetNumMaxParticles();

        base.OnEnable();
        ResetGPUResoures();
    }
Exemple #3
0
    public override void OnEnable()
    {
        m_world         = GetComponent <MPGPWorld>();
        m_max_instances = m_world.GetNumMaxParticles();

        base.OnEnable();
        ResetGPUResoures();
    }
Exemple #4
0
    public override void OnEnable()
    {
        m_world         = GetComponent <MPGPWorld>();
        m_max_instances = m_world.GetNumMaxParticles();
        m_tmp_params    = new MPGPTrailParams[1];

        m_max_entities = m_world.GetNumMaxParticles() * 2;

        base.OnEnable();
        ResetGPUResoures();
    }
Exemple #5
0
 void EachTargets(System.Action <MPGPWorld> a)
 {
     if (m_targets.Length == 0)
     {
         MPGPWorld.GetInstances().ForEach(a);
     }
     else
     {
         foreach (var t in m_targets)
         {
             a(t);
         }
     }
 }
    public override void OnEnable()
    {
        m_world         = GetComponent <MPGPWorld>();
        m_max_instances = m_world.GetNumMaxParticles();
        m_cameras       = m_camera == null ? Camera.allCameras : new Camera[] { m_camera };

        if (m_cameras.Length > 0)
        {
            m_hdr = m_cameras[0].hdr;
        }

        base.OnEnable();
        ResetGPUResoures();
    }
Exemple #7
0
    void Blow()
    {
        TestShooter ts = TestShooter.instance;

        if (ts.gameMode == TestShooter.GameMode.Exception)
        {
            Vector3 zero     = Vector3.zero;
            Vector3 one      = Vector3.one;
            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);
            MPGPImpl.BuildBox(ref force.box, ref blowMatrix, ref zero, ref one);
            MPGPWorld.GetInstances().ForEach((t) => { t.AddForce(ref force); });
        }
    }
    public override void OnEnable()
    {
        m_world = GetComponent<MPGPWorld>();
        m_max_instances = m_world.GetNumMaxParticles();
        m_cameras = m_camera == null ? Camera.allCameras : new Camera[] { m_camera };

        if(m_cameras.Length > 0)
        {
            m_hdr = m_cameras[0].hdr;
        }

        base.OnEnable();
        ResetGPUResoures();
    }
    public override void OnEnable()
    {
        m_world = GetComponent<MPGPWorld>();
        m_max_instances = m_world.GetNumMaxParticles();
        m_tmp_params = new MPGPTrailParams[1];

        m_max_entities = m_world.GetNumMaxParticles() * 2;

        base.OnEnable();
        ResetGPUResoures();
    }