示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LocationHasTileWithGroundEventCondition"/> class.
        /// </summary>
        /// <param name="tileAccessor">A reference to the tile accessor in use.</param>
        /// <param name="determineLocationFunc">A delegate function to determine the location to check.</param>
        public LocationHasTileWithGroundEventCondition(ITileAccessor tileAccessor, Func <Location> determineLocationFunc)
        {
            tileAccessor.ThrowIfNull(nameof(tileAccessor));

            this.TileAccessor = tileAccessor;
            this.GetLocation  = determineLocationFunc;
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContainerToMapMovementEvent"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="game">A reference to the game instance.</param>
        /// <param name="connectionManager">A reference to the connection manager in use.</param>
        /// <param name="tileAccessor">A reference to the tile accessor in use.</param>
        /// <param name="creatureFinder">A reference to the creture finder in use.</param>
        /// <param name="creatureRequestingId">The id of the creature requesting the movement.</param>
        /// <param name="thingMoving">The thing being moved.</param>
        /// <param name="fromCreatureId">The id of the creature in which the movement is happening.</param>
        /// <param name="fromCreatureContainerId">The id of the container from which the movement is happening.</param>
        /// <param name="fromCreatureContainerIndex">The index in the container from which the movement is happening.</param>
        /// <param name="toLocation">The location in the map to which the movement is happening.</param>
        /// <param name="amount">Optional. The amount of the thing to move. Must be positive. Defaults to 1.</param>
        /// <param name="evaluationTime">Optional. The evaluation time policy for this event. Defaults to <see cref="EvaluationTime.OnBoth"/>.</param>
        public ContainerToMapMovementEvent(
            ILogger logger,
            IGame game,
            IConnectionManager connectionManager,
            ITileAccessor tileAccessor,
            ICreatureFinder creatureFinder,
            uint creatureRequestingId,
            IThing thingMoving,
            uint fromCreatureId,
            byte fromCreatureContainerId,
            byte fromCreatureContainerIndex,
            Location toLocation,
            byte amount = 1,
            EvaluationTime evaluationTime = EvaluationTime.OnBoth)
            : base(logger, game, connectionManager, creatureFinder, creatureRequestingId, evaluationTime)
        {
            tileAccessor.ThrowIfNull(nameof(tileAccessor));

            if (amount == 0)
            {
                throw new ArgumentException("Invalid count zero.", nameof(amount));
            }

            this.Conditions.Add(new LocationNotObstructedEventCondition(tileAccessor, this.Requestor, () => thingMoving, () => toLocation));
            this.Conditions.Add(new LocationHasTileWithGroundEventCondition(tileAccessor, () => toLocation));
            this.Conditions.Add(new ContainerIsOpenEventCondition(() => creatureFinder.FindCreatureById(fromCreatureId), fromCreatureContainerId));

            var onPassAction = new GenericEventAction(() =>
            {
                bool moveSuccessful = thingMoving is IItem item &&
                                      creatureFinder.FindCreatureById(fromCreatureId) is IPlayer targetPlayer &&
                                      tileAccessor.GetTileAt(toLocation, out ITile toTile) &&
                                      this.Game.PerformItemMovement(item, targetPlayer.GetContainerById(fromCreatureContainerId), toTile, fromIndex: fromCreatureContainerIndex, amountToMove: amount);

                if (!moveSuccessful)
                {
                    // handles check for isPlayer.
                    this.NotifyOfFailure();

                    return;
                }

                if (this.Requestor is IPlayer player && toLocation != player.Location && player != thingMoving)
                {
                    var directionToDestination = player.Location.DirectionTo(toLocation);

                    this.Game.PlayerRequest_TurnToDirection(player, directionToDestination);
                }

                this.Game.EvaluateCollisionEventRules(toLocation, thingMoving, this.Requestor);

                this.Game.EvaluateMovementEventRules(thingMoving, this.Requestor);
            });

            this.ActionsOnPass.Add(onPassAction);
        }
示例#3
0
        public StandardScriptApi(
            ILogger logger,
            ITileAccessor tileAccessor)
        {
            logger.ThrowIfNull(nameof(logger));
            tileAccessor.ThrowIfNull(nameof(tileAccessor));

            this.Logger       = logger.ForContext <StandardScriptApi>();
            this.TileAccessor = tileAccessor;
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LocationNotAvoidEventCondition"/> class.
        /// </summary>
        /// <param name="tileAccessor">A reference to the tile accessor in use.</param>
        /// <param name="requestingCreature">The creature requesting the move.</param>
        /// <param name="determineThingMovingFunc">A delegate function to determine the thing that is being moved.</param>
        /// <param name="determineLocationFunc">A delegate function to determine the location to check.</param>
        public LocationNotAvoidEventCondition(ITileAccessor tileAccessor, ICreature requestingCreature, Func <IThing> determineThingMovingFunc, Func <Location> determineLocationFunc)
        {
            tileAccessor.ThrowIfNull(nameof(tileAccessor));
            determineThingMovingFunc.ThrowIfNull(nameof(determineThingMovingFunc));
            determineLocationFunc.ThrowIfNull(nameof(determineLocationFunc));

            this.TileAccessor = tileAccessor;
            this.Requestor    = requestingCreature;
            this.GetThing     = determineThingMovingFunc;
            this.GetLocation  = determineLocationFunc;
        }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LookAtHandler"/> class.
 /// </summary>
 /// <param name="logger">A reference to the logger to use in this handler.</param>
 /// <param name="gameInstance">A reference to the game instance.</param>
 /// <param name="creatureFinder">A reference to the creature finder.</param>
 /// <param name="tileAccessor">A reference to the tile accessor.</param>
 public LookAtHandler(
     ILogger logger,
     IGame gameInstance,
     ICreatureFinder creatureFinder,
     ITileAccessor tileAccessor)
     : base(gameInstance)
 {
     this.CreatureFinder = creatureFinder;
     this.TileAccessor   = tileAccessor;
     this.Logger         = logger.ForContext <LookAtHandler>();
 }
示例#6
0
        public TileImageProvider(IFileNameHasher hasher, ITileAccessor tileAccessor)
        {
            _hasher       = hasher;
            _httpClient   = new HttpClient();
            _tileAccessor = tileAccessor;
            _tempDir      = Path.Combine(Path.GetTempPath(), "wwt_temp");

            if (!Directory.Exists(_tempDir))
            {
                Directory.CreateDirectory(_tempDir);
            }
        }
示例#7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TileContainsThingEventCondition"/> class.
        /// </summary>
        /// <param name="tileAccessor">A reference to the tile accessor.</param>
        /// <param name="thing">The thing to check for.</param>
        /// <param name="location">The location to check at.</param>
        /// <param name="count">Optional. The amount to check for. Default is 1.</param>
        public TileContainsThingEventCondition(ITileAccessor tileAccessor, IThing thing, Location location, byte count = 1)
        {
            if (count == 0 || count > 100)
            {
                throw new ArgumentException($"Invalid count {count}.", nameof(count));
            }

            this.TileAccessor = tileAccessor;

            this.Thing    = thing;
            this.Count    = count;
            this.Location = location;
        }
示例#8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MapToContainerMovementEvent"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="game">A reference to the game instance.</param>
        /// <param name="connectionManager">A reference to the connection manager in use.</param>
        /// <param name="tileAccessor">A reference to the tile accessor in use.</param>
        /// <param name="creatureFinder">A reference to the creture finder in use.</param>
        /// <param name="creatureRequestingId">The id of the creature requesting the movement.</param>
        /// <param name="thingMoving">The thing being moved.</param>
        /// <param name="fromLocation">The location from which the movement is happening.</param>
        /// <param name="toCreatureId">The id of the creature that should known the container to which the movement is happening.</param>
        /// <param name="toCreatureContainerId">The id of the container to which the movement is happening.</param>
        /// <param name="toCreatureContainerIndex">The index in the container to which the movement is happening.</param>
        /// <param name="amount">Optional. The amount of the thing to move. Must be positive. Defaults to 1.</param>
        /// <param name="evaluationTime">Optional. The evaluation time policy for this event. Defaults to <see cref="EvaluationTime.OnBoth"/>.</param>
        public MapToContainerMovementEvent(
            ILogger logger,
            IGame game,
            IConnectionManager connectionManager,
            ITileAccessor tileAccessor,
            ICreatureFinder creatureFinder,
            uint creatureRequestingId,
            IThing thingMoving,
            Location fromLocation,
            uint toCreatureId,
            byte toCreatureContainerId,
            byte toCreatureContainerIndex,
            byte amount = 1,
            EvaluationTime evaluationTime = EvaluationTime.OnBoth)
            : base(logger, game, connectionManager, creatureFinder, creatureRequestingId, evaluationTime)
        {
            tileAccessor.ThrowIfNull(nameof(tileAccessor));

            if (amount == 0)
            {
                throw new ArgumentException("Invalid count zero.", nameof(amount));
            }

            this.Conditions.Add(new TileContainsThingEventCondition(tileAccessor, thingMoving, fromLocation, amount));
            this.Conditions.Add(new RequestorIsInRangeToMoveEventCondition(this.Requestor, () => fromLocation));
            this.Conditions.Add(new LocationsMatchEventCondition(() => thingMoving?.Location ?? default, () => fromLocation));
            this.Conditions.Add(new ContainerIsOpenEventCondition(() => creatureFinder.FindCreatureById(toCreatureId), toCreatureContainerId));

            var onPassAction = new GenericEventAction(() =>
            {
                bool moveSuccessful = thingMoving is IItem item &&
                                      creatureFinder.FindCreatureById(toCreatureId) is IPlayer targetPlayer &&
                                      tileAccessor.GetTileAt(fromLocation, out ITile fromTile) &&
                                      this.Game.PerformItemMovement(item, fromTile, targetPlayer.GetContainerById(toCreatureContainerId), toIndex: toCreatureContainerIndex, amountToMove: amount);

                if (!moveSuccessful)
                {
                    // handles check for isPlayer.
                    this.NotifyOfFailure();

                    return;
                }

                this.Game.EvaluateSeparationEventRules(fromLocation, thingMoving, this.Requestor);

                this.Game.EvaluateMovementEventRules(thingMoving, this.Requestor);
            });

            this.ActionsOnPass.Add(onPassAction);
        }
示例#9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ContainerToContainerMovementEvent"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="game">A reference to the game instance.</param>
        /// <param name="connectionManager">A reference to the connection manager in use.</param>
        /// <param name="tileAccessor">A reference to the tile accessor in use.</param>
        /// <param name="creatureFinder">A reference to the creture finder in use.</param>
        /// <param name="creatureRequestingId">The id of the creature requesting the movement.</param>
        /// <param name="thingMoving">The thing being moved.</param>
        /// <param name="targetCreatureId">The id of the creature in which the movement is happening.</param>
        /// <param name="fromCreatureContainerId">The id of the container from which the movement is happening.</param>
        /// <param name="fromCreatureContainerIndex">The index in the container from which the movement is happening.</param>
        /// <param name="toCreatureContainerId">The id of the container to which the movement is happening.</param>
        /// <param name="toCreatureContainerIndex">The index in the container to which the movement is happening.</param>
        /// <param name="amount">Optional. The amount of the thing to move. Must be positive. Defaults to 1.</param>
        /// <param name="evaluationTime">Optional. The evaluation time policy for this event. Defaults to <see cref="EvaluationTime.OnBoth"/>.</param>
        public ContainerToContainerMovementEvent(
            ILogger logger,
            IGame game,
            IConnectionManager connectionManager,
            ITileAccessor tileAccessor,
            ICreatureFinder creatureFinder,
            uint creatureRequestingId,
            IThing thingMoving,
            uint targetCreatureId,
            byte fromCreatureContainerId,
            byte fromCreatureContainerIndex,
            byte toCreatureContainerId,
            byte toCreatureContainerIndex,
            byte amount = 1,
            EvaluationTime evaluationTime = EvaluationTime.OnBoth)
            : base(logger, game, connectionManager, creatureFinder, creatureRequestingId, evaluationTime)
        {
            tileAccessor.ThrowIfNull(nameof(tileAccessor));

            if (amount == 0)
            {
                throw new ArgumentException("Invalid count zero.", nameof(amount));
            }

            this.Conditions.Add(new ContainerIsOpenEventCondition(() => creatureFinder.FindCreatureById(targetCreatureId), fromCreatureContainerId));
            this.Conditions.Add(new ContainerIsOpenEventCondition(() => creatureFinder.FindCreatureById(targetCreatureId), toCreatureContainerId));

            var onPassAction = new GenericEventAction(() =>
            {
                bool moveSuccessful = thingMoving is IItem item &&
                                      creatureFinder.FindCreatureById(targetCreatureId) is IPlayer targetPlayer &&
                                      this.Game.PerformItemMovement(item, targetPlayer.GetContainerById(fromCreatureContainerId), targetPlayer.GetContainerById(toCreatureContainerId), fromCreatureContainerIndex, toCreatureContainerIndex, amount);

                if (!moveSuccessful)
                {
                    // handles check for isPlayer.
                    this.NotifyOfFailure();

                    return;
                }

                this.Game.EvaluateMovementEventRules(thingMoving, this.Requestor);
            });

            this.ActionsOnPass.Add(onPassAction);
        }
示例#10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChangeItemEvent"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="game">A reference to the game instance.</param>
        /// <param name="connectionManager">A reference to the connection manager in use.</param>
        /// <param name="tileAccessor">A reference to the tile accessor in use.</param>
        /// <param name="creatureFinder">A reference to the creature finder in use.</param>
        /// <param name="requestorId">The id of the creature requesting the use.</param>
        /// <param name="typeId">The type id of the item being used.</param>
        /// <param name="fromLocation">The location from which the item is being used.</param>
        /// <param name="toTypeId">The type id of the item to change to.</param>
        /// <param name="fromStackPos">The position in the stack from which the item is being used.</param>
        /// <param name="index">The index of the item being used.</param>
        /// <param name="evaluationTime">The time to evaluate the movement.</param>
        public ChangeItemEvent(
            ILogger logger,
            IGame game,
            IConnectionManager connectionManager,
            ITileAccessor tileAccessor,
            ICreatureFinder creatureFinder,
            uint requestorId,
            ushort typeId,
            Location fromLocation,
            ushort toTypeId,
            byte fromStackPos             = byte.MaxValue,
            byte index                    = 1,
            EvaluationTime evaluationTime = EvaluationTime.OnBoth)
            : base(logger, requestorId, evaluationTime)
        {
            game.ThrowIfNull(nameof(game));
            tileAccessor.ThrowIfNull(nameof(tileAccessor));
            connectionManager.ThrowIfNull(nameof(connectionManager));
            creatureFinder.ThrowIfNull(nameof(creatureFinder));

            this.ConnectionManager = connectionManager;
            this.CreatureFinder    = creatureFinder;
            this.Game = game;

            this.ActionsOnFail.Add(new GenericEventAction(this.NotifyOfFailure));

            var onPassAction = new GenericEventAction(() =>
            {
                var fromCylinder = this.Game.GetCyclinder(fromLocation, ref fromStackPos, ref index, this.Requestor);
                var item         = this.Game.FindItemByIdAtLocation(typeId, fromLocation, this.Requestor);

                bool successfulUse = this.Game.PerformItemChange(item, toTypeId, fromCylinder, index, this.Requestor);

                if (!successfulUse)
                {
                    // handles check for isPlayer.
                    this.NotifyOfFailure();

                    return;
                }
            });

            this.ActionsOnPass.Add(onPassAction);
        }
示例#11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DeleteItemEvent"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="game">A reference to the game instance.</param>
        /// <param name="connectionManager">A reference to the connection manager in use.</param>
        /// <param name="tileAccessor">A reference to the tile accessor in use.</param>
        /// <param name="creatureFinder">A reference to the creature finder in use.</param>
        /// <param name="requestorId">The id of the creature requesting the deletion.</param>
        /// <param name="typeId">The type id of the item being deleted.</param>
        /// <param name="atLocation">The location from which the item is being deleted.</param>
        /// <param name="evaluationTime">The time to evaluate the event.</param>
        public DeleteItemEvent(
            ILogger logger,
            IGame game,
            IConnectionManager connectionManager,
            ITileAccessor tileAccessor,
            ICreatureFinder creatureFinder,
            uint requestorId,
            ushort typeId,
            Location atLocation,
            EvaluationTime evaluationTime = EvaluationTime.OnBoth)
            : base(logger, requestorId, evaluationTime)
        {
            game.ThrowIfNull(nameof(game));
            tileAccessor.ThrowIfNull(nameof(tileAccessor));
            connectionManager.ThrowIfNull(nameof(connectionManager));
            creatureFinder.ThrowIfNull(nameof(creatureFinder));

            this.ConnectionManager = connectionManager;
            this.CreatureFinder    = creatureFinder;
            this.Game = game;

            this.ActionsOnFail.Add(new GenericEventAction(this.NotifyOfFailure));

            var onPassAction = new GenericEventAction(() =>
            {
                byte index = 0, subIndex = 0;

                var fromCylinder = this.Game.GetCyclinder(atLocation, ref index, ref subIndex, this.Requestor);
                var item         = this.Game.FindItemByIdAtLocation(typeId, atLocation, this.Requestor);

                bool successfulDeletion = this.Game.PerformItemDeletion(item, fromCylinder, subIndex, this.Requestor);

                if (!successfulDeletion)
                {
                    // handles check for isPlayer.
                    this.NotifyOfFailure();

                    return;
                }
            });

            this.ActionsOnPass.Add(onPassAction);
        }
示例#12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OnMapCreatureMovementEvent"/> class.
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="game"></param>
 /// <param name="connectionManager"></param>
 /// <param name="tileAccessor"></param>
 /// <param name="creatureFinder"></param>
 /// <param name="itemFactory"></param>
 /// <param name="requestorId"></param>
 /// <param name="creatureMoving"></param>
 /// <param name="fromLocation"></param>
 /// <param name="toLocation"></param>
 /// <param name="fromStackPos">Optional. The position in the stack of the tile from which the movement is being performed. Defaults to <see cref="byte.MaxValue"/> which signals to attempt to find the thing from the source location.</param>
 /// <param name="isTeleport"></param>
 /// <param name="deferEvaluation"></param>
 public OnMapCreatureMovementEvent(
     ILogger logger,
     IGame game,
     IConnectionManager connectionManager,
     ITileAccessor tileAccessor,
     ICreatureFinder creatureFinder,
     uint requestorId,
     ICreature creatureMoving,
     Location fromLocation,
     Location toLocation,
     byte fromStackPos    = byte.MaxValue,
     bool isTeleport      = false,
     bool deferEvaluation = false)
     : base(logger, game, connectionManager, tileAccessor, creatureFinder, requestorId, creatureMoving, fromLocation, toLocation, fromStackPos, 1, isTeleport, deferEvaluation ? EvaluationTime.OnExecute : EvaluationTime.OnBoth)
 {
     // Don't add any conditions if this wasn't a creature requesting, i.e. if the request comes from a script.
     if (!isTeleport && this.Requestor != null)
     {
         this.Conditions.Add(new LocationNotAvoidEventCondition(tileAccessor, this.Requestor, () => creatureMoving, () => toLocation));
         this.Conditions.Add(new LocationsAreDistantByEventCondition(() => fromLocation, () => toLocation));
         this.Conditions.Add(new CreatureThrowBetweenFloorsEventCondition(this.Requestor, () => creatureMoving, () => toLocation));
     }
 }
示例#13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MapToMapMovementEvent"/> class.
        /// </summary>
        /// <param name="logger">A reference to the logger in use.</param>
        /// <param name="game">A reference to the game instance.</param>
        /// <param name="connectionManager">A reference to the connection manager in use.</param>
        /// <param name="tileAccessor">A reference to the tile accessor in use.</param>
        /// <param name="creatureFinder">A reference to the creture finder in use.</param>
        /// <param name="creatureRequestingId">The id of the creature requesting the movement.</param>
        /// <param name="thingMoving">The thing being moved.</param>
        /// <param name="fromLocation">The location in the map from which the movement is happening.</param>
        /// <param name="toLocation">The location in the map to which the movement is happening.</param>
        /// <param name="fromStackPos">Optional. The position in the stack of the location from which the movement is happening. Defaults to <see cref="byte.MaxValue"/>, which makes the system take the top thing at the location.</param>
        /// <param name="amount">Optional. The amount of the thing to move. Must be positive. Defaults to 1.</param>
        /// <param name="isTeleport">Optional. A value indicating whether the movement is considered a teleportation. Defaults to false.</param>
        /// <param name="evaluationTime">Optional. The evaluation time policy for this event. Defaults to <see cref="EvaluationTime.OnBoth"/>.</param>
        public MapToMapMovementEvent(
            ILogger logger,
            IGame game,
            IConnectionManager connectionManager,
            ITileAccessor tileAccessor,
            ICreatureFinder creatureFinder,
            uint creatureRequestingId,
            IThing thingMoving,
            Location fromLocation,
            Location toLocation,
            byte fromStackPos             = byte.MaxValue,
            byte amount                   = 1,
            bool isTeleport               = false,
            EvaluationTime evaluationTime = EvaluationTime.OnBoth)
            : base(logger, game, connectionManager, creatureFinder, creatureRequestingId, evaluationTime)
        {
            tileAccessor.ThrowIfNull(nameof(tileAccessor));

            if (amount == 0)
            {
                throw new ArgumentException("Invalid count zero.", nameof(amount));
            }

            if (!isTeleport && this.Requestor != null)
            {
                this.Conditions.Add(new CanThrowBetweenEventCondition(game, this.Requestor, () => fromLocation, () => toLocation));
            }

            if (thingMoving is ICreature creatureMoving)
            {
                // Don't add any conditions if this wasn't a creature requesting, i.e. if the request comes from a script.
                if (!isTeleport && this.Requestor != null)
                {
                    this.Conditions.Add(new LocationNotAvoidEventCondition(tileAccessor, this.Requestor, () => creatureMoving, () => toLocation));
                    this.Conditions.Add(new LocationsAreDistantByEventCondition(() => fromLocation, () => toLocation));
                    this.Conditions.Add(new CreatureThrowBetweenFloorsEventCondition(this.Requestor, () => creatureMoving, () => toLocation));
                }
            }

            this.Conditions.Add(new RequestorIsInRangeToMoveEventCondition(this.Requestor, () => fromLocation));
            this.Conditions.Add(new LocationNotObstructedEventCondition(tileAccessor, this.Requestor, () => thingMoving, () => toLocation));
            this.Conditions.Add(new LocationHasTileWithGroundEventCondition(tileAccessor, () => toLocation));
            this.Conditions.Add(new UnpassItemsInRangeEventCondition(this.Requestor, () => thingMoving, () => toLocation));
            this.Conditions.Add(new LocationsMatchEventCondition(() => thingMoving?.Location ?? default, () => fromLocation));
            this.Conditions.Add(new TileContainsThingEventCondition(tileAccessor, thingMoving, fromLocation, amount));

            var onPassAction = new GenericEventAction(() =>
            {
                bool moveSuccessful = false;

                if (thingMoving is ICreature creatureMoving)
                {
                    moveSuccessful = this.Game.PerformCreatureMovement(creatureMoving, toLocation);
                }
                else if (thingMoving is IItem item)
                {
                    moveSuccessful = tileAccessor.GetTileAt(fromLocation, out ITile fromTile) &&
                                     tileAccessor.GetTileAt(toLocation, out ITile toTile) &&
                                     this.Game.PerformItemMovement(item, fromTile, toTile, fromStackPos, amountToMove: amount);
                }

                if (!moveSuccessful)
                {
                    // handles check for whether there is a player to notify.
                    this.NotifyOfFailure();

                    return;
                }

                if (this.Requestor is IPlayer player && toLocation != player.Location && player != thingMoving)
                {
                    var directionToDestination = player.Location.DirectionTo(toLocation);

                    this.Game.PlayerRequest_TurnToDirection(player, directionToDestination);
                }

                this.Game.EvaluateSeparationEventRules(fromLocation, thingMoving, this.Requestor);

                this.Game.EvaluateCollisionEventRules(toLocation, thingMoving, this.Requestor);

                this.Game.EvaluateMovementEventRules(thingMoving, this.Requestor);
            });

            this.ActionsOnPass.Add(onPassAction);
        }
示例#14
0
 public TilethumbProvider(ITileAccessor tileAccessor)
 {
     _tileAccessor = tileAccessor;
 }
示例#15
0
 public GetTileProvider(ITileAccessor tileAccessor)
 {
     _tileAccessor = tileAccessor;
 }