public override void OnInspectorGUI()
        {
            RandomPrefab prop = target as RandomPrefab;

            if (prop == null)
            {
                return;
            }

            EditorUtil.DrawGameObjectChanceTableGUI("Prefab", prop.Props, showWeights);

            if (GUI.changed)
            {
                EditorUtility.SetDirty(prop);
            }
        }
Beispiel #2
0
    void GenerateElement(int x, int y)
    {
        RandomPrefab piece = GetRandomElement();

        if (piece == null)
        {
            return;
        }

        Vector3 tilePosition = new Vector3(SizeOfTile * x, SizeOfTile * y, ElementsZ);

        tilePosition.x += ChunkOffsetX;
        tilePosition.y += ChunkOffsetY;

        GameObject newElement = GameObject.Instantiate(piece.prefab, tilePosition, Quaternion.identity) as GameObject;

        newElement.transform.SetParent(Chunk_ElementsParent);
    }
Beispiel #3
0
        public override void OnInspectorGUI()
        {
            RandomPrefab prop = target as RandomPrefab;

            if (prop == null)
            {
                return;
            }

            prop.ZeroPosition = EditorGUILayout.Toggle(new GUIContent("Zero Position", "Snaps the spawned prop to this GameObject's position. Otherwise, the prefab's position will be used as an offset."), prop.ZeroPosition);
            prop.ZeroRotation = EditorGUILayout.Toggle(new GUIContent("Zero Rotation", "Snaps the spawned prop to this GameObject's rotation. Otherwise, the prefab's rotation will be used as an offset."), prop.ZeroRotation);

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EditorUtil.DrawGameObjectChanceTableGUI("Prefab", prop.Props, showWeights, false, true);

            if (GUI.changed)
            {
                EditorUtility.SetDirty(prop);
            }
        }