载入中...
搜索中...
未找到
VitalsSystem.h
浏览该文件的文档.
1#pragma once
2
12#include "common/Result.h"
13
14#include <string>
15#include <vector>
16
17#include "common/Export.h"
18
19namespace eve::rpg {
20
21class RPGActor;
22
25 class RPGActor *actor = nullptr;
26 std::string resource;
27 std::string action;
28 double amount = 0.0;
29 std::string source;
30 double current = 0.0;
31 double max = 0.0;
32};
33
39public:
41 static double getCurrent(RPGActor *actor, const std::string &resource);
43 static double getMax(RPGActor *actor, const std::string &resource);
45 static void setCurrent(RPGActor *actor, const std::string &resource, double value);
46
51 static double takeDamage(RPGActor *actor, const std::string &resource, double amount,
52 const std::string &source = "");
54 static double heal(RPGActor *actor, const std::string &resource, double amount);
66 static void publishSettledChange(RPGActor *actor, const std::string &resource,
67 const std::string &action, double amount,
68 const std::string &source = "");
70 static void revive(RPGActor *actor, const std::string &resource, double amount = -1.0);
72 static bool isDead(RPGActor *actor, const std::string &resource);
73
75 static void pollEvents(std::vector<VitalsEvent> &out);
76};
77
78} // namespace eve::rpg
double value
#define EVENGINE_API_PLATFORM
Definition Export.h:107
std::string action
Definition PlayHost.cpp:117
Move-only, checked operation results for the common layer.
std::string resource
const UnitySourceAsset & source
属性 / 状态 / 技能三表合一的 ECS 实体。
Definition RPGActor.h:34
当前资源系统:读写 RPGActor::Vitals 并发出事件。 @thread 调用线程应与 RPGActor 的 ECS 线程一致。
RPG 模块的基础实体:把属性 / 状态 / 技能三张表挂到一个 ECS 实体上。
生命等资源事件:damage | heal | death | revive。
class RPGActor * actor