1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- //
- // Created by jovian on 17/08/17.
- //
- #ifndef SPACEEXPANSION_STARSHIP_H
- #define SPACEEXPANSION_STARSHIP_H
- #include "../Maths/b2_math.h"
- #include "../Graphics/Visual.h"
- #include "Stock.h"
- #define NO_TARGET_PLANET -1
- enum ShipMotor {
- GAZ = 0, ION = 1, LASER = 2, ANTIMATER = 3, GRAVITY = 4, ALCUBIERRE = 5, HYPERDRIVE = 6
- };
- struct StarShipDef {
- StarShipDef() : motor(GAZ), cargo(10), militaryPower(0), stock(),
- pos(0.0f, 0.0f) {};
- ShipMotor motor;
- int cargo;
- int militaryPower;
- Stock stock;
- b2Vec2 pos;
- };
- class StarShip {
- // Methods
- public:
- StarShip(const StarShipDef &def);
- virtual ~StarShip();
- Visual *makeVisual();
- void update();
- Stock unload();
- void load(Stock stock);
- void travelTo(int targetPlanet, b2Vec2 targetPos);
- bool isArrived() const;
- int getTargetPlanet() const;
- const StarShipDef &getDef() const;
- // Attributes
- private:
- StarShipDef m_def;
- float m_angle;
- int m_targetPlanet;
- b2Vec2 m_targetPos;
- bool m_arrived;
- };
- #endif //SPACEEXPANSION_STARSHIP_H
|