#ifndef INCLUDED_SampleState_h_ #define INCLUDED_SampleState_h_ #include "Behaviors/StateNode.h" #include "Behaviors/Nodes/SoundNode.h" #include "Behaviors/Transitions/TimeOutTrans.h" #include "PlayNTimesNode.h" #include "LostTargetTrans.h" class SampleState : public StateNode { private: StateNode* startnode; public: SampleState() : StateNode("SampleState"), startnode(NULL) {} virtual void setup() { StateNode::setup(); // 音声ファイルをロード sndman->LoadFile("barkmed.wav"); // woofノードを作成 StateNode* woof_node = new PlayNTimesNode("woof","barkmed.wav",3); // woofノードを追加 addNode(woof_node); // タイムアウト遷移を追加 woof_node->addTransition(new LostTargetTrans(woof_node,ProjectInterface::visPinkBallSID,5000)); // スタート・ノード startnode = woof_node; } // 音声ファイルを解放 virtual void teardown() { sndman->ReleaseFile("barkmed.wav"); StateNode::teardown(); } virtual void DoStart() { StateNode::DoStart(); std::cout << getName() << " is starting up." << std::endl; startnode->DoStart(); } virtual void DoStop() { std::cout << getName() << " is shutting down." << std::endl; StateNode::DoStop(); } private: // Dummy functions to satisfy the compiler SampleState(const SampleState&); SampleState& operator=(const SampleState&); }; #endif