#include "Behaviors/StateMachine.h"

$nodeclass Lab2Q4 : StateNode{
	$setupmachine{
		launch: StateNode =N=>{noblink, s}
		
		noblink: LedNode[setPriority(MotionManager::kBackgroundPriority);getMC()->set(RobotInfo::AllLEDMask,0.0)]
		fbark1: SoundNode("howl.wav")
		fbark2: SoundNode("barklow.wav")
		fbark3: SoundNode("ping.wav")
		rbark1: SoundNode("howl.wav")
		rbark2: SoundNode("barklow.wav")
		rbark3: SoundNode("ping.wav")
		fflash1: LedNode[getMC()->set(RobotInfo::PowerRedLEDMask, 1.0)]
		fflash2: LedNode[getMC()->set(RobotInfo::PlayLEDMask, 1.0)]
		fflash3: LedNode[getMC()->set(RobotInfo::AdvanceLEDMask, 1.0)]
		rflash1: LedNode[getMC()->set(RobotInfo::PowerRedLEDMask, 1.0)]
		rflash2: LedNode[getMC()->set(RobotInfo::PlayLEDMask, 1.0)]
		rflash3: LedNode[getMC()->set(RobotInfo::AdvanceLEDMask, 1.0)]
		
		s: StateNode =N=> {fbark1, fflash1}
		{fbark1, fflash1} =C=> {fbark2, fflash2} =C=> {fbark3, fflash3} =C=> {fbark1, fflash1}
		{rbark3, rflash3} =C=> {rbark2, rflash2} =C=> {rbark1, rflash1} =C=> {rbark3, rflash3}
		{fbark1, fflash1} =B(RobotInfo::BumpLeftButOffset)=> {rbark3, rflash3} =B(RobotInfo::BumpLeftButOffset)=> {fbark1, fflash1}
		{fbark2, fflash2} =B(RobotInfo::BumpLeftButOffset)=> {rbark1, rflash1} =B(RobotInfo::BumpLeftButOffset)=> {fbark2, fflash2}
		{fbark3, fflash3} =B(RobotInfo::BumpLeftButOffset)=> {rbark2, rflash2} =B(RobotInfo::BumpLeftButOffset)=> {fbark3, fflash3}
	}
}

REGISTER_BEHAVIOR(Lab2Q4);
