#pragma once #include "AnimalAI.h" #include "BasicBlocks.h" #include "Entity.h" #include "EntityType.h" class Animal : public Entity { private: Framework::Array spawns; AnimalAI* ai; protected: void onDeath() override; public: Animal(int typeId, Framework::Vec3 location, int dimensionId, int entityId); ~Animal(); void setSpawns(const Framework::Array& spawnConfig); void setAI(AnimalAI* ai); bool interact(Item* zItem, Entity* zActor) override; void takeDamage(Entity* zSource, float damage) override; void tick(const Dimension* zDimension) override; }; class AnimalEntityTypeFactory; class AnimalEntityType : public EntityType { private: Framework::JSON::JSONObject* ai; Framework::Array spawns; protected: virtual void loadSuperEntity( Entity* zEntity, Framework::StreamReader* zReader) const; virtual void saveSuperEntity( Entity* zEntity, Framework::StreamWriter* zWriter) const; public: AnimalEntityType(Framework::Text name, ModelInfo* model); ~AnimalEntityType(); Entity* createEntity(Framework::Vec3 position, int dimensionId, int entityId) const override; friend AnimalEntityTypeFactory; }; class AnimalEntityTypeFactory : public SubTypeFactory { public: AnimalEntityTypeFactory(); AnimalEntityType* createValue( Framework::JSON::JSONObject* zJson) const override; void fromJson(AnimalEntityType* zResult, Framework::JSON::JSONObject* zJson) const override; void toJson(AnimalEntityType* zObject, Framework::JSON::JSONObject* zResult) const override; Framework::Text getTypeToken() const override; };