34 lines
808 B
C#
34 lines
808 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
// ReSharper disable FieldCanBeMadeReadOnly.Global
|
|
|
|
namespace BITKit.Scene
|
|
{
|
|
public class SceneGizmoReference : MonoBehaviour
|
|
{
|
|
[Export]
|
|
public static bool AllowGizmos=true;
|
|
[SerializeField] private bool draw;
|
|
[SerializeField] private Color color;
|
|
[SerializeField] private float size;
|
|
|
|
[SerializeField] private Optional<Vector3> bounds;
|
|
private void OnDrawGizmosSelected()
|
|
{
|
|
if (draw is false || AllowGizmos is false) return;
|
|
var position = transform.position;
|
|
Gizmos.color = color;
|
|
Gizmos.DrawWireSphere(position, size);
|
|
|
|
if (bounds.Allow)
|
|
{
|
|
var rotation = transform.rotation;
|
|
Gizmos.DrawWireCube(position+rotation*bounds.Value/2, rotation*bounds.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|