Chcę wprowadzić różne efekty do nabojów typu podpalenie,trucizna itp.
Mam klasę weapon:
#pragma once
#include "Item.hpp"
class Weapon : public Item
{
public:
Weapon(std::string data,TextureManager &textureManager);
void update(sf::Time dt);
void useItem(Statistic &statistic);
private:
int speed;
int damage,currentDamage;
bool collision;
float criticalAttack;
sf::Vector2i bRect,bTileSize;
sf::Clock game_clock;
sf::Time shot_delay;
sf::Time last_fire_timestamp;
};
ona tworzy obiekty pocisków podczas użycia:
statistic.bullet.emplace_back(new NormalBullet(statistic.playerPosition,statistic.mousePosition, speed, currentDamage, collision,
bRect, bTileSize,effectData,textureManager));
#pragma once
#include <SFML\Graphics.hpp>
#include "TextureManager.hpp"
#define _USE_MATH_DEFINES
#include <math.h>
class Bullet : public sf::Drawable
{
public:
Bullet();
virtual void update(sf::Time dt);
void draw(sf::RenderTarget& target, sf::RenderStates states) const;
void setIsActive(bool isActive);
bool getIsActive();
bool getCollision();
sf::FloatRect getGlobalBounds();
int getDamage();
protected:
int setItems(std::string &item);
sf::Sprite sprite;
int damage;
int speed;
bool collision;
sf::Vector2f direction;
float angle;
bool isActive;
};
I chcę właśnie stworzyć te różne efekty, podpalenie,trucizna itd.
Chcę stworzyć klasę główną Effects, i różne dziedziczące od niej, ale np. będzie taki rodzaj efektu że co kilka sekund będzie odbierać ileś tam HP ogniem/trucizną, albo pocisk co stunuje gracza itd. Zatem konstruktor będzie przyjmował różne parametry.
Nie wiem czy zrobić jakąś strukturę z parametrami typu type,damage,chance itd. i potem te strukturę wypełniać w weapon, przekazywać do bullet, a za jej pomocą tworzyć efekt na przeciwniku. Macie jakieś pomysły?