Graphics Reference
In-Depth Information
case AIState.stopped_turning_left:
// look for chase target
if( followTarget!=null )
LookAroundFor( followTarget );
// stopped, turning left
TurnLeft();
if( obstacleFinderResult==0 )
{
SetAIState( AIState.moving_looking_for_
target );
}
break;
case AIState.stopped_turning_right:
// look for chase target
if( followTarget!=null )
LookAroundFor( followTarget );
// stopped, turning right
TurnRight ();
// check results from looking, to see if path ahead
// is clear
if( obstacleFinderResult==0 )
{
SetAIState( AIState.moving_looking_for_
target );
}
break;
case AIState.paused_looking_for_target:
// standing still, with looking for chase target
// look for chase target
if( followTarget!=null )
LookAroundFor( followTarget );
break;
case AIState.translate_along_waypoint_path:
// following waypoints (moving toward them, not
// pointing at them) at the speed of moveSpeed
// make sure we have been initialized before trying
// to access waypoints
if( !didInit && !reachedLastWaypoint )
return;
UpdateWaypoints();
// move the ship
if( !isStationary )
{
targetMoveVec = Vector3.Normalize
( currentWaypointTransform.position -
myTransform.position );
moveVec= Vector3.Lerp( moveVec, targetMoveVec,
Time.deltaTime * pathSmoothing );
myTransform.Translate( moveVec * moveSpeed *
Time.deltaTime );
Search WWH ::




Custom Search