protected static void DrawGizmosSelected(BaseRedirector redirector, GizmoType gizmoType) { // get mesh's vertex-positions in order to draw the outline Vector3[] linePoints = new Vector3[5]; Vector3[] gizmoVerts = redirector.GizmoPlayAreaMesh.vertices; // put line points in correct order linePoints[0] = gizmoVerts[0]; linePoints[1] = gizmoVerts[1]; linePoints[2] = gizmoVerts[3]; linePoints[3] = gizmoVerts[2]; linePoints[4] = gizmoVerts[0]; // scale points correctly for (int i = 0; i < linePoints.Length; i++) { linePoints[i] = redirector.transform.TransformPoint(new Vector3( linePoints[i].x * redirector.PlayAreaDimensions.x, linePoints[i].y, linePoints[i].z * redirector.PlayAreaDimensions.y)); } Handles.color = outlineColor; Handles.DrawAAPolyLine(10f, linePoints); //Draw both playareas Gizmos.color = endPlayAreaColorSelected; DrawPlayArea(redirector, redirector.EndPlayAreaPosition, redirector.EndPlayAreaRotation); Gizmos.color = startPlayAreaColorSelected; DrawPlayArea(redirector, redirector.StartPlayAreaPosition, redirector.StartPlayAreaRotation); }
protected static void DrawGizmosNonSelected(BaseRedirector redirector, GizmoType gizmoType) { // draw both playareas Gizmos.color = startPlayAreaColorNotSelected; DrawPlayArea(redirector, redirector.StartPlayAreaPosition, redirector.StartPlayAreaRotation); Gizmos.color = endPlayAreaColorNotSelected; DrawPlayArea(redirector, redirector.EndPlayAreaPosition, redirector.EndPlayAreaRotation); }
/// <summary> /// Draws the playarea as a gizmo inside the scene view. /// </summary> /// <param name="redirector"></param> /// <param name="position"></param> /// <param name="rotation"></param> protected static void DrawPlayArea(BaseRedirector redirector, Vector3 position, Quaternion rotation) { Gizmos.DrawMesh(redirector.GizmoPlayAreaMesh, position, rotation, new Vector3(redirector.PlayAreaDimensions.x, 0f, redirector.PlayAreaDimensions.y)); }