12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #pragma once
- #include "AnimalAI.h"
- #include "BasicBlocks.h"
- #include "Entity.h"
- #include "EntityType.h"
- class Animal : public Entity
- {
- private:
- Framework::Array<SpawnConfig> spawns;
- AnimalAI* ai;
- protected:
- void onDeath() override;
- public:
- Animal(int typeId,
- Framework::Vec3<float> location,
- int dimensionId,
- int entityId);
- ~Animal();
- void setSpawns(const Framework::Array<SpawnConfig>& 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<SpawnConfig> 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<float> position,
- int dimensionId,
- int entityId) const override;
- friend AnimalEntityTypeFactory;
- };
- class AnimalEntityTypeFactory
- : public SubTypeFactory<EntityType, AnimalEntityType>
- {
- 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;
- };
|