3#include "pixelbullet/serialization/node.h"
13 float recent_damage_reaction_seconds = 0.3f;
20 node[
"enabled"] << component.enabled;
21 node[
"maxHealth"] << component.max_health;
22 node[
"recentDamageReactionSeconds"] << component.recent_damage_reaction_seconds;
26inline const Node& operator>>(
const Node& node, CombatantVitalityComponent& component)
28 if (node.HasProperty(
"enabled"))
30 node[
"enabled"] >> component.enabled;
34 component.enabled =
true;
37 if (node.HasProperty(
"maxHealth"))
39 node[
"maxHealth"] >> component.max_health;
43 component.max_health = 3;
46 if (node.HasProperty(
"recentDamageReactionSeconds"))
48 node[
"recentDamageReactionSeconds"] >> component.recent_damage_reaction_seconds;
52 component.recent_damage_reaction_seconds = 0.3f;
55 component.max_health = std::max(component.max_health, 1);
56 component.recent_damage_reaction_seconds = std::max(component.recent_damage_reaction_seconds, 0.0f);
Represents a hierarchical node capable of storing various data types and supporting YAML serializatio...
Definition node.h:45
Definition combatant_vitality_component.h:10