Ejemplo n.º 1
0
    void OnSceneGUI()
    {
        Particle2DUGUI particle2D = target as Particle2DUGUI;

        Handles.BeginGUI();
        GUI.backgroundColor = Color.green;
        GUILayout.BeginArea(new Rect(5, 5, 60, 130));
        if (GUILayout.Button("Play", GUILayout.Width(60), GUILayout.Height(30)))
        {
            if (particle2D.Emitter != null)
            {
                particle2D.Emitter.Play();
            }
            else
            {
                particle2D.ResetParticle();
            }
            particle2D.OnRebuildRequested();
        }
        if (GUILayout.Button("Stop", GUILayout.Width(60), GUILayout.Height(30)))
        {
            if (particle2D.Emitter != null)
            {
                if (particle2D.Emitter != null)
                {
                    particle2D.Emitter.Stop(false);
                }
            }
        }
        if (GUILayout.Button("Clear", GUILayout.Width(60), GUILayout.Height(30)))
        {
            if (particle2D.Emitter != null)
            {
                if (particle2D.Emitter != null)
                {
                    particle2D.Emitter.Stop(true);
                    particle2D.OnRebuildRequested();
                }
            }
        }
        GUILayout.EndArea();
        Handles.EndGUI();
    }
Ejemplo n.º 2
0
 void OnDisable()
 {
     if (!Application.isPlaying)
     {
         Particle2DUGUI particle2D = target as Particle2DUGUI;
         if (particle2D != null && Selection.activeGameObject != particle2D.gameObject && particle2D.Emitter != null)
         {
             if (particle2D.Emitter != null)
             {
                 particle2D.Emitter.Stop(true);
                 particle2D.OnRebuildRequested();
             }
         }
     }
 }