Exemple #1
0
        public void Draw(XnaRenderer renderer)
        {
            renderer.DrawDepth = 1f;
            Color tileColor = Color.White;

            if (IsWall)
            {
                tileColor = Color.SlateGray;
                if (_strength == 1)
                {
                    tileColor = Color.LightBlue;
                }
                if (_strength == 2)
                {
                    tileColor = Color.DarkBlue;
                }
            }
            renderer.DrawFilledRectangle(new RectangleF(-0.45f, -0.45f, 0.9f, 0.9f), tileColor);
            renderer.DrawDepth = 0.8f;
            if (ContainsFood)
            {
                renderer.DrawPoint(new Vector2(0, 0), 1f, Color.Green, 1f);
            }

            if (IsEmpty && Anim > 0)
            {
                float width = (float)Anim / 50 * 0.45f;
                renderer.DrawFilledRectangle(new RectangleF(-width, -width, width * 2, width * 2), Color.Gray);
                Anim--;
            }
        }