| 1 | /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ |
| 2 | /* If you are missing that file, acquire a complete release at teeworlds.com. */ |
| 3 | #ifndef GAME_CLIENT_PREDICTION_ENTITIES_LASER_H |
| 4 | #define GAME_CLIENT_PREDICTION_ENTITIES_LASER_H |
| 5 | |
| 6 | #include <game/client/prediction/entity.h> |
| 7 | |
| 8 | class CLaserData; |
| 9 | |
| 10 | class CLaser : public CEntity |
| 11 | { |
| 12 | friend class CGameWorld; |
| 13 | |
| 14 | public: |
| 15 | CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEnergy, int Owner, int Type); |
| 16 | |
| 17 | void Tick() override; |
| 18 | |
| 19 | const vec2 &GetFrom() const { return m_From; } |
| 20 | const int &GetOwner() const { return m_Owner; } |
| 21 | const int &GetEvalTick() const { return m_EvalTick; } |
| 22 | CLaser(CGameWorld *pGameWorld, int Id, CLaserData *pLaser); |
| 23 | bool Match(CLaser *pLaser); |
| 24 | CLaserData GetData() const; |
| 25 | |
| 26 | protected: |
| 27 | bool HitCharacter(vec2 From, vec2 To); |
| 28 | void DoBounce(); |
| 29 | |
| 30 | private: |
| 31 | vec2 m_From; |
| 32 | vec2 m_Dir; |
| 33 | float m_Energy; |
| 34 | int m_Bounces; |
| 35 | int m_EvalTick; |
| 36 | int m_Owner; |
| 37 | bool m_ZeroEnergyBounceInLastTick; |
| 38 | |
| 39 | // DDRace |
| 40 | |
| 41 | vec2 m_PrevPos; |
| 42 | int m_Type; |
| 43 | int m_TuneZone; |
| 44 | }; |
| 45 | |
| 46 | #endif |
| 47 | |