void OnEnable() { m_pw = GetComponent <GPUParticleWorld>(); if (m_camera == null || m_camera.Length == 0) { m_camera = new Camera[1] { Camera.main }; } m_tmp_params = new CSTrailParams[1]; m_max_entities = m_pw.GetNumMaxParticles() * 2; m_buf_trail_params = new ComputeBuffer(1, CSTrailParams.size); m_buf_trail_entities = new ComputeBuffer(m_max_entities, CSTrailEntity.size); m_buf_trail_history = new ComputeBuffer(m_max_entities * m_trail_max_history, CSTrailHistory.size); m_buf_trail_vertices = new ComputeBuffer(m_max_entities * m_trail_max_history * 2, CSTrailVertex.size); if (m_act_render == null) { m_act_render = Render; foreach (var c in m_camera) { if (c == null) { continue; } DSRenderer dsr = c.GetComponent <DSRenderer>(); dsr.AddCallbackTransparent(m_act_render); } } }
void OnEnable() { m_pw = GetComponent<GPUParticleWorld>(); if (m_camera == null || m_camera.Length == 0) { m_camera = new Camera[1] { Camera.main }; } m_tmp_params = new CSTrailParams[1]; m_max_entities = m_pw.GetNumMaxParticles() * 2; m_buf_trail_params = new ComputeBuffer(1, CSTrailParams.size); m_buf_trail_entities = new ComputeBuffer(m_max_entities, CSTrailEntity.size); m_buf_trail_history = new ComputeBuffer(m_max_entities * m_trail_max_history, CSTrailHistory.size); m_buf_trail_vertices = new ComputeBuffer(m_max_entities * m_trail_max_history * 2, CSTrailVertex.size); if (m_act_render==null) { m_act_render = Render; foreach (var c in m_camera) { if (c == null) continue; DSRenderer dsr = c.GetComponent<DSRenderer>(); dsr.AddCallbackTransparent(m_act_render); } } }
public virtual void OnEnable() { m_pw = GetComponent <GPUParticleWorld>(); GPUParticleUtils.CreateVertexBuffer(m_mesh, ref m_buf_vertices, ref m_num_vertices); if (m_camera == null || m_camera.Length == 0) { m_camera = new Camera[1] { Camera.main }; } }
void EachTargets(System.Action <GPUParticleWorld> a) { if (m_targets.Length == 0) { GPUParticleWorld.GetInstances().ForEach(a); } else { foreach (var t in m_targets) { a(t); } } }
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 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); } }
void Start() { cspset = particleSet.GetComponent<GPUParticleWorld>(); }
void Start() { cspset = particleSet.GetComponent <GPUParticleWorld>(); }
public virtual void OnEnable() { m_pw = GetComponent<GPUParticleWorld>(); GPUParticleUtils.CreateVertexBuffer(m_mesh, ref m_buf_vertices, ref m_num_vertices); if (m_camera == null || m_camera.Length == 0) { m_camera = new Camera[1] { Camera.main }; } }