示例#1
0
    /// <summary>
    /// Returns a list of tiles that are in range of s
    /// </summary>
    /// <param name="s">The given structure</param>
    /// <param name="selected">The selected tile</param>
    /// <param name="player">The player the structure belongs to</param>
    /// <returns></returns>
    List <Tile> GetTiles(Structure s, Tile selected, Player player)
    {
        int  range   = int.MinValue;
        bool limited = false;

        if (s is Attacker)
        {
            Attacker a = (Attacker)s;
            range = a.Range;
        }
        else if (s is Terrainer)
        {
            Terrainer t = (Terrainer)s;
            range   = t.Range;
            limited = true;
        }
        else if (s is BaseTree)
        {
            BaseTree b = (BaseTree)s;
            range   = b.Range;
            limited = true;
        }

        if (range != int.MinValue)
        {
            if (limited)
            {
                return(Grid.GetRangeTiles(selected, range, player));
            }

            return(Grid.GetRangeTiles(selected, range));
        }

        return(null);
    }
示例#2
0
 /// <summary>
 /// Casts the structure, and calls ConvertTiles
 /// </summary>
 /// <param name="structures">The structures that need to be cast</param>
 void ConvertTiles(List <Structure> structures)
 {
     foreach (Structure s in structures)
     {
         if (s != null)
         {
             if (s is Terrainer)
             {
                 Terrainer st = (Terrainer)s;
                 st.ConvertTiles();
             }
             else if (s is BaseTree)
             {
                 BaseTree sb = (BaseTree)s;
                 sb.ConvertTiles();
             }
         }
     }
 }
 public TerrainerContent(Terrainer terr)
 {
     this.terr = terr;
 }