Exemple #1
0
        private Boolean TransferUnit(IMovable movableUnit, SPoint newPosition)
        {
            ICell destinationCell = _map.GetCell(newPosition);

            if (destinationCell.Unit != null)
            {
                return(false);
            }

            Int32 transferEnergy = destinationCell.Terrain?.MovementPenalty ?? 0;

            if (transferEnergy > movableUnit.MovingEnergy)
            {
                return(false);
            }

            SPoint oldPosition = movableUnit.Position;

            _map.Move(movableUnit, oldPosition, newPosition);

            return(true);
        }