예제 #1
0
    private static void CosmosParticleProperties(CosmosParticle p)
    {
        EditorGUILayout.BeginHorizontal();
        Color crossColor = Color.red;

        int width = Screen.width-90;
        if (p.isWaitToDelte){
            crossColor= Color.white;
            width =  Screen.width-134;
        }

        // Delete
        if (GuiTools.Button("X",crossColor,19)){
            p.isWaitToDelte = !p.isWaitToDelte;
        }
        if (p.isWaitToDelte){
            if (GuiTools.Button("Delete",Color.red,50)){
                DestroyImmediate( p.gameObject );
                return;
            }
        }

        p.inspectorShowProperties = GuiTools.ChildFoldOut( p.inspectorShowProperties,"Cosmos particle",new Color(183f/255f,230f/255f,252f/255f),width);
        EditorGUILayout.EndHorizontal();
        if ( p.inspectorShowProperties){
            Inspector(p);
        }
    }
예제 #2
0
    private static void Inspector(CosmosParticle p)
    {
        EditorGUILayout.Space();

        EditorGUI.indentLevel++;

        EditorGUI.BeginChangeCheck();
        SerializedObject serializedGradient = new SerializedObject(p);
        SerializedProperty colorGradient = serializedGradient.FindProperty("color");

        EditorGUILayout.PropertyField(colorGradient, true, null);
        if(EditorGUI.EndChangeCheck()){
            serializedGradient.ApplyModifiedProperties();
        }

        p.mat = (Material)EditorGUILayout.ObjectField("Material",p.mat,typeof(Material), true);

        EditorGUILayout.Space();
        p.maxParticle = EditorGUILayout.IntSlider("Max particle",p.maxParticle,1,500);

        GuiTools.DrawSeparatorLine(25);

        GUI.backgroundColor = new Color(33f/255f,180f/255f,252f/255f);
        p.particleSize = (CosmosParticle.ParticleSize)EditorGUILayout.EnumPopup("Size",p.particleSize);
        GUI.backgroundColor = Color.white;

        if (p.particleSize == CosmosParticle.ParticleSize.Small){
            EditorGUILayout.MinMaxSlider(new GUIContent( string.Format( "Size {0:F2} - {1:F2}", p.minSize , p.maxSize )) ,ref p.minSize, ref p.maxSize,0.2f,5f);
        }
        else{
            EditorGUILayout.MinMaxSlider(new GUIContent( string.Format( "Size {0:F2} - {1:F2}", p.minSize , p.maxSize )) ,ref p.minSize, ref p.maxSize,5f,100f);
        }

        GuiTools.DrawSeparatorLine(25);

        p.enableRotation = GuiTools.Toggle("Enable rotation",p.enableRotation,true);
        if (p.enableRotation){
            p.rotationSpeed = EditorGUILayout.Slider("Rotation speed",p.rotationSpeed,5f,20f);
        }

        GuiTools.DrawSeparatorLine(25);

        p.enableDrift = GuiTools.Toggle("Enable drift",p.enableDrift,true);
        if (p.enableDrift){
            p.driftSpeed = EditorGUILayout.Slider("Drift speed",p.driftSpeed,1f,10f);
        }

        EditorGUI.indentLevel--;
    }