Created
February 13, 2020 02:57
-
-
Save PcChip/c7e43c424595ee3c395d13818b3ae367 to your computer and use it in GitHub Desktop.
Derived class - question for EnTT component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Weapon | |
{ | |
public: | |
glm::vec3 currentFiringLocation; //updated every frame with new barrel exit location | |
float cooldownRemaining = 0.0f; //updated every tick to see when it can fire again | |
bool fixed = false; //fixed weapon, or turret? | |
virtual void fire(int targetGlobalID) = 0; | |
//the parameter below is because this weapon needs to know its owner's world location to draw the laser sprite | |
virtual void update(double dt, entityInstanceData& parent) = 0; | |
private: | |
glm::mat4 defaultRootPose; //orientation it should have on load by default | |
glm::vec3 defaultFiringLocation; //location of the barrel in the base/bind pose | |
}; | |
class LaserWeapon :private Weapon | |
{ | |
public: | |
float damagePerTick = 0.0f; //how much damage does it apply to target per tick? | |
float burstLength = 0.0f; //in seconds | |
float totalDamage = 0.0f; //total damage if the burst is fully applied | |
virtual void fire(int targetGlobalID); | |
virtual void update(double dt, entityInstanceData& parent); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment