private void picScreenLocation_MouseMove(object sender, MouseEventArgs e) { if (draggingScreen) { int x = picScreenLocation.Left + e.X; if (x < 0) { x = 0; } if (x > 255) { x = 255; } int y = picScreenLocation.Top + e.Y; if (y < 0) { y = 0; } if (y > 239) { y = 239; } picScreenLocation.Location = new Point(x / 16 * 16, y / 16 * 16); ScreenCoordinate c = new ScreenCoordinate(x / 16, y / 16); currentRoom.PowerupScreenPosition = c; } }
public int ToRasterY(ScreenCoordinate point) { point.X -= (long)B1; point.Y -= (long)B2; return((int)Math.Round(inverse.A12 * point.X + inverse.A22 * point.Y, MidpointRounding.AwayFromZero)); }
void OnDrawGizmos() { var poly = grid.PolygonVertices(); foreach (Cube cube in grid.Hexes) { ScreenCoordinate pos = grid.HexToCenter(cube); ScreenCoordinate first = null; ScreenCoordinate last = null; foreach (ScreenCoordinate coord in poly) { if (last == null) { first = coord + pos; last = coord + pos; continue; } ScreenCoordinate next = coord + pos; Gizmos.DrawLine(new Vector3(last.position.x, last.position.y), new Vector3(next.position.x, next.position.y)); last = next; } Gizmos.DrawLine(new Vector3(last.position.x, last.position.y), new Vector3(first.position.x, first.position.y)); } }
public Point ToRaster(ScreenCoordinate point) { point.X -= (long)worldFile.B1; point.Y -= (long)worldFile.B2; var x = (int)Math.Round(worldFile.inverse.A11 * point.X + worldFile.inverse.A21 * point.Y, MidpointRounding.AwayFromZero); var y = (int)Math.Round(worldFile.inverse.A12 * point.X + worldFile.inverse.A22 * point.Y, MidpointRounding.AwayFromZero); return(new Point(x, y)); }
/** * Attacher la map */ public void AttachMap(Map map) { this.map = map; foreach (Cube position in map.grid.Hexes) { GameObject tileViewGO = Instantiate(tilePrefab); tileViewGO.gameObject.transform.SetParent(tilesContainer.transform); Tile tile = map[position]; ScreenCoordinate sc = map.grid.HexToCenter(position); RectTransform transform = (RectTransform)tileViewGO.gameObject.transform; float h = 87; float w = h - Mathf.Sqrt(3) / 2; transform.position = tilesContainer.transform.position + new Vector3(sc.position.x * w, sc.position.y * h, 0); tileViewGO.GetComponent <TileView2D>().AttachTile(tile); } }
public AerodromePoint() { Screen = new ScreenCoordinate(); NavigationPoint = new NavigationPoint(); AerodromeInfo = new AerodromeInfo(); }
public float Dot(ScreenCoordinate p) { return position.x * p.position.x + position.y * p.position.y; }
public double Distance(ScreenCoordinate p) { return (this-p).Length; }
public float Cross(ScreenCoordinate p) { return position.x * p.position.y - position.y * p.position.x; }
public PpmPoint() { Screen = new ScreenCoordinate(); NavigationPoint = new NavigationPoint(); }
public AircraftPoint() { Screen = new ScreenCoordinate(); NavigationPoint = new NavigationPoint(); }
public double Distance(ScreenCoordinate p) { return((this - p).Length); }
public float Cross(ScreenCoordinate p) { return(position.x * p.position.y - position.y * p.position.x); }
public float Dot(ScreenCoordinate p) { return(position.x * p.position.x + position.y * p.position.y); }
public override bool Equals(object o) { ScreenCoordinate p = o as ScreenCoordinate; return(position.Equals(p.position)); }