示例#1
0
    public void Draw(World w, Human h, int x, int y)
    {
        sb.Clear();

        int row = 0;

        sb.AppendLine("Hero, the hero: X" + x + " Y" + y);
        row++;

        for (int yy = y + radius; yy >= y - radius; --yy)
        {
            for (int xx = x - radius; xx <= x + radius; ++xx)
            {
                IRenderable obj = null;
                if (obj == null)
                {
                    obj = w.GetPawn(xx, yy);
                }
                if (obj == null)
                {
                    obj = w.GetProp(xx, yy);
                }
                if (obj == null)
                {
                    obj = w.GetTile(xx, yy);
                }
                if (obj != null)
                {
                    sb.Append(obj.GetChar());
                }
                else
                {
                    sb.Append('~');
                }
            }
            if (row >= 2 && row <= 6)
            {
                int itx = row - 2;
                if (h.cards.Count > itx)
                {
                    sb.Append("  [" + (itx + 1) + "] ");
                    sb.Append(h.cards[itx].Name);
                }
            }
            sb.AppendLine("");
            row++;
        }
        text.text = sb.ToString();
    }
示例#2
0
        public static void Draw(World w, Human h, int x, int y)
        {
            int row = 0;

            Console.WriteLine("Hero, the hero: X" + x + " Y" + y);
            row++;

            for (int yy = y + radius; yy >= y - radius; --yy)
            {
                StringBuilder line = new StringBuilder();
                for (int xx = x - radius; xx <= x + radius; ++xx)
                {
                    IRenderable obj = null;
                    if (obj == null)
                    {
                        obj = w.GetPawn(xx, yy);
                    }
                    if (obj == null)
                    {
                        obj = w.GetProp(xx, yy);
                    }
                    if (obj == null)
                    {
                        obj = w.GetTile(xx, yy);
                    }
                    if (obj != null)
                    {
                        line.Append(obj.GetChar());
                    }
                    else
                    {
                        line.Append(Consts.ALMOST_EQUAL);
                    }
                }
                if (row >= 2 && row <= 6)
                {
                    int itx = row - 2;
                    if (h.cards.Count > itx)
                    {
                        line.Append("  [" + (itx + 1) + "] ");
                        line.Append(h.cards[itx].Name);
                    }
                }
                Console.WriteLine(line);
                row++;
            }
        }