void OnDrawGizmos() { if (closeLine) { return; } Vector3 _center; if (Application.isPlaying) { _center = ToolGameVector.ChangeGameVectorToVector3(basePosition); } else { _center = ToolGameVector.ChangeGameVectorConToVector3(baseCenter); } if (!hideCircle) { Gizmos.color = Color.blue; Gizmos.DrawWireSphere(_center, ToolMethod.Config2Render(baseRadiusCon)); } Gizmos.color = lineColor; float _width = ToolMethod.Config2Render(halfWidthCon); float _heigh = ToolMethod.Config2Render(halfHeightCon); Vector3[] topVec = new Vector3[4]; topVec [0] = _center + new Vector3(-_width, 0, -_heigh); topVec [1] = _center + new Vector3(-_width, 0, _heigh); topVec [2] = _center + new Vector3(_width, 0, _heigh); topVec [3] = _center + new Vector3(_width, 0, -_heigh); Gizmos.DrawLine(topVec[0], topVec[1]); Gizmos.DrawLine(topVec[1], topVec[2]); Gizmos.DrawLine(topVec[2], topVec[3]); Gizmos.DrawLine(topVec[3], topVec[0]); if (updateRadius) { baseRadiusCon = (int)Mathf.Sqrt(halfWidthCon * halfWidthCon + halfHeightCon * halfHeightCon) + 1; updateRadius = false; } if (fixPosition) { int _posX = (int)ToolMethod.Render2Config(transform.position.x) + 25; int _posY = (int)ToolMethod.Render2Config(transform.position.z) + 25; _posX = _posX - _posX % 50; _posY = _posY - _posY % 50; baseCenter.x = _posX; baseCenter.y = _posY; transform.position = ToolGameVector.ChangeGameVectorConToVector3(baseCenter); fixPosition = false; } }
void OnDrawGizmos() { if (closeLine) { return; } Gizmos.color = lineColor; if (Application.isPlaying) { Gizmos.DrawWireSphere(ToolGameVector.ChangeGameVectorToVector3(basePosition), ToolMethod.Config2Render(baseRadiusCon)); } else { Gizmos.DrawWireSphere(ToolGameVector.ChangeGameVectorConToVector3(baseCenter), ToolMethod.Config2Render(baseRadiusCon)); } if (fixPosition) { int _posX = (int)ToolMethod.Render2Config(transform.position.x) + 25; int _posY = (int)ToolMethod.Render2Config(transform.position.z) + 25; _posX = _posX - _posX % 50; _posY = _posY - _posY % 50; baseCenter.x = _posX; baseCenter.y = _posY; transform.position = ToolGameVector.ChangeGameVectorConToVector3(baseCenter); fixPosition = false; } }
public static Vector3 ChangeGameVectorConToVector3(GameVec2Con _vec2) { return(new Vector3(ToolMethod.Config2Render(_vec2.x), 0f, ToolMethod.Config2Render(_vec2.y))); }