Exemple #1
0
    // Trace path of tiles (GameTile or VTile) in one of six possible directions (Because hexagons)
    //
    public static IEnumerable GetPathInDirection(ITileTraverse startTile, TileTraverse GetTileInDirection)
    {
        ITileTraverse t = startTile;

        for (;;)
        {
            t = GetTileInDirection(t);   // Traverse to next tile in designated direction

            if (t == null)
            {
                yield break;             // End of path reached -- Terminate traversal
            }
            //
            else
            {
                if (t.IsPenguinHere || t.IsEmpty)
                {
                    yield break;                                 // Stop if there's a penguin in the way, or no physical tile present
                }
                //
                else
                {
                    yield return(t);    // Else return the tile just traversed to
                }
            }
        }
    }
Exemple #2
0
    // Trace path in all directions
    //
    public IEnumerable AllPaths(TileManager tm)
    {
        ITileTraverse t0 = this;

        foreach (TileManager.TileTraverse ThataWay in tm.funcsTraverse)
        {
            foreach (ITileTraverse t in TileManager.GetPathInDirection(t0, ThataWay))
            {
                yield return(t);
            }
        }
    }
Exemple #3
0
    // ITileTraverse to the "northeast"
    //
    public ITileTraverse GetTile_NE(ITileTraverse t)
    {
        string sTileID = GetNameTile_NE(t.col, t.row);

        return(ValidateTile(sTileID));
    }