
;// generic Rogue behaviour script
machine Rogue
{
	
	default state RogueInit
	{
		action Print("\n\nIn Rogue!!!\n\n")
		action AddRandomAnimation("look", "left", 10.0, 25.0)
		action AddRandomAnimation("look", "right", 10.0, 25.0)

		action SetRunMode(true)
		action SetSpeedModifierRun(4.0)

		transition
		{
			goto RogueStart
		}
		
	}
	
	state RogueStart
	{
		;// move away from territory in the dir of people 
		action SetRandomTimerBetween(1, 10.0, 14.0)
		transition FindHumanTarget()
		{
			action SeekTarget()
			goto Wandering
		}
		
		;// there are no people near.. just get away from territory..
		transition
		{
			action AvoidTerritory(150.0)
			action SeekTarget()
			goto Wandering
		}
	}

	state Wandering
	{
		action CheckForSquashing()
		;// keep checking to see if humans are close.. 
		transition AcquireDinoTargetInProximity(40.0, 100.0)
		{
			;// they are.. attack!
			goto AttackTarget
		}

		;// if there is a wall or building in the way with people in it... attack it
		transition IsBuildingWithPeopleInPath(true)
		{
			goto AttackBuilding
		}

		;// recheck direction
		transition IsTimerUp(1)
		{
			goto RogueStart
		}
	}

	state AttackBuilding
	{
		;// See if I can enter building
		transition EnterBuilding(true) == true
		{
			goto InsideBuilding
		}
		
		;// Cant enter it, so I may aswell just attack it from the outside!
		transition
		{
			goto AttackTarget
		}
	}

	state InsideBuilding
	{
		;// stay in thi  s state until I am back out of the building...
		transition IsInBuilding()
		{
			goto RogueStart
		}
	}

	state AttackTarget
	{
		transition HasTarget() == false
		{
			action Print("\n\n[Rogue.fsm::AttackTarget] Have No target!!\n")
			action Assert(0)
			goto RogueStart
		}
		transition
		{
			action SetNumPassedParam(1)
			action SetPassedParamTailAttack(0)
			call Swipe RogueStart
		}
	}	

;------------------------ Exit States Begin ----------------------
	exitstart state CleanUp
	{
		action SetSpeedModifier(1.0)
		action SetRunMode(false)
		action SetAutoMovementBlend(true)
		action LookEnd()
		transition
		{
			goto CleanUpEnd
		}
	}

	exitend state CleanUpEnd
	{

	}
;------------------------ Exit States End ----------------------

}