readme
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
#ifndef CHARACTER_ACTION_CLASS
|
||||
#define CHARACTER_ACTION_CLASS
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
enum class CharacterActionType {
|
||||
Move, // walk along direction, or stand still if it's zero
|
||||
Attack, // the next swing of its combo along direction
|
||||
Jump, // up into the air, if it's standing on something
|
||||
Dash, // a quick burst along direction, or the way it faces if that's zero
|
||||
Ability // its ability in slot, aimed at point
|
||||
};
|
||||
|
||||
// Something a character's mind wants it to do this frame. Minds produce these, the body carries them out.
|
||||
struct CharacterAction {
|
||||
CharacterActionType type = CharacterActionType::Move;
|
||||
glm::vec3 direction = glm::vec3(0.0f); // Move and Attack, world space, only x and z are used
|
||||
glm::vec3 facing = glm::vec3(0.0f); // Move only, keep facing this way and walk any way. Zero turns to face where it walks.
|
||||
glm::vec3 point = glm::vec3(0.0f); // Ability only, world space, what it's aimed at
|
||||
int slot = -1; // Ability only, which of its abilities, 0 for the one on 1
|
||||
bool sprint = false; // Move only, run instead of walking
|
||||
|
||||
static CharacterAction Move(const glm::vec3& direction, const glm::vec3& facing = glm::vec3(0.0f), bool sprint = false) {
|
||||
CharacterAction action;
|
||||
action.type = CharacterActionType::Move;
|
||||
action.direction = direction;
|
||||
action.facing = facing;
|
||||
action.sprint = sprint;
|
||||
return action;
|
||||
}
|
||||
|
||||
static CharacterAction Attack(const glm::vec3& direction) {
|
||||
CharacterAction action;
|
||||
action.type = CharacterActionType::Attack;
|
||||
action.direction = direction;
|
||||
return action;
|
||||
}
|
||||
|
||||
static CharacterAction Jump() {
|
||||
CharacterAction action;
|
||||
action.type = CharacterActionType::Jump;
|
||||
return action;
|
||||
}
|
||||
|
||||
static CharacterAction Dash(const glm::vec3& direction) {
|
||||
CharacterAction action;
|
||||
action.type = CharacterActionType::Dash;
|
||||
action.direction = direction;
|
||||
return action;
|
||||
}
|
||||
|
||||
// Turns to face along direction and uses the ability in slot, aimed at point
|
||||
static CharacterAction UseAbility(int slot, const glm::vec3& direction, const glm::vec3& point) {
|
||||
CharacterAction action;
|
||||
action.type = CharacterActionType::Ability;
|
||||
action.slot = slot;
|
||||
action.direction = direction;
|
||||
action.point = point;
|
||||
return action;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user