private Vector2 FlowFieldFollow() { desiredFlowValue = _pathfinder.seekerManager.FindFlowValueFromPosition( transform.position, flowFieldPath.FlowField, this ); if (desiredFlowValue == Vector2.zero && currentWorldArea != null && currentTile != null && currentTile != flowFieldPath.Destination && !_pathfinder.WorkingOnPathAdjustment(flowFieldPath.Key, currentWorldArea.Index, currentTile.SectorIndex)) { _pathfinder.AddSectorInPath(currentWorldArea, currentTile, flowFieldPath); } // return the velocity we desire to go to desiredFlowValue *= MaxMoveSpeed; // we desire this velocity return(desiredFlowValue); }
private Vector2 FlowFieldFollow() { desiredFlowValue = pathfinder.seekerManager.FindflowValueFromPosition(transform.position - (Vector3.up * 0.57f), flowFieldPath.flowField, this); if (desiredFlowValue == Vector2.zero && currentWorldArea != null && currentTile != null && currentTile != flowFieldPath.destination && !pathfinder.WorkingOnPathAdjustment(flowFieldPath.key, currentWorldArea.index, currentTile.sectorIndex)) { pathfinder.AddSectorInPath(currentWorldArea, currentTile, flowFieldPath); } // return the velocity we desire to go to desiredFlowValue *= maxMoveSpeed; // we desire this velocity desiredFlowValue -= velocity; return(desiredFlowValue * (maxForce / maxMoveSpeed)); }