machine ParaFlee { state PreTestStart { action SetAutoMovementBlend(true) action SetRunMode(true) action SetSpeedModifier(1.0) action ClearTarget() action SetRandomTimerBetween(2, 15.0, 20.0) transition { direct goto TestStart } } state TestStart { action AcquireTarget("aggressor") transition HasTarget() { direct goto DefendChoose } transition { action SetWander() goto Wander } } state Wander { action AcquireTarget("aggressor") transition HasTarget() { direct goto DefendChoose } transition HasArrived() { goto TestStart } } ;// test end state DefendChoose { /* transition IsTimerUp(2) { goto FleeStart } transition InTargetProximity(15.0, true) == false { goto DefendStart } */ transition { action AddRandomAnimation("call", "02_lp", 1.0, 2.0) action AddRandomAnimation("call", "01_lp", 2.0, 3.0) action SendEnclosureEvent("escape_predator") goto FleeStart } } /* state DefendStart { action AcquireTarget("aggressor") transition HasTarget() { action SetSpeedModifier(1.0) call Ram RamEnd } } */ state FleeStart { action AvoidTarget(50.0, true) transition { goto FleeStopCheck } } state FleeStopCheck { transition IsTargetLatchedOn() { call ThrowOff FleeStart } transition InTargetProximity(48.0, true) == false { action SetWander() goto Wander } /* transition { goto FleeStart } transition InTargetProximity(14.5, true) == false { goto DefendStart } */ } /* state RamEnd { action SetRandomTimerBetween(1, 5.0, 6.0) transition { goto RestPause } } state RestPause { transition IsTargetLatchedOn() { ;// call EdmontThrowOff DefendStart call EdmontThrowOff FleeStopCheck } transition IsTimerUp(1) { goto FleeStart } } */ ;//------------------------ Exit States Begin ---------------------- exitstart state CleanUp { action SetSpeedModifier(1.0) action StopAnimState("shake") transition { goto CleanUpLoop } } state CleanUpLoop { transition IsAnimStatePlaying("shake") == false { goto CleanUpEnd } } exitend state CleanUpEnd { action StopAllRandomAnimations() } ;//------------------------ Exit States End ---------------------- }