#ifndef GAMEENTITY_H #define GAMEENTITY_H #include class Actor; /** * Base class for entities that interact in the game */ class GameEntity { public: GameEntity(); virtual ~GameEntity() {}; // returns whether the actor may enter this field virtual bool checkEnter(Actor *actor) { Q_UNUSED(actor); return true; } // default to true // performs action when this actor acctually enters // returns whether this entity survives the entering virtual bool enter(Actor *actor) { Q_UNUSED(actor); return true; } // default to no action/survive // check whether this entity is regarded as eaten // (and can be removed in the next tick) virtual bool eaten() { return m_eaten; } // called when an instance acctually dies for creating effects virtual void onDie(Actor *actor) { Q_UNUSED(actor); }; protected: bool m_eaten; }; #endif // GAMEENTITY_H