//-*-c++-*-
#ifndef INCLUDED_ForkJoinBehavior_h_
#define INCLUDED_ForkJoinBehavior_h_
 
#include "Behaviors/StateMachine.h"
#include "Events/EventRouter.h"

class ForkJoinBehavior : public StateNode {

public:
  ForkJoinBehavior() : StateNode("ForkJoinBehavior") {}
 
  virtual void setup() {
#statemachine

startnode: StateNode =N=> {lightred, howl, nolight}

nolight: LedNode [setPriority(MotionManager::kBackgroundPriority);
	          getMC()->set(RobotInfo::FaceLEDMask,0.0);]


barklow: SoundNode($,"barklow.wav")

howl: SoundNode($,"howl.wav")

ping: SoundNode($,"ping.wav")

toc: SoundNode($,"toc.wav")

barklowback: SoundNode($,"barklow.wav")

howlback: SoundNode($,"howl.wav")

pingback: SoundNode($,"ping.wav")

tocback: SoundNode($,"toc.wav")


//barklow =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> tocback

//howl =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> barklowback

//ping =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> howlback

//toc =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> pingback

//barklowback =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> howl

//howlback =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> ping

//pingback =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> toc

//tocback =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> barklow


lightred: LedNode [getMC()->set(RobotInfo::RedLEDMask,1.0);]

lightyellow: LedNode [getMC()->set(RobotInfo::YellowLEDMask,1.0);]

lightgreen: LedNode [getMC()->set(RobotInfo::GreenLEDMask,1.0);]

lightblue: LedNode [getMC()->set(RobotInfo::BlueLEDMask,1.0);]

lightredback: LedNode [getMC()->set(RobotInfo::RedLEDMask,1.0);]

lightyellowback: LedNode [getMC()->set(RobotInfo::YellowLEDMask,1.0);]

lightgreenback: LedNode [getMC()->set(RobotInfo::GreenLEDMask,1.0);]

lightblueback: LedNode [getMC()->set(RobotInfo::BlueLEDMask,1.0);]

{lightred,howl} =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> 
	{lightblueback,tocback}

{lightyellow,barklow} =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> 
	{lightredback,howlback}

{lightgreen,ping} =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> 
	{lightyellowback,barklowback}

{lightblue,toc} =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> 
	{lightgreenback,pingback}

{lightredback,howlback} =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> 
	{lightyellow,barklow}

{lightyellowback,barklowback} =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> 
	{lightgreen,ping}

{lightgreenback,pingback} =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> 
	{lightblue,toc}

{lightblueback,tocback} =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> 
	{lightred,howl}

{lightred,howl} =C(1)=> {lightyellow,barklow}

{lightyellow,barklow} =C(1)=> {lightgreen,ping}

{lightgreen,ping} =C(1)=> {lightblue,toc}

{lightblue,toc} =C(1)=> {lightred,howl}

{lightredback,howlback} =C(1)=> {lightblueback,tocback}

{lightyellowback,barklowback} =C(1)=> {lightredback,howlback}

{lightgreenback,pingback} =C(1)=> {lightyellowback,barklowback}

{lightblueback,tocback} =C(1)=> {lightgreenback,pingback}


#endstatemachine
  }       // end of setup()

};

#endif
