|
6 | 6 |
|
7 | 7 | #ifdef Ivy
|
8 | 8 |
|
9 |
| -#include "Anim/drivers/EmoDriver.h" |
| 9 | +//#include "Anim/drivers/EmoDriver.h" |
10 | 10 | #include "Engine/Behavior/EventDispatcher.h"
|
11 | 11 |
|
12 |
| -BT::NodeStatus BT::ControlAnim::onStart() { |
13 |
| - auto a = Anim::create({}, [this](Anim::anim_complete_ret ret) { this->set_status(ret); }); |
14 |
| - for (auto child: children()) { |
15 |
| - Optional<int> ret = child->getInput<int>(ANIMATION_NODE_N); |
16 |
| - if (!ret) { |
17 |
| - return NodeStatus::FAILURE; |
18 |
| - } |
19 |
| - a->add_unit(AnimUnit(child->name(), ret.value())); |
20 |
| - log_v("debug-bt add %s | %d", child->name().c_str(), n.value()); |
21 |
| - } |
22 |
| - anim = a; |
23 |
| - bool ret = EmoDriver::instance().set_current_anim(a); |
24 |
| - if (ret) { |
25 |
| - return NodeStatus::RUNNING; |
26 |
| - } else { |
27 |
| - return NodeStatus::FAILURE; |
28 |
| - } |
29 |
| -} |
30 |
| - |
31 |
| - |
32 |
| -void BT::ControlAnim::onHalted() { |
33 |
| - std::shared_ptr<Anim> a = anim.lock(); |
34 |
| - if (a) { |
35 |
| - a->set_complete(Anim::interrupted); |
36 |
| - } |
37 |
| -} |
38 |
| - |
39 |
| -void BT::ControlAnim::set_status(Anim::anim_complete_ret t_status) { |
40 |
| - if (t_status == Anim::success) { |
41 |
| - setStatus(NodeStatus::SUCCESS); |
42 |
| - } else if (t_status == Anim::failure || t_status == Anim::interrupted) { |
43 |
| - setStatus(NodeStatus::FAILURE); |
44 |
| - } |
45 |
| - EventDispatcher::instance().dispatch(blank_tick); |
46 |
| -} |
| 12 | +//BT::NodeStatus BT::ControlAnim::onStart() { |
| 13 | +// auto a = Anim::create({}, [this](Anim::anim_complete_ret ret) { this->set_status(ret); }); |
| 14 | +// for (auto child: children()) { |
| 15 | +// Optional<int> ret = child->getInput<int>(ANIMATION_NODE_N); |
| 16 | +// if (!ret) { |
| 17 | +// return NodeStatus::FAILURE; |
| 18 | +// } |
| 19 | +// a->add_unit(AnimUnit(child->name(), ret.value())); |
| 20 | +// log_v("debug-bt add %s | %d", child->name().c_str(), n.value()); |
| 21 | +// } |
| 22 | +// anim = a; |
| 23 | +// bool ret = EmoDriver::instance().set_current_anim(a); |
| 24 | +// if (ret) { |
| 25 | +// return NodeStatus::RUNNING; |
| 26 | +// } else { |
| 27 | +// return NodeStatus::FAILURE; |
| 28 | +// } |
| 29 | +//} |
| 30 | + |
| 31 | + |
| 32 | +//void BT::ControlAnim::onHalted() { |
| 33 | +// std::shared_ptr<Anim> a = anim.lock(); |
| 34 | +// if (a) { |
| 35 | +// a->set_complete(Anim::interrupted); |
| 36 | +// } |
| 37 | +//} |
| 38 | + |
| 39 | +//void BT::ControlAnim::set_status(Anim::anim_complete_ret t_status) { |
| 40 | +// if (t_status == Anim::success) { |
| 41 | +// setStatus(NodeStatus::SUCCESS); |
| 42 | +// } else if (t_status == Anim::failure || t_status == Anim::interrupted) { |
| 43 | +// setStatus(NodeStatus::FAILURE); |
| 44 | +// } |
| 45 | +// EventDispatcher::instance().dispatch(blank_tick); |
| 46 | +//} |
47 | 47 |
|
48 | 48 | #else
|
49 | 49 |
|
|
0 commit comments