-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.h
162 lines (133 loc) · 4.04 KB
/
Player.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#pragma once
#include "glm.h"
#include "ColliderCircle.h"
#include "Drawable.h"
#include "GameEntity.h"
#include "PhysicsObject.h"
#include "Interactable.h"
#include "util.h"
#include "Network/NetworkPacket.h"
#include "Particle.h"
class Player : public Drawable, public GameEntity, public PhysicsObject, public Interactable {
private:
// Transformations for our player
glm::vec2* translate = nullptr;
glm::vec3 rotate;
glm::vec3 scale;
// Player Movement Attributes
float base_friction_ = 50.f; // Resistance in Units/Sec
float drunk_friction_ = 5.f;
float base_accel_ = 200.f; // Acceleration in Units/Sec^2
float drunk_accel_ = 20.f;
float max_eggplant_velocity_ = 10.f; // Eggplant speed
float max_velocity_ = 20.f; // Max Velocity in Units/Sec
float sprint_modifier = 1.5f;
float entityHeldDist = 2.5f; // distance of entity from player
float seedHeldDist = 2.5f; // distance of entity from player
float veggieHeldDist = 3.f; // distance of entity from player
glm::vec2 curr_vel_ = glm::vec2(0,0);
// Current model to display
ModelEnum model;
// Currently holding
GameEntity* entityHeld = nullptr;
GameEntity* entityTriggered = nullptr;
// Current Player Collider
// Player will use a Circle Collider
// ColliderCircle* collider_;
std::vector<ColliderCircle*> colliders_;
// Moving player
void Move();
void MoveHeld();
// Get matrix transformationa
glm::mat4 GetRotation();
glm::mat4 GetTranslation();
glm::mat4 GetScale();
bool moveable = true;
public:
// current animation, no custom get/set logic so is set as public field
AniMode modelAnim;
Player();
/* Curr should be idle */
Player(ModelEnum curr);
~Player() override;
// GameEntity
void FixedUpdate() override;
// Drawable
glm::mat4 GetParentTransform() override;
ModelEnum GetModelEnum() override;
AniMode GetAniMode() override;
// The sound!!
std::vector<SoundInfo> GetSounds();
void ResetSoundBools();
// PhysicsObject
void OnCollide(PhysicsObject* object) override {}
void OnTrigger(PhysicsObject* object) override;
std::vector<Collider*> GetColliders() override;
glm::vec2* GetWorldPosition() override;
// Interactable
bool CanInteract(Player* other_player) override;
void OnInteract(Player* other_player) override;
// Input
glm::vec2 move_input{0,0};
bool sprint = false;
bool isDancing = false;
bool ui_open = false;
bool sale_confirm_ui_open = false;
void Use();
void Drop();
void Dance();
void Buy(VegetableType bought_vegetable);
void Buy(ModelEnum tool);
void Sell();
void CloseUI();
void OpenUI();
void OpenSaleUI();
void CloseSaleUI();
void EnableMovement();
void DisableMovement();
bool GetMoveable();
void SetSprint(bool sprinting);
// Information
glm::vec3 GetPosition() const;
void SetWorldPosition(glm::vec3 position);
bool GetIsHolding() const { return isHolding; }
GameEntity* GetTriggeringEntity();
GameEntity* GetHoldEntity();
void SetRotation(glm::vec3 newRot);
void SetHoldEntity(GameEntity* entity);
bool isHolding = false;
void SetTriggeringEntity(GameEntity* entity); // Set the game object we're colliding with
// how much money player currently has
float curr_balance = 50;
// particles
Particle* dust_particle = nullptr;
// stamina
float baseStaminaIncreaseRate = 10;
float oatStaminaIncreaseRate = 50;
float baseStaminaDecreaseRate = 30;
float oatStaminaDecreaseRate = 5;
float curr_stamina = 100;
// glue
bool isGlued = false;
// soju
float intoxicationTimeRemaining = 0;
float maxIntoxicationTime = 30;
// oats
float oatTimeRemaining = 0;
float maxOatTime = 10;
float playerHeight = 0;
// Sound Attributes
bool sound_buy = false;
bool sound_sell = false;
bool sound_plot_placement = false;
bool sound_poison = false;
bool sound_plant = false;
bool sound_harvest = false;
bool sound_eggplant_pickup = false;
bool sound_steal = false;
bool sound_shovel = false;
bool sound_watering = false;
bool sound_no = false;
bool sound_fertilize = false;
bool sound_net = false;
};