forked from Lallassu/voxelengine_urho3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
char.h
78 lines (66 loc) · 1.52 KB
/
char.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef __CHAR_H__
#define __CHAR_H__
#include <Urho3D/Input/Controls.h>
#include <Urho3D/Scene/LogicComponent.h>
#include <Urho3D/Input/Input.h>
#include <Urho3D/Input/InputEvents.h>
#include <Urho3D/Graphics/Model.h>
#include <Urho3D/Graphics/StaticModel.h>
#include <Urho3D/Graphics/ParticleEmitter.h>
#include <Urho3D/Graphics/ParticleEffect.h>
#include "constants.h"
#include "world.h"
#include "utils.h"
#include "vox.h"
#include "chunk.h"
using namespace Urho3D;
const static float MOVE_SPEED = 200.0f;
const static float MOUSE_SENSITIVITY = 0.1f;
class Char: public LogicComponent
{
URHO3D_OBJECT(Char, LogicComponent);
public:
Char(Context* context);
~Char();
virtual void Update(float time, float timeStep);
void Die();
void Respawn(Vector3 pos);
void AddMana(float m);
void RemoveMana(float m);
Node *node;
private:
Context* context;
StaticModel *model;
Input *input;
World *world;
Chunk *chunk;
Node *camera_node;
Scene *scene;
ParticleEmitter *emitter;
ParticleEffect *effect;
bool free_camera;
float weapon_var;
float pitch;
float velo_up;
float velo_left;
float velo_right;
float velo_back;
float velo_forward;
Vox *vox;
float scale;
bool jump;
bool jump_load;
// For distance to player
float old_distance;
float new_distance;
float old_pos;
// For camera Y
float old_y;
float new_y;
// Player attr
float mana;
int souls;
float dmg_time;
bool alive;
};
#endif