示例#1
0
 public void Draw(GameCanvas canvas)
 {
     foreach (Item it in Items)
     {
         it.Draw(canvas);
     }
 }
示例#2
0
文件: Item.cs 项目: sbrot92/cs3152
 public void Draw(GameCanvas canvas)
 {
     Color color = Color.White;
     switch (Type)
     {
         case ItemType.PLASMID:
             color = Color.Blue;
             break;
         case ItemType.HEALTH:
             color = Color.White;
             break;
         case ItemType.ATTACK:
             color = Color.Yellow;
             break;
     }
     canvas.DrawSprite(Texture, color,
         new Rectangle((int)Position.X - ITEM_SIZE/2, (int)Position.Y - ITEM_SIZE/2, ITEM_SIZE, ITEM_SIZE),
         new Rectangle(0, 0, Texture.Width, Texture.Height));
 }
示例#3
0
 public void Draw(GameCanvas canvas)
 {
     CurLevel.Draw(canvas);
 }
示例#4
0
 public void Draw(GameCanvas canvas)
 {
     foreach (GameUnit unit in Units)
     {
         unit.Draw(canvas);
     }
     if (Player != null)
     {
         Player.Draw(canvas);
     }
 }
示例#5
0
 public GameEngine()
 {
     canvas = new GameCanvas(this);
     factory = new ContentFactory(new ContentManager(Services));
     camera = new Camera(canvas.Width, canvas.Height);
 }
示例#6
0
        public void Draw(GameCanvas canvas)
        {
            // test
            Texture2D texture = Vel.X > 0.5 ? Texture_R : Texture_L;

            Color color = Color.White;
            if (Immune)
            {
                color = new Color(50, (int)Health + 150, (int)Health + 150, 250);
            }
            else
            {
                color = new Color(250, (int)Health + 150, (int)Health + 150, 250);
            }
            if (!Exists)
            {
                color = Color.Gray;
            }

            canvas.DrawSprite(texture, color,
                new Rectangle((int)(Position.X - Size/2), (int)(Position.Y - Size/2), Size, Size),
                new Rectangle(0, 0, texture.Width, texture.Height));
            canvas.DrawText("T", Color.Yellow, NextMove - new Vector2(20, 20));
        }