Exemple #1
0
    public override void OnInspectorGUI()
    {
        RandomPoly rp = target as RandomPoly;

        rp.radius          = EditorGUILayout.FloatField("Radius", rp.radius);
        rp.verticesPerUnit = EditorGUILayout.FloatField("Vertex frequency", rp.verticesPerUnit);
        rp.randomRange     = EditorGUILayout.FloatField("Angle amplitude", rp.randomRange);
        rp.smoothLevel     = EditorGUILayout.IntField("Smooth Level", rp.smoothLevel);

        if (GUILayout.Button("Randomize"))
        {
            rp.Randomize();
        }
    }
    private GameObject SpawnBlocOn(GameObject prefab, Vector2 position)
    {
        Object     newBloc = Instantiate <Object>(prefab, position, Quaternion.identity);
        GameObject go      = newBloc as GameObject;

        RandomPoly rp = go.GetComponent <RandomPoly>();

        if (rp != null)
        {
            rp.Randomize();
        }

        return(go);
    }
Exemple #3
0
    void OnGUI()
    {
        blocPrefab  = EditorGUILayout.ObjectField("Bloc prefab", blocPrefab, typeof(GameObject), false) as GameObject;
        radiusParam = EditorGUILayout.FloatField("Radius setting", radiusParam);
        freqParam   = EditorGUILayout.FloatField("Frequence setting", freqParam);
        angleParam  = EditorGUILayout.FloatField("Angle setting", angleParam);

        if (blocPrefab != null && GUILayout.Button("New Block"))
        {
            Object     newBloc = Instantiate <Object>(blocPrefab);
            GameObject go      = newBloc as GameObject;

            RandomPoly rp = go.GetComponent <RandomPoly>();
            if (rp != null)
            {
                rp.Randomize();
            }
        }
    }