VOX
A little voxel engine
Loading...
Searching...
No Matches
Mob.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "define.hpp"
4#include "Transform.hpp"
5#include "Camera.hpp"
6#include "HitBox.hpp"
7#include "Block.hpp"
8
9#include <glm/glm.hpp>
10#include <glm/gtc/matrix_transform.hpp>
11
12#include "Tracy.hpp"
13
14#include <cstdint>
15#include <chrono>
16#include <mutex>
17#include <optional>
18
19class Mob
20{
21
22public:
23
24 Mob();
25 ~Mob();
26
27 Mob(Mob & other) = delete;
28 Mob(Mob && other) = delete;
29 Mob & operator=(Mob & other) = delete;
30 Mob & operator=(Mob && other) = delete;
31
32 bool canJump() const;
33 void startJump();
34
35 void startFall();
36 double fallDuration();
37
38 TracyLockableN(std::mutex, mutex, "Mob Mutex");
39
40 Transform transform = Transform({0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {1.0, 1.0, 1.0});
41 HitBox hitbox = HitBox({-0.4, 0, -0.4}, {0.8, 1.8, 0.8});
42 HitBox feet = HitBox({-0.4, -0.01, -0.4}, {0.8, 0.1, 0.8});
43
44 glm::dvec3 velocity = glm::dvec3(0.0);
45
46 bool on_ground = false;
47 bool jumping = false;
48
50
51 glm::dvec3 target_position = glm::dvec3(0.0);
52
53 bool should_jump = false;
54
55private:
56
57 std::chrono::time_point<std::chrono::steady_clock> fall_start_time;
58 glm::dvec3 fall_start_position;
59
60 // std::chrono::nanoseconds last_jump_time = std::chrono::steady_clock::now().time_since_epoch();
61 // std::chrono::milliseconds jump_delai = std::chrono::milliseconds(500);
62 // std::chrono::milliseconds jump_delai_after_fall = std::chrono::milliseconds(100);
63
64};
Definition: HitBox.hpp:11
Definition: Mob.hpp:20
HitBox hitbox
Definition: Mob.hpp:41
double fallDuration()
Definition: Mob.cpp:28
Mob & operator=(Mob &&other)=delete
TracyLockableN(std::mutex, mutex, "Mob Mutex")
Mob(Mob &other)=delete
HitBox feet
Definition: Mob.hpp:42
bool canJump() const
Definition: Mob.cpp:11
int jump_remaining
Definition: Mob.hpp:49
~Mob()
Definition: Mob.cpp:7
glm::dvec3 target_position
Definition: Mob.hpp:51
glm::dvec3 velocity
Definition: Mob.hpp:44
Mob(Mob &&other)=delete
Mob()
Definition: Mob.cpp:3
bool jumping
Definition: Mob.hpp:47
bool should_jump
Definition: Mob.hpp:53
Mob & operator=(Mob &other)=delete
void startFall()
Definition: Mob.cpp:22
bool on_ground
Definition: Mob.hpp:46
void startJump()
Definition: Mob.cpp:16
Definition: Transform.hpp:11
Definition: test_main.cpp:24