mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 12:33:43 +00:00
reworked SoundManager to use enum classes as keys in its maps and to no longer use the AssetManager added possibility to set sound effect of projectiles when creating them (was hard coded)
34 lines
758 B
C++
34 lines
758 B
C++
#pragma once
|
|
|
|
#include "Component.h"
|
|
#include "Vector2D.h"
|
|
#include "Constants.h"
|
|
#include "SoundEffects.h"
|
|
|
|
class TransformComponent;
|
|
|
|
class ProjectileComponent : public Component
|
|
{
|
|
//can maybe be split in separate .cpp file
|
|
|
|
public:
|
|
ProjectileComponent(int range, int speed, Vector2D direction, Entity* owner, SoundEffects soundEffect)
|
|
: range(range), speed(speed), direction(direction), owner(owner), soundEffect(soundEffect) {}
|
|
~ProjectileComponent() {}
|
|
|
|
void init() override;
|
|
void update(uint_fast16_t diffTime) override;
|
|
|
|
private:
|
|
TransformComponent* transformComponent;
|
|
|
|
int range = 0;
|
|
float speed = 0;
|
|
float distance = 0;
|
|
|
|
Entity* owner = nullptr;
|
|
|
|
Vector2D direction;
|
|
|
|
SoundEffects soundEffect;
|
|
}; |