diff options
Diffstat (limited to 'src/systems/controlling.cpp')
| -rw-r--r-- | src/systems/controlling.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
| diff --git a/src/systems/controlling.cpp b/src/systems/controlling.cpp index e1609bd..e65c09a 100644 --- a/src/systems/controlling.cpp +++ b/src/systems/controlling.cpp | |||
| @@ -105,3 +105,32 @@ void ControllingSystem::input(int key, int action) | |||
| 105 | { | 105 | { |
| 106 | actions_.push(std::make_pair(key, action)); | 106 | actions_.push(std::make_pair(key, action)); |
| 107 | } | 107 | } |
| 108 | |||
| 109 | void ControllingSystem::freeze(id_type entity) | ||
| 110 | { | ||
| 111 | auto& controllable = game_.getEntityManager(). | ||
| 112 | getComponent<ControllableComponent>(entity); | ||
| 113 | |||
| 114 | controllable.setFrozen(true); | ||
| 115 | } | ||
| 116 | |||
| 117 | void ControllingSystem::unfreeze(id_type entity) | ||
| 118 | { | ||
| 119 | auto& controllable = game_.getEntityManager(). | ||
| 120 | getComponent<ControllableComponent>(entity); | ||
| 121 | |||
| 122 | if (controllable.isFrozen()) | ||
| 123 | { | ||
| 124 | controllable.setFrozen(false); | ||
| 125 | |||
| 126 | auto& orienting = game_.getSystemManager().getSystem<OrientingSystem>(); | ||
| 127 | |||
| 128 | if (controllable.isHoldingLeft()) | ||
| 129 | { | ||
| 130 | orienting.moveLeft(entity); | ||
| 131 | } else if (controllable.isHoldingRight()) | ||
| 132 | { | ||
| 133 | orienting.moveRight(entity); | ||
| 134 | } | ||
| 135 | } | ||
| 136 | } | ||
