3#include "pixelbullet/serialization/node.h"
13 float move_speed = 4.5f;
14 float sprint_multiplier = 1.75f;
15 float eye_height = 1.6f;
16 float min_pitch_degrees = -85.0f;
17 float max_pitch_degrees = 85.0f;
24 node[
"enabled"] << component.enabled;
25 node[
"primary"] << component.primary;
26 node[
"moveSpeed"] << component.move_speed;
27 node[
"sprintMultiplier"] << component.sprint_multiplier;
28 node[
"eyeHeight"] << component.eye_height;
29 node[
"minPitchDegrees"] << component.min_pitch_degrees;
30 node[
"maxPitchDegrees"] << component.max_pitch_degrees;
34inline const Node& operator>>(
const Node& node, FirstPersonPawnComponent& component)
36 if (node.HasProperty(
"enabled"))
38 node[
"enabled"] >> component.enabled;
40 if (node.HasProperty(
"primary"))
42 node[
"primary"] >> component.primary;
44 if (node.HasProperty(
"moveSpeed"))
46 node[
"moveSpeed"] >> component.move_speed;
48 if (node.HasProperty(
"sprintMultiplier"))
50 node[
"sprintMultiplier"] >> component.sprint_multiplier;
52 if (node.HasProperty(
"eyeHeight"))
54 node[
"eyeHeight"] >> component.eye_height;
56 if (node.HasProperty(
"minPitchDegrees"))
58 node[
"minPitchDegrees"] >> component.min_pitch_degrees;
60 if (node.HasProperty(
"maxPitchDegrees"))
62 node[
"maxPitchDegrees"] >> component.max_pitch_degrees;
64 component.move_speed = std::max(component.move_speed, 0.0f);
65 component.sprint_multiplier = std::max(component.sprint_multiplier, 1.0f);
66 component.eye_height = std::max(component.eye_height, 0.0f);
67 if (component.max_pitch_degrees < component.min_pitch_degrees)
69 std::swap(component.min_pitch_degrees, component.max_pitch_degrees);
Represents a hierarchical node capable of storing various data types and supporting YAML serializatio...
Definition node.h:45
Definition first_person_pawn_component.h:10