コード例 #1
0
 public void UpdateParticles()
 {
     if (material != null && mainTexture != null && m_Particle2D != null && m_Particle2D.mesh != null)
     {
         m_Particle2D.simulationSpace = simulationSpace;
         m_Particle2D.material        = material;
                     #if UNITY_EDITOR
         if (!Application.isPlaying)           //update Material and texture
         {
             m_Particle2D.UpdateUV();
             canvasRenderer.SetMaterial(material, mainTexture);
         }
                     #endif
         configValues.texture = mainTexture;
         m_Particle2D.color   = color;
         m_Particle2D.AdvanceTime(Time.deltaTime * speedScale);
         if (m_Particle2D.isOver)
         {
             canvasRenderer.SetMesh(null);
         }
         else
         {
             canvasRenderer.SetMesh(m_Particle2D.mesh);
         }
     }
 }
コード例 #2
0
 public void UpdateParticles()
 {
     if (material != null && mainTexture != null && m_Particle2D != null && m_Particle2D.mesh != null)
     {
         meshRenderer.enabled         = !m_Particle2D.isOver;
         m_Particle2D.simulationSpace = simulationSpace;
         m_Particle2D.material        = material;
         m_Particle2D.color           = color;
                     #if UNITY_EDITOR
         if (!Application.isPlaying)           //update Material and texture
         {
             m_Particle2D.UpdateUV();
             MaterialPropertyBlock block = new MaterialPropertyBlock();
             meshRenderer.GetPropertyBlock(block);
             block.SetTexture("_MainTex", mainTexture);
             meshRenderer.SetPropertyBlock(block);
         }
                     #endif
         configValues.texture = mainTexture;
         m_Particle2D.AdvanceTime(Time.deltaTime * speedScale);
     }
 }