コード例 #1
0
ファイル: Map.cs プロジェクト: Sirooy/Roomba-Warfare
 //Renders the tiles.
 public void Render(Camera camera)
 {
     foreach (Tile tile in Tiles)
     {
         //Only render the ones that are in the camera bounds
         if (CollisionHandler.CollidesWith
                 (camera, tile, Tile.SPRITE_WIDTH, Tile.SPRITE_HEIGHT))
         {
             tile.Render(camera.X, camera.Y);
         }
     }
 }
コード例 #2
0
 //Renders the bullets
 public void Render(Camera camera)
 {
     foreach (Bullet bullet in bullets)
     {
         //Only render the ones that are in the camera bounds
         if (CollisionHandler.CollidesWith
                 (camera, bullet, Bullet.SPRITE_WIDTH, Bullet.SPRITE_HEIGHT))
         {
             bullet.Render(camera);
         }
     }
 }
コード例 #3
0
 //Renders the players
 public void Render(Camera camera)
 {
     foreach (KeyValuePair <int, ServerPlayer> player in players)
     {
         //Render only the ones that are in the camera bounds
         if (CollisionHandler.CollidesWith
                 (camera, player.Value, Player.SPRITE_WIDTH,
                 Player.SPRITE_HEIGHT))
         {
             player.Value.Render(camera);
         }
     }
 }
コード例 #4
0
    public bool CheckCollisions(Hitbox[] hitboxes, float centerX, float centerY)
    {
        foreach (Hitbox hitbox in hitboxes)
        {
            if (CollisionHandler.CollidesWith
                    ((int)centerX, (int)centerY, RADIUS, hitbox))
            {
                return(true);
            }
        }

        return(false);
    }