/* Dilopho Human Attack // // This machine should be used through the normal call mechanism // */ machine DilophoVistorAttack { state AttackStart { transition HasTarget() == false { goto AttackExitEnd } transition IsTargetDead() { goto AttackExitEnd } transition IsTargetHuman() == false { goto AttackExitEnd } action SetSpeedModifier(1.0) action SetRunMode(true) action StopLook() transition InTargetProximityRadius(1.15, true) { direct goto AttackSetup } transition { goto SeekHuman } } state SeekHuman { action SendEnclosureEvent("seek_prey") transition { action SetAvoidanceSteer(false) goto SeekLoop } transition { action ClearTarget() goto AttackExitStart } } state SeekLoop { /* Param0: float distance offset Param1: float rotation offset Param2: bool True if we should face target. Param3: bool True if we want a random rotation Param4: bool True if rotation is offset from forward */ action SeekTargetOffset(0.5, 0.0, false, false, true) transition HasTarget() == false { goto AttackExitEnd } transition IsTargetDead() { goto AttackExitEnd } transition InTargetProximityRadius(1.15, true) { direct goto AttackSetup } } state AttackSetup { transition IsTargetDead() { goto AttackExitEnd } transition IsAnimPlayingTarget("rcl", "lt", false) { goto AttackExitStart } transition IsAnimPlayingTarget("fall", "st", false) { goto AttackExitStart } action LockMachine(true) action ControlHuman() action KillHuman() action SetStandStill() action SetSpeedDirect(0.0) ;// action FaceTargetInstant() action SetAutoMovementBlendTarget(false) action StopAllUserAnimationsTarget() ;// action SetTargetToFaceMe() ;// action SetRandomTimerBetween(1, 0.26, 0.26) transition { direct goto VisInit } } state VisInit { ;// action FaceTargetInstant() ;// action SetTargetToFaceMe() transition ;//IsTimerUp(1) { action PlayAnimTarget("rcl", "lt", false) action SetLockLastPoseTarget("rcl", "lt", false) action SetRandomTimerBetween(3, 5.0, 5.0) goto RecoilLoop } } state RecoilLoop { transition IsAnimPlayingTarget("rcl", "lt", false) == false { action PlayAnimTarget("fall", "st", false) action SetLockLastPoseTarget("fall", "st", false) goto Attackloop } transition IsTimerUp(3) { action PlayAnimTarget("fall", "st", false) action SetLockLastPoseTarget("fall", "st", false) goto Attackloop } } state Attackloop { transition { action SetRandomTimerBetween(3, 2.0, 2.0) goto AttackFinish } } state AttackFinish { transition IsTimerUp(3) { action SetAutoMovementBlend(false) action PlayAnimInstant("idle", "post_lp", false) goto PostureWait } } state PostureWait { transition IsAnimPlaying("idle", "post_lp", false) == false { action SetAutoMovementBlend(true) action SetSpeedModifierWalk(1.0) action SetRunMode(false) action SeekTargetOffset(4.0, 0, false, true, true) action SetRandomTimerBetween(1, 1.0, 1.0) action AddKillExperience(1, 0.0) goto MoveOffHuman } } state MoveOffHuman { transition IsTimerUp(1) { action SetStandStill() goto AttackExitStart } transition InTargetProximityRadius(1.0, true) == false { action SetStandStill() goto AttackExitStart } transition HasArrived() { goto AttackExitStart } } ;------------------------ Exit States Begin ---------------------- exitstart state AttackExitStart { action UpdateVariable("Stress", -0.05) transition { goto AttackExitEnd } } exitend state AttackExitEnd { action SetSpeedModifier(1.0) action SetRunMode(false) action SetAvoidanceSteer(true) action SetAvoidanceWorld(true) action StopAnimState("atk") action LockMachine(false) } ;------------------------ Exit States End ---------------------- }