Beispiel #1
0
 internal static bool IsDownOf(this TileObject thisTile, TileObject otherTile)
 {
     return(thisTile.Position.Col == otherTile.Position.Col && thisTile.Position.Row > otherTile.Position.Row);
 }
Beispiel #2
0
        public static RoadDirection GetRoadDirection(this TileObject tileObject)
        {
            bool up    = false;
            bool left  = false;
            bool right = false;
            bool down  = false;

            foreach (Ref <TileObject> prev in tileObject.Prev)
            {
                if (prev.Value.IsLeftOf(tileObject))
                {
                    left = true;
                }
                if (prev.Value.IsRightOf(tileObject))
                {
                    right = true;
                }
                if (prev.Value.IsUpOf(tileObject))
                {
                    up = true;
                }
                if (prev.Value.IsDownOf(tileObject))
                {
                    down = true;
                }
            }

            foreach (Ref <TileObject> next in tileObject.Next)
            {
                if (next.Value.IsLeftOf(tileObject))
                {
                    left = true;
                }
                if (next.Value.IsRightOf(tileObject))
                {
                    right = true;
                }
                if (next.Value.IsUpOf(tileObject))
                {
                    up = true;
                }
                if (next.Value.IsDownOf(tileObject))
                {
                    down = true;
                }
            }
            if (up && down && left && right)
            {
                return(RoadDirection.AllDirection);
            }
            if (up && down && left)
            {
                return(RoadDirection.TLeft);
            }
            if (up && down && right)
            {
                return(RoadDirection.TRight);
            }
            if (up && left && right)
            {
                return(RoadDirection.TUp);
            }
            if (down && left && right)
            {
                return(RoadDirection.TDown);
            }
            if (up && down)
            {
                return(RoadDirection.Vertical);
            }
            if (left && right)
            {
                return(RoadDirection.Horizontal);
            }
            if (left && up)
            {
                return(RoadDirection.LeftUp);
            }
            if (left && down)
            {
                return(RoadDirection.LeftDown);
            }
            if (right && up)
            {
                return(RoadDirection.RightUp);
            }
            if (right && down)
            {
                return(RoadDirection.RightDown);
            }
            return(RoadDirection.Slice4);
        }
Beispiel #3
0
 internal static bool IsRightOf(this TileObject thisTile, TileObject otherTile)
 {
     return(thisTile.Position.Row == otherTile.Position.Row && thisTile.Position.Col > otherTile.Position.Col);
 }