Ejemplo n.º 1
0
        public MovementCost TileGroupMovementCostForUnit(IGameUnit unit, IGameMapTileGroup gameMapTileGroup)
        {
            // Get the movement cost for this tile group. We want to track if the checked tile is passable and track the cost.
            // Group movemenet cost uses the LOWEST / BEST movement cost and easiest passibility
            var   groupCost       = float.MaxValue;
            var   groupPassable   = false;
            ulong groupInhibition = 0;

            foreach (var movementType in unit.MovementTypes)
            {
                var cost = gameMapTileGroup.GetMovementCostForType(movementType);
                if (float.IsNaN(cost))
                {
                    continue;
                }
                groupPassable    = true;
                groupCost        = Math.Min(groupCost, cost);
                groupInhibition += gameMapTileGroup.GetInhibitionScoreForUnit(unit);
            }
            // If the tile was found to be impassable then return our impassible object
            if (!groupPassable)
            {
                return(MovementCost.Impassable);
            }
            return(new MovementCost(groupCost, groupInhibition));
        }
 public void Release(IGameMapTileGroup gameMapTileGroup)
 {
 }