Esempio n. 1
0
 public void Clear()
 {
     Network                = new SocketClient(this);
     MapManager             = new Map(this);
     PathFinderManager      = new PathFinder(MapManager);
     WorldPathFinderManager = new WorldPathFinder(this);
 }
Esempio n. 2
0
 public Client(string user, string pass)
 {
     this.Username          = user;
     this.Password          = pass;
     Network                = new SocketClient(this);
     MapManager             = new Map(this);
     PathFinderManager      = new PathFinder(MapManager);
     WorldPathFinderManager = new WorldPathFinder(this);
 }
Esempio n. 3
0
 private void computePossiblePaths(Unit unit)
 {
     currentPathFinder = new WorldPathFinder (world);
     maxItt = 0;
     computePossiblePathsRecursif (unit, unit.getCase (), null, unit.movePoint);
 }
        public List <Speciality> getSpecialityList()
        {
            Settlement settlement = TradeSession.trader as Settlement;

            if (settlement == null)
            {
                return(new List <Speciality>());
            }
            List <Speciality> specialityList;

            if (specialityLists.ContainsKey(settlement))
            {
                specialityList = specialityLists[settlement];
            }
            else
            {
                specialityList = new List <Speciality>();
                int                    ticksPerDay            = 60000 / 24 * 14;
                WorldGrid              grid                   = Find.WorldGrid;
                WorldPathFinder        finder                 = Find.WorldPathFinder;
                SpecialityWorldManager specialityWorldManager = Find.World.GetComponent <SpecialityWorldManager>();
                finder.FloodPathsWithCost(new List <int> {
                    settlement.Tile
                }, (int currentPlace, int neighborPlace) => {
                    float moveCost = 2500;
                    Tile tile      = grid.tiles[neighborPlace];
                    if (tile == null && tile.WaterCovered)
                    {
                        return(99999);
                    }
                    Season season = GenDate.Season(Find.TickManager.TicksGame, grid.LongLatOf(neighborPlace));
                    switch (season)
                    {
                    case Season.Spring:
                        moveCost += tile.biome.pathCost_spring;
                        break;

                    case Season.Summer:
                    case Season.PermanentSummer:
                        moveCost += tile.biome.pathCost_summer;
                        break;

                    case Season.Fall:
                        moveCost += tile.biome.pathCost_fall;
                        break;

                    case Season.Winter:
                    case Season.PermanentWinter:
                        moveCost += tile.biome.pathCost_winter;
                        break;
                    }
                    moveCost *= grid.GetRoadMovementMultiplierFast(currentPlace, neighborPlace);
                    return((int)moveCost);
                }, null, (int currentPlace, float cost) => {
                    if (cost <= ticksPerDay)
                    {
                        Speciality speciality = specialityWorldManager.getSpeciality(currentPlace);
                        if (speciality != null)
                        {
                            specialityList.Add(speciality);
                        }
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                });
                specialityLists[settlement] = specialityList;
            }
            return(specialityList);
        }