예제 #1
0
 public static Vector2Int RotateVertex(Vector2Int original)
 {
     return(AddRotationOffset(TileTransformer.RotateCoord(original)));
 }
예제 #2
0
        // Based on the algorithms found on http://clintbellanger.net/articles/isometric_math/

        /// <summary>
        /// Converts a vertex coordinate into a world position.
        /// </summary>
        /// <param name="x">The x vertex coordinate.</param>
        /// <param name="y">The y vertex coordinate.</param>
        /// <returns>The world position.</returns>
        public static Vector2 VertexToWorld(int x, int y)
        {
            Vector2 coordWorldPos = TileTransformer.CoordToWorld(RemoveRotationOffset(new Vector2Int(x, y)));

            return(coordWorldPos + new Vector2(Settings.TILE_WIDTH_HALF, Settings.TILE_HEIGHT_HALF));
        }
예제 #3
0
 /// <summary>
 /// Converts a world position into a vertex position.
 /// </summary>
 /// <param name="world">The world position.</param>
 /// <returns>The vertex position.</returns>
 public static Vector2Int WorldToVertex(Vector2 world)
 {
     return(AddRotationOffset(TileTransformer.WorldToCoord(new Vector2(world.x, world.y - Settings.TILE_HEIGHT_HALF))));
 }
예제 #4
0
        public static Vector3Int RotateCoord(Vector3Int original)
        {
            Vector2Int vec2rotated = TileTransformer.RotateCoord(new Vector2Int(original.x, original.y));

            return(RotateInsideTile(new Vector3Int(vec2rotated.x, vec2rotated.y, original.z)));
        }