/* Stegosaurus Special Gen anims; Spcl_gen_lp- (a long stretch) - Spcl_sctch_Lp- (rubs head against the ground) - when dinosaur has tick infestation Spcl_play- (rears up and throws weight down) - when dinosaur as a posture when dinosaur perceives a predator Tail_def- (thrashes tail in defence while fleeing) - when dinosaur is fleeing a predator Tail_play_Lp- (waves tail up in the air) - when dinosaur is being threatened Anky Scratches head on ground. Thumps tail on ground (meant for idle_post but ended up as a spcl_gen) Rears up on hind legs and roars (idle_post, not being played) */ machine StegFlee { state PreTestStart { action SetAutoMovementBlend(true) action SetRunMode(true) action SetSpeedModifier(1.0) action ClearTarget() action SetRandomTimerBetween(2, 15.0, 20.0) /* action AcquireTarget("aggressor") transition HasTarget() { direct goto Defense } */ transition { direct goto TestStart } } state Defense { action SetStandStill() transition { action FaceTarget(); goto DefenseFaceWait } } state DefenseFaceWait { transition HasArrived() { action SetDefenseRoarTarget(true) goto DefensePosture } } state DefensePosture { transition IsAnimLoaded("spcl", "gen_play") { action SetSpeedDirect(0.0) action SetStandStill() action StopAllUserAnimations() action SetAutoMovementBlend(false) action StopLook() action PlayAnimInstant("spcl", "gen_play", false) goto DefensePostureWait } transition { action SetAutoMovementBlend(true) goto TestStart } } state DefensePostureWait { transition IsAnimPlaying("spcl", "gen_play", false) == false { action SetAutoMovementBlend(true) action SetRandomTimerBetween(1, 2.0, 3.0) goto DefensePosturePause } } state DefensePosturePause { transition IsTimerUp(1) { 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 EdmontThrowOff DefendStart call EdmontThrowOff FleeStart } transition InTargetProximity(48.0, true) == false { action SetWander() goto Wander } transition IsTimerUp(3) == false { goto FleeStopcheck } transition InTargetProximityRadius(12.0, true) == true { goto TailSwing } /* transition { goto FleeStart } */ } state TailSwing { action PlayAnim("tail", "def", false) transition { action SetRandomTimerBetween(1, 0.6, 0.6) goto TailSwingLoop } } state TailSwingLoop { transition IsAnimPlaying("tail", "def", false) == false { action SetRandomTimerBetween(3, 2.5, 4.0) goto FleeStopCheck } ;// action CheckTailHittingTarget(16.0, 2.2) transition IsTimerUp(1) { goto TailSwingHitCheck } } state TailSwingHitCheck { transition IsAnimPlaying("tail", "def", false) == false { goto FleeStopCheck } action CheckTailHittingTarget(16.0, 0.5) } /* 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 ---------------------- }