1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #pragma once
- #include <Model3D.h>
- #include <Either.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;
- };
- 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;
- public:
- Entity( const EntityType* zType, bool hasInventory );
- ~Entity();
- virtual bool tick( double time ) override;
- int getId() const;
- const EntityType* zType() const;
- int getCurrentDimension() const;
- friend EntityType;
- };
|