55 lines
1.1 KiB
C++

/*
* Weapon.h
*
* Created on: Dec 2, 2016
* Author: tibi
*/
#ifndef CONTROLLER_ITEMS_WEAPON_H_
#define CONTROLLER_ITEMS_WEAPON_H_
#include <components/basic/Sprite.h>
#include <components/items/IPlayerAction.h>
#include <graphics/SpriteRenderer.h>
#include <model/Component.h>
namespace farmlands {
namespace components {
namespace items {
class Weapon: public model::Component, public IPlayerAction
{
public:
Weapon();
virtual ~Weapon();
virtual model::Component* clone() override;
virtual void dump(unsigned level) override;
virtual void onInitialize() override;
virtual void onUpdateLogic() override;
virtual void onPreRender() override;
/**
* Performs everything required to attacking an enemy with a weapon. To be called from player controller.
*/
virtual void performAction(float x, float y, model::Direction d);
// Properties
float damage;
float critProbability;
float critDamage;
float attackDuration; // In seconds
float attackTimeLeft;
private:
basic::Sprite* m_sprite;
};
}
} /* namespace components */
} /* namespace farmlands */
#endif /* CONTROLLER_ITEMS_WEAPON_H_ */