Beispiel #1
0
        public async Task <bool> ApproachAsync(string verb, IObject obj)
        {
            ApproachHotspots approachStyle = getApproachStyle(verb);

            switch (approachStyle)
            {
            case ApproachHotspots.NeverWalk:
                break;

            case ApproachHotspots.FaceOnly:
                await _faceDirection.FaceDirectionAsync(obj);

                break;

            case ApproachHotspots.WalkIfHaveWalkPoint:
                if (obj.WalkPoint == null)
                {
                    await _faceDirection.FaceDirectionAsync(obj);
                }
                else
                {
                    if (!await _walk.WalkAsync(new AGSLocation(obj.WalkPoint.Value)))
                    {
                        return(false);
                    }
                    await _faceDirection.FaceDirectionAsync(obj);
                }
                break;

            case ApproachHotspots.AlwaysWalk:
                PointF?walkPoint = obj.WalkPoint ?? obj.CenterPoint ?? obj.Location.XY;
                if (!await _walk.WalkAsync(new AGSLocation(walkPoint.Value)))
                {
                    return(false);
                }
                await _faceDirection.FaceDirectionAsync(obj);

                break;

            default:
                throw new NotSupportedException("Approach style is not supported: " + approachStyle.ToString());
            }
            return(true);
        }
 public Task FaceDirectionAsync(Direction direction)
 {
     return(_faceDirectionBehavior.FaceDirectionAsync(direction));
 }