#include "Behaviors/StateMachine.h"

$nodeclass Multitasking : StateNode {
  $setupmachine{

    launch: StateNode =N=> {barklow, redflash}

    barklow: SoundNode($,"barklow.wav")
    barklow =C=> barkmed
    barklow =B(RobotInfo::GreenButOffset)[]=> rbarkhigh

    barkmed: SoundNode($,"barkmed.wav")
    barkmed =C=> barkhigh
    barkmed =B(RobotInfo::GreenButOffset)[]=> rbarklow

    barkhigh: SoundNode($,"barkhigh.wav")
    barkhigh =C=> barklow
    barkhigh =B(RobotInfo::GreenButOffset)[]=> rbarkmed

    redflash:LedNode [getMC()->cflash(RobotInfo::RedLEDMask, 1.0, 1000)]
    redflash =C=> yellowflash
    redflash =B(RobotInfo::GreenButOffset)[]=> rblueflash

    yellowflash:LedNode [getMC()->cflash(RobotInfo::YellowLEDMask, 1.0, 1000)]
    yellowflash =C=> greenflash
    yellowflash =B(RobotInfo::GreenButOffset)[]=> rredflash

    greenflash:LedNode [getMC()->cflash(RobotInfo::GreenLEDMask, 1.0, 1000)]
    greenflash =C=> blueflash
    greenflash =B(RobotInfo::GreenButOffset)[]=> ryellowflash

    blueflash:LedNode [getMC()->cflash(RobotInfo::BlueLEDMask, 1.0, 1000)]
    blueflash =C=> redflash
    blueflash =B(RobotInfo::GreenButOffset)[]=> rgreenflash

    rbarklow: SoundNode($,"barklow.wav")
    rbarklow =C=> rbarkhigh
    rbarklow =B(RobotInfo::GreenButOffset)[]=> barkmed

    rbarkmed: SoundNode($,"barkmed.wav")
    rbarkmed =C=> rbarklow
    rbarkmed =B(RobotInfo::GreenButOffset)[]=> barkhigh

    rbarkhigh: SoundNode($,"barkhigh.wav")
    rbarkhigh =C=> rbarkmed
    rbarkhigh =B(RobotInfo::GreenButOffset)[]=> barklow

    rredflash:LedNode [getMC()->cflash(RobotInfo::RedLEDMask, 1.0, 1000)]
    rredflash =C=> rblueflash
    rredflash =B(RobotInfo::GreenButOffset)[]=> yellowflash

    ryellowflash:LedNode [getMC()->cflash(RobotInfo::YellowLEDMask, 1.0, 1000)]
    ryellowflash =C=> rredflash
    ryellowflash =B(RobotInfo::GreenButOffset)[]=> greenflash

    rgreenflash:LedNode [getMC()->cflash(RobotInfo::GreenLEDMask, 1.0, 1000)]
    rgreenflash =C=> ryellowflash
    rgreenflash =B(RobotInfo::GreenButOffset)[]=> blueflash

    rblueflash:LedNode [getMC()->cflash(RobotInfo::BlueLEDMask, 1.0, 1000)]
    rblueflash =C=> rgreenflash
    rblueflash =B(RobotInfo::GreenButOffset)[]=> redflash

  }

}

REGISTER_BEHAVIOR(Multitasking);
