Simulant  21.12-574
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
stage_node_behaviour.h
1 #pragma once
2 
3 #include "behaviour.h"
4 #include "../nodes/stage_node.h"
5 #include "../macros.h"
6 
7 namespace smlt {
8 
9 namespace behaviours {
10 
12  public Behaviour {
13 
14 public:
15  StageNodeBehaviour() = default;
16 
17 protected:
18  void on_behaviour_added(Organism* controllable) override {
19  stage_node_ = dynamic_cast<StageNode*>(controllable);
20  }
21 
22  void on_behaviour_removed(Organism *controllable) override {
23  _S_UNUSED(controllable);
24 
25  stage_node_ = nullptr;
26  }
27 
28 private:
29  StageNode* stage_node_ = nullptr;
30 
31 public:
32  Property<decltype(&StageNodeBehaviour::stage_node_)> stage_node = { this, &StageNodeBehaviour::stage_node_ };
33 };
34 
35 }
36 }
smlt::Property
Definition: property.h:202
smlt::Organism
Definition: behaviour.h:132
smlt::behaviours::StageNodeBehaviour
Definition: stage_node_behaviour.h:12
smlt
Definition: animation.cpp:25
smlt::Behaviour
Definition: behaviour.h:44
smlt::StageNode
Definition: stage_node.h:62