* Unload a single asset using the registered loader for its category * @param category - The asset category (e.g., 'music', 'scenes', 'videos') * @param assetName - The asset identifier
(category: string, assetName: string)
| 57 | * @param assetName - The asset identifier |
| 58 | */ |
| 59 | private unloadAsset(category: string, assetName: string): void { |
| 60 | const loaderType = Preload.getLoaderType(category); |
| 61 | if (!loaderType) { |
| 62 | console.warn(`Unload: No loader registered for category "${category}"`); |
| 63 | return; |
| 64 | } |
| 65 | |
| 66 | const loaderConfig = Preload.getLoader(loaderType); |
| 67 | if (!loaderConfig) { |
| 68 | console.warn(`Unload: Loader type "${loaderType}" not found`); |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | if (!loaderConfig.cache.delete) { |
| 73 | console.warn(`Unload: Loader type "${loaderType}" does not support delete operation`); |
| 74 | return; |
| 75 | } |
| 76 | |
| 77 | const cacheKey = `${category}/${assetName}`; |
| 78 | loaderConfig.cache.delete(this.engine, cacheKey); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Unload a character sprite or all sprites for a character |
no test coverage detected