Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
            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));
            }
Exemplo n.º 3
0
    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));
        }
    }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
    /**
     * 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);
        }
    }
Exemplo n.º 6
0
 public AerodromePoint()
 {
     Screen          = new ScreenCoordinate();
     NavigationPoint = new NavigationPoint();
     AerodromeInfo   = new AerodromeInfo();
 }
Exemplo n.º 7
0
 public float Dot(ScreenCoordinate p)
 {
     return position.x * p.position.x + position.y * p.position.y;
 }
Exemplo n.º 8
0
 public double Distance(ScreenCoordinate p)
 {
     return (this-p).Length;
 }
Exemplo n.º 9
0
 public float Cross(ScreenCoordinate p)
 {
     return position.x * p.position.y - position.y * p.position.x;
 }
Exemplo n.º 10
0
 public PpmPoint()
 {
     Screen          = new ScreenCoordinate();
     NavigationPoint = new NavigationPoint();
 }
Exemplo n.º 11
0
 public AircraftPoint()
 {
     Screen          = new ScreenCoordinate();
     NavigationPoint = new NavigationPoint();
 }
Exemplo n.º 12
0
 public double Distance(ScreenCoordinate p)
 {
     return((this - p).Length);
 }
Exemplo n.º 13
0
 public float Cross(ScreenCoordinate p)
 {
     return(position.x * p.position.y - position.y * p.position.x);
 }
Exemplo n.º 14
0
 public float Dot(ScreenCoordinate p)
 {
     return(position.x * p.position.x + position.y * p.position.y);
 }
Exemplo n.º 15
0
    public override bool Equals(object o)
    {
        ScreenCoordinate p = o as ScreenCoordinate;

        return(position.Equals(p.position));
    }