using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// Static class for adding More Debug funtions
///
public static class DebugExtensions
{
///
/// Draws wireframe cube in scene view
///
/// Centre of cube
/// extent of cube (half of size)
/// Color of lines
/// Amount of time cube is displayed
/// Should cube be obsured by otherobjects
public static void DrawCube(Vector3 Position, Vector3 Extent, Color color, float duration, bool depthTest = true)
{
Vector3 min = Position - Extent;
Vector3 max = Position + Extent;
//Draw bottom Square
Debug.DrawLine(new Vector3(min.x, min.y, min.z), new Vector3(min.x, min.y, max.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(min.x, min.y, max.z), new Vector3(max.x, min.y, max.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(max.x, min.y, max.z), new Vector3(max.x, min.y, min.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(max.x, min.y, min.z), new Vector3(min.x, min.y, min.z), color, duration, depthTest);
//top square
Debug.DrawLine(new Vector3(min.x, max.y, min.z), new Vector3(min.x, max.y, max.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(min.x, max.y, max.z), new Vector3(max.x, max.y, max.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(max.x, max.y, max.z), new Vector3(max.x, max.y, min.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(max.x, max.y, min.z), new Vector3(min.x, max.y, min.z), color, duration, depthTest);
//connect top and bottom
Debug.DrawLine(new Vector3(min.x, min.y, min.z), new Vector3(min.x, max.y, min.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(min.x, min.y, max.z), new Vector3(min.x, max.y, max.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(max.x, min.y, max.z), new Vector3(max.x, max.y, max.z), color, duration, depthTest);
Debug.DrawLine(new Vector3(max.x, min.y, min.z), new Vector3(max.x, max.y, min.z), color, duration, depthTest);
}
///
/// Draws wireframe cube in scene view
///
/// Centre of cube
/// extent of cube (half of size)
/// Color of lines
/// Amount of time cube is displayed
public static void DrawCube(Vector3 Position, float Extent, Color color, float duration)
{
//Call overload funtion
DrawCube(Position, Vector3.one * Extent, color, duration);
}
}//End DebugExtentions