123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #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;
- JSONObjectValidationBuilder* addToValidator(
- JSONObjectValidationBuilder* builder) const override;
- };
|