19 #ifndef HEADER_GHOST_KART_HPP
20 #define HEADER_GHOST_KART_HPP
22 #include "karts/kart.hpp"
23 #include "replay/replay_play.hpp"
24 #include "utils/cpp2011.hpp"
26 #include "LinearMath/btTransform.h"
43 std::vector<ReplayBase::PhysicInfo> m_all_physic_info;
45 std::vector<ReplayBase::BonusInfo> m_all_bonus_info;
47 std::vector<ReplayBase::KartReplayEvent> m_all_replay_events;
51 unsigned int m_last_egg_idx;
53 bool m_finish_computed;
63 GhostKart(
const std::string& ident,
unsigned int world_kart_id,
64 int position,
float color_hue,
66 virtual void update(
int ticks) OVERRIDE;
68 virtual void reset() OVERRIDE;
76 const float getSuspensionLength(
int index,
int wheel)
const
77 {
return m_all_physic_info[index].m_suspension_length[wheel]; }
79 void addReplayEvent(
float time,
80 const btTransform &trans,
95 virtual float getSpeed() const OVERRIDE;
115 {
return m_replay_data; }
A ghost kart.
Definition: ghost_kart.hpp:38
virtual bool isGhostKart() const OVERRIDE
Returns whether this kart is a ghost (replay) kart.
Definition: ghost_kart.hpp:86
float getGhostFinishTime()
Returns the finished time for a ghost kart.
Definition: ghost_kart.cpp:329
std::vector< btTransform > m_all_transform
The transforms to assume at the corresponding time in m_all_times.
Definition: ghost_kart.hpp:41
virtual bool isOnGround() const OVERRIDE
Ghost are not on the ground if flying.
Definition: ghost_kart.hpp:92
virtual void createPhysics() OVERRIDE
Creates the physical representation of this kart.
Definition: ghost_kart.hpp:74
virtual float getTimeForDistance(float distance) OVERRIDE
Returns the time at which the kart was at a given distance.
Definition: ghost_kart.cpp:340
virtual void applyEngineForce(float force) OVERRIDE
No physics for ghost kart.
Definition: ghost_kart.hpp:71
virtual bool isInvulnerable() const OVERRIDE
Ghost can't be hunted.
Definition: ghost_kart.hpp:89
float getTimeForEggs(int egg_number)
Returns the smallest time at which the kart had the required number of eggs Returns -1....
Definition: ghost_kart.cpp:418
virtual void reset() OVERRIDE
Reset before a new race.
Definition: ghost_kart.cpp:52
virtual void kartIsInRestNow() OVERRIDE
Computes the transform of the graphical kart chasses with regards to the physical chassis.
Definition: ghost_kart.hpp:110
virtual void update(int ticks) OVERRIDE
Updates the current event of the ghost kart using interpolation.
Definition: ghost_kart.cpp:113
void computeFinishTime()
Compute the time at which the ghost finished the race.
Definition: ghost_kart.cpp:308
virtual void makeKartRest() OVERRIDE
Called before go phase to make sure all karts start at the same position in case there is a slope.
Definition: ghost_kart.hpp:112
virtual void updateGraphics(float dt) OVERRIDE
Called once per rendered frame.
Definition: ghost_kart.cpp:94
virtual float getSpeed() const OVERRIDE
Returns the speed of the kart in meters/second.
Definition: ghost_kart.cpp:283
void updateSound(float dt)
Update sound effect upon ghost replay data.
Definition: ghost_kart.cpp:251
The main kart class.
Definition: kart.hpp:72
bool m_flying
True if kart is flying (for debug purposes only).
Definition: kart.hpp:180
Definition: replay_play.hpp:57
Definition: replay_base.hpp:63
Records all other events.
Definition: replay_base.hpp:85
Definition: replay_base.hpp:50