diff --git a/include/AssetManager.h b/include/AssetManager.h index 1d3c97a..1a92c76 100644 --- a/include/AssetManager.h +++ b/include/AssetManager.h @@ -28,7 +28,7 @@ public: void createPowerup(Vector2D pos, std::function pickupFunc, std::string texturePath); Vector2D calculateSpawnPosition(); - PowerupType calculateType(); + template T calculateType(int amount); //texture management void addTexture(std::string id, const char* path); diff --git a/src/AssetManager.cpp b/src/AssetManager.cpp index 25ce8ad..809ccd7 100644 --- a/src/AssetManager.cpp +++ b/src/AssetManager.cpp @@ -98,8 +98,9 @@ Vector2D AssetManager::calculateSpawnPosition() return spawnPos; } -PowerupType AssetManager::calculateType() +template +T AssetManager::calculateType(int amount) { - PowerupType type = PowerupType(rand() % 3); - return type; -} \ No newline at end of file + T type = T(rand() % amount); + return type; +}