private void EnterAtHeightState() { LeaveState(); curState = FSMDroneState.AtHeight; if (debugFSM) { Debug.Log(string.Format("{0}: Entering ", curState)); } }
private void EnterFreeMovementState() { LeaveState(); curState = FSMDroneState.FreeMovement; if (debugFSM) { Debug.Log(string.Format("{0}: Entering ", curState)); } }
// Every state XXX need functions EnterXXXState(), UpdateXXXState, and a case in LeaveState(). // By convention, EnterXXXState() should start with a call to LeaveState(). private void EnterStartState() { //LeaveState() is not called for the initial state. curState = FSMDroneState.Start; if (debugFSM) { Debug.Log(string.Format("{0}: Entering ", curState)); } }
private void EnterAdjustLateralState() { LeaveState(); curState = FSMDroneState.AdjustLateral; if (debugFSM) { Debug.Log(string.Format("{0}: Entering ", curState)); } travelBehavior.BeginLateralJourney(thisScript); }
private void EnterLandingState() { LeaveState(); curState = FSMDroneState.Landing; if (debugFSM) { Debug.Log(string.Format("{0}: Entering ", curState)); } ResetJourney(); }
private void EnterAtDestinationState() { LeaveState(); curState = FSMDroneState.AtDestination; if (debugFSM) { Debug.Log(string.Format("{0}: Entering", curState)); } // If the user has changed the travel or motion mode, make the switch here. SetUserTravelAndMotion(); if (curMode == DroneMode.Maintain) { // In Maintain mode, do not do anything. return; } if (curMode == DroneMode.Hover) { effectiveTarget = targetBehavior.GetEffectiveTarget(transform, target, thisScript); EnterAdjustHeightState(); } if (curMode == DroneMode.Patrol || curMode == DroneMode.Follow) { if (!nextWaypoint) { Debug.LogError("Error: nextWaypoint must be set in the Inspector."); SetMaintainMode(); return; } } if (curMode == DroneMode.Patrol) { // If patrolling and waypoint reached, identify the next waypoint. targetBehavior.AdvanceWaypoints(nextWaypoint, target, thisScript); EnterAdjustLateralState(); } if (curMode == DroneMode.Follow) { // If following, constrained to waypoints, and waypoint has been reached, // identify the next waypoint. if (CloseToNextWaypoint()) { targetBehavior.AdvanceWaypoints(nextWaypoint, target, thisScript); effectiveTarget = targetBehavior.GetEffectiveTarget(transform, target, thisScript); } if (CloseToPrevWaypoint()) { targetBehavior.AdvanceWaypoints(prevWaypoint, target, thisScript); effectiveTarget = targetBehavior.GetEffectiveTarget(transform, target, thisScript); } if (!AtTargetLateralPos()) { EnterAdjustLateralState(); } } }
private void EnterAtDestinationState() { LeaveState(); curState = FSMDroneState.AtDestination; if (debugFSM) Debug.Log(string.Format("{0}: Entering", curState)); // If the user has changed the travel or motion mode, make the switch here. SetUserTravelAndMotion(); if (curMode == DroneMode.Maintain) { // In Maintain mode, do not do anything. return; } if (curMode == DroneMode.Hover) { effectiveTarget = targetBehavior.GetEffectiveTarget(transform, target, thisScript); EnterAdjustHeightState(); } if (curMode == DroneMode.Patrol || curMode == DroneMode.Follow) { if (!nextWaypoint) { Debug.LogError("Error: nextWaypoint must be set in the Inspector."); SetMaintainMode(); return; } } if (curMode == DroneMode.Patrol) { // If patrolling and waypoint reached, identify the next waypoint. targetBehavior.AdvanceWaypoints(nextWaypoint, target, thisScript); EnterAdjustLateralState(); } if (curMode == DroneMode.Follow) { // If following, constrained to waypoints, and waypoint has been reached, // identify the next waypoint. if (CloseToNextWaypoint()) { targetBehavior.AdvanceWaypoints(nextWaypoint, target, thisScript); effectiveTarget = targetBehavior.GetEffectiveTarget(transform, target, thisScript); } if (CloseToPrevWaypoint()) { targetBehavior.AdvanceWaypoints(prevWaypoint, target, thisScript); effectiveTarget = targetBehavior.GetEffectiveTarget(transform, target, thisScript); } if (!AtTargetLateralPos()) EnterAdjustLateralState(); } }
private void EnterAdjustLateralState() { LeaveState(); curState = FSMDroneState.AdjustLateral; if (debugFSM) Debug.Log(string.Format("{0}: Entering ", curState)); travelBehavior.BeginLateralJourney(thisScript); }
private void EnterAtHeightState() { LeaveState(); curState = FSMDroneState.AtHeight; if (debugFSM) Debug.Log(string.Format("{0}: Entering ", curState)); }
private void EnterLandingState() { LeaveState(); curState = FSMDroneState.Landing; if (debugFSM) Debug.Log(string.Format("{0}: Entering ", curState)); ResetJourney(); }
private void EnterFreeMovementState() { LeaveState(); curState = FSMDroneState.FreeMovement; if (debugFSM) Debug.Log(string.Format("{0}: Entering ", curState)); }
// Every state XXX need functions EnterXXXState(), UpdateXXXState, and a case in LeaveState(). // By convention, EnterXXXState() should start with a call to LeaveState(). private void EnterStartState() { //LeaveState() is not called for the initial state. curState = FSMDroneState.Start; if (debugFSM) Debug.Log(string.Format("{0}: Entering ", curState)); }