private void OnDrawGizmos() { foreach (GizmoObject obj in gizmoObjects) { Gizmos.color = obj.color; if (obj is GizmoSphere) { GizmoSphere objSphere = (obj as GizmoSphere); Gizmos.DrawWireSphere(objSphere.pos, objSphere.radius); } else if (obj is GizmoCube) { GizmoCube objCube = (obj as GizmoCube); Matrix4x4 cubeMatrix = Matrix4x4.TRS(objCube.pos, Quaternion.Euler(objCube.rotation), objCube.scale); Matrix4x4 oldMatrix = Gizmos.matrix; Gizmos.matrix *= cubeMatrix; Gizmos.DrawWireCube(Vector3.zero, Vector3.one); Gizmos.matrix = oldMatrix; } } gizmoObjects.Clear(); }
public void DrawCube(Vector3 _pos, Color _color, Vector3 _scale) { GizmoCube newGizmoCube = new GizmoCube(_pos, _color, _scale, Vector3.zero); gizmoObjects.Add(newGizmoCube); }