40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
public class SceneBrushTree : SceneBrush
|
|
{
|
|
public override EBrushType brushType => EBrushType.Tree;
|
|
|
|
public override void OnPrefabChanged(GameObject newPrefab)
|
|
{
|
|
}
|
|
|
|
protected override void PreProcessPrefab(GameObject k_prefab)
|
|
{
|
|
base.PreProcessPrefab(k_prefab);
|
|
TreeUtil.PostProcessTree(k_prefab);
|
|
}
|
|
|
|
public override void OnInspectorGUI()
|
|
{
|
|
base.OnInspectorGUI();
|
|
if (Valid)
|
|
{
|
|
var branchMat = renderInfo.opaqueMaterial[0];
|
|
var leafMat = renderInfo.opaqueMaterial[1];
|
|
EditorGUI.BeginChangeCheck();
|
|
var branchColor = EditorGUILayout.ColorField("树枝颜色",branchMat.color);
|
|
var leafColor = EditorGUILayout.ColorField("树叶颜色",leafMat.color);
|
|
if (EditorGUI.EndChangeCheck())
|
|
{
|
|
branchMat.color = branchColor;
|
|
leafMat.color = leafColor;
|
|
renderInfo.transparentMaterial[0].color = branchColor;
|
|
renderInfo.transparentMaterial[1].color = leafColor;
|
|
}
|
|
}
|
|
}
|
|
}
|