Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
PaceTargetsMachine.ccGo to the documentation of this file.00001 #include "PaceTargetsMachine.h" 00002 #include "Behaviors/Transition.h" 00003 #include "Behaviors/Nodes/WalkToTargetNode.h" 00004 #include "Behaviors/Nodes/WalkNode.h" 00005 #include "ExploreMachine.h" 00006 #include "Behaviors/Transitions/TimeOutTrans.h" 00007 #include "Behaviors/Transitions/VisualTargetTrans.h" 00008 #include "Behaviors/Nodes/OutputNode.h" 00009 #include "Behaviors/Nodes/PlayMotionSequenceNode.h" 00010 #include "Behaviors/Nodes/GroupNode.h" 00011 #include "SoundPlay/SoundManager.h" 00012 00013 void PaceTargetsMachine::setup() { 00014 StateNode::setup(); 00015 00016 WalkNode * turnAround = new WalkNode(0,0,1); 00017 turnAround->setName(getName()+"::TurnAround"); 00018 addNode(turnAround); 00019 00020 GroupNode * explGrp = new GroupNode(getName()+"::ExplGroup"); 00021 addNode(explGrp); 00022 { 00023 ExploreMachine * explore = new ExploreMachine(explGrp->getName()+"::Explore"); 00024 explGrp->addNode(explore); 00025 SmallPlayMotionSequenceNode * panhead = new SmallPlayMotionSequenceNode(explGrp->getName()+"::PanHead","/ms/data/motion/pan_head.mot",true); 00026 explGrp->addNode(panhead); 00027 } 00028 00029 WalkToTargetNode * chase = new WalkToTargetNode(ProjectInterface::visPinkBallSID); 00030 chase->setName(getName()+"::Chase"); 00031 addNode(chase); 00032 00033 //starts out exploring 00034 start=explGrp; 00035 00036 Transition * tmptrans=NULL; 00037 00038 //if it sees pink, chase it 00039 explGrp->addTransition(tmptrans=new VisualTargetTrans(chase,ProjectInterface::visPinkBallSID)); 00040 tmptrans->setSound("cutey.wav"); 00041 00042 //if you lose it, explore some more 00043 chase->addTransition(tmptrans=chase->newDefaultLostTrans(explGrp)); 00044 tmptrans->setSound("whimper.wav"); 00045 00046 //if you get there, turn around 00047 chase->addTransition(tmptrans=chase->newDefaultCloseTrans(turnAround)); 00048 tmptrans->setSound("fart.wav"); 00049 00050 //once you've turned around, explore 00051 turnAround->addTransition(tmptrans=new TimeOutTrans(explGrp,3500)); 00052 tmptrans->setSound("barkmed.wav"); 00053 00054 //preload the sounds so we don't pause on tranisitions 00055 sndman->LoadFile("cutey.wav"); 00056 sndman->LoadFile("barkmed.wav"); 00057 sndman->LoadFile("whimper.wav"); 00058 sndman->LoadFile("fart.wav"); 00059 } 00060 00061 void PaceTargetsMachine::DoStart() { 00062 StateNode::DoStart(); 00063 start->DoStart(); 00064 } 00065 00066 void PaceTargetsMachine::teardown() { 00067 //release the sounds 00068 sndman->ReleaseFile("cutey.wav"); 00069 sndman->ReleaseFile("barkmed.wav"); 00070 sndman->ReleaseFile("whimper.wav"); 00071 sndman->ReleaseFile("fart.wav"); 00072 StateNode::teardown(); 00073 } 00074 00075 /*! @file 00076 * @brief Implements PaceTargetsMachine, a StateMachine for walking back and forth between two visual targets 00077 * @author ejt (Creator) 00078 * 00079 * $Author: ejt $ 00080 * $Name: tekkotsu-2_2_2 $ 00081 * $Revision: 1.15 $ 00082 * $State: Exp $ 00083 * $Date: 2004/12/21 20:29:07 $ 00084 */ 00085 |
Tekkotsu v2.2.2 |
Generated Tue Jan 4 15:43:14 2005 by Doxygen 1.4.0 |