public void OnSceneGUI(SceneView scene)
{
if(setPerspective){
/* Selection.transforms */
setPerspective = false;
float angle = 30;
Texture baseTile = IsoSettingsManager.getInstance().getIsoSettings().defautTextureScale;
if(baseTile != null){
float angulo = Mathf.Rad2Deg * Mathf.Acos(baseTile.height / (baseTile.width*1f));
angle = 90f - angulo;
}
scene.LookAtDirect(scene.pivot,Quaternion.Euler(angle, 45, 0));
scene.orthographic = true;
if(fixView)
fixedRotation = Quaternion.Euler(angle, 45, 0);
scene.Repaint();
}
if(fixView)
scene.LookAtDirect(scene.pivot,fixedRotation);
HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));
if(Event.current.isMouse){
if(Event.current.button == 0){
if(Event.current.type == EventType.MouseDown) startCreatingCells();
else if(Event.current.type == EventType.MouseUp) endCreatingCells();
else createCell();
}
else if(Event.current.button == 1){
if(Event.current.type == EventType.MouseDown) startMovingGrid();
else if(Event.current.type == EventType.MouseUp) endMovingGrid();
else moveGrid();
}
scene.Repaint();
}
Vector3 centerGridPoint = map.getMousePositionOverMap(HandleUtility.GUIPointToWorldRay(Event.current.mousePosition), Mathf.RoundToInt(gridHeight*2f)/2f);
map.ghostCell(centerGridPoint, 0.5f);
Vector3[] puntos = new Vector3[4];
puntos[0] = new Vector3(centerGridPoint.x - cellSize/2.0f,centerGridPoint.y,centerGridPoint.z - cellSize/2.0f);
puntos[1] = new Vector3(centerGridPoint.x - cellSize/2.0f,centerGridPoint.y,centerGridPoint.z + cellSize/2.0f);
puntos[2] = new Vector3(centerGridPoint.x + cellSize/2.0f,centerGridPoint.y,centerGridPoint.z + cellSize/2.0f);
puntos[3] = new Vector3(centerGridPoint.x + cellSize/2.0f,centerGridPoint.y,centerGridPoint.z - cellSize/2.0f);
Handles.DrawSolidRectangleWithOutline(puntos, Color.yellow, Color.white);
}