ZMWSLI0-SL2021-GR11/Projekt/MWSProjekt/Library/PackageCache/com.unity.terrain-tools@3.0.2-preview.3/Runtime/TerrainToolbox/TerrainGizmos.cs

35 lines
966 B
C#
Raw Normal View History

2021-07-05 21:20:56 +02:00
using UnityEditor;
namespace UnityEngine.Experimental.TerrainAPI
{
public class TerrainGizmos : MonoBehaviour
{
public int GroupID = 0;
[HideInInspector]
public Color CubeColor, CubeWireColor;
void OnDrawGizmos()
{
transform.rotation = new Quaternion(0, 0, 0, 0);
transform.localScale = new Vector3(Mathf.Abs(transform.localScale.x), Mathf.Abs(transform.localScale.y), Mathf.Abs(transform.localScale.z));
Gizmos.matrix = transform.localToWorldMatrix;
Gizmos.color = CubeColor;
Gizmos.DrawCube(Vector3.zero, Vector3.one);
Gizmos.color = CubeWireColor;
Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
#if UNITY_EDITOR
//Disable rotate tool
if(Selection.Contains(this.gameObject))
{
Tools.hidden = Tools.current == Tool.Rotate ? true : false;
}
else
{
Tools.hidden = false;
}
#endif
}
}
}