12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #pragma once
- #include <Model3D.h>
- #include <Either.h>
- #include <Critical.h>
- #include "EntityType.h"
- #include "Inventory.h"
- class Block;
- class ActionTarget
- {
- private:
- Framework::Vec3<int> blockPos;
- Direction targetBlockSide;
- int entityId;
- public:
- ActionTarget( Framework::Vec3<int> blockPos, Direction blockSide );
- ActionTarget( int entityId );
- static ActionTarget* load( Framework::StreamReader* zReader );
- bool isBlock() const;
- bool isEntity() const;
- int getEntityId() const;
- Framework::Vec3<int> getBlockPos() const;
- Direction getBlockSide() const;
- Framework::Either<Block*, Entity*> zTarget( int dimensionId ) const;
- Framework::Either<Block*, Entity*> getTarget( int dimensionId ) const;
- };
- class Entity : public Framework::Model3D, public Inventory
- {
- protected:
- float maxHP;
- float currentHP;
- float stamina;
- float maxStamina;
- float hunger;
- float maxHunger;
- float thirst;
- float maxThirst;
- float targetDistanceLimit;
- Framework::Vec3<float> speed;
- Framework::Vec3<float> faceDir;
- const EntityType* zEntityType;
- int currentDimensionId;
- float gravityMultiplier;
- int id;
- ActionTarget* target;
- Framework::Critical cs;
- public:
- Entity( const EntityType* zType, bool hasInventory );
- ~Entity();
- virtual bool tick( double time ) override;
- int getId() const;
- const EntityType* zType() const;
- int getCurrentDimension() const;
- void lock();
- void unlock();
- friend EntityType;
- };
|