コード例 #1
0
ファイル: IsoTile.cs プロジェクト: Botyto/UnityTown
    public CompoundShape GetShape()
    {
        var h = NormalizedCorners ();
        var shape = new CompoundShape ();

        var pos = World.TileSizeYVector / 2f + World.IndexToIso (Index) + World.TileSizeZVector * (MinCorner ());

        shape.AddTriangle (
            pos - World.TileSizeXVector / 2f + World.TileSizeZVector * h [D],
            pos + World.TileSizeYVector / 2f + World.TileSizeZVector * h [C] + new Vector2 (1, 0) * 0.01f,
            pos - World.TileSizeYVector / 2f + World.TileSizeZVector * h [A] + new Vector2 (1, 0) * 0.01f);

        shape.AddTriangle (
            pos + World.TileSizeXVector / 2f + World.TileSizeZVector * h [B],
            pos + World.TileSizeYVector / 2f + World.TileSizeZVector * h [C],
            pos - World.TileSizeYVector / 2f + World.TileSizeZVector * h [A]);

        return shape;
    }
コード例 #2
0
ファイル: Iso_Methods.cs プロジェクト: Botyto/UnityTown
    public CompoundShape GetFlatShape()
    {
        var result = new CompoundShape ();

        var pos = TileSizeYVector / 2f;
        result.AddTriangle (pos + TileSizeXVector / 2f, pos - TileSizeXVector / 2f, pos - TileSizeYVector / 2f);
        result.AddRectangle (pos - TileSizeXVector / 2f, pos + TileSizeXVector / 2f + TileSizeZVector);
        pos += TileSizeZVector;
        result.AddTriangle (pos - TileSizeXVector / 2f, pos + TileSizeXVector / 2f, pos + TileSizeYVector / 2f);

        return result;
    }