Gruppe22.Backend.Map.PositionActor C# (CSharp) Метод

PositionActor() публичный Метод

Move an actor on the map in a specified direction (does not check for walls - use CanMove)
public PositionActor ( Actor actor, Coords coords ) : void
actor Actor The actor object to move
coords Coords
Результат void
        public void PositionActor(Actor actor, Coords coords)
        {
            if ((actor.tile != null) && (actor.tile.enabled))
            {
                Backend.Coords source = actor.tile.coords;
                Backend.Coords target = coords;
                if (this[target].coords.x > -1)
                {
                    // Remove ActorTile from current tile
                    ((FloorTile)actor.tile.parent).Remove(actor.tile);
                    // Add ActorTile to new Tile
                    _tiles[target.y][target.x].Add(actor.tile);
                    actor.tile.parent = _tiles[target.y][target.x];
                    // Remove old tile from updatelist (if no other actor or trap)
                    if (!((_tiles[source.y][source.x].hasEnemy)
                        || (_tiles[source.y][source.x].hasPlayer)
                        || (_tiles[source.y][source.x].hasTrap)))
                        _updateTiles.Remove(source);
                    // Add new tile to updatelist
                    _updateTiles.Add(target);
                }
            }
        }