internal static void OnStartGame()
        {
            var inst    = Game.Instance;
            var options = FastTrackOptions.Instance;

            if (options.CachePaths)
            {
                var fences = NavFences.AllFences;
                PathCacher.Init();
                foreach (var nav_grid in NAV_GRID_LIST.Get(Pathfinding.Instance))
                {
                    string id = nav_grid.id;
#if DEBUG
                    PUtil.LogDebug("Add nav grid: {0}".F(id));
#endif
                    if (fences.TryGetValue(id, out NavFences current))
                    {
                        current.Reset();
                    }
                    else
                    {
                        fences.Add(id, new NavFences());
                    }
                }
            }
            // Slices updates to Duplicant sensors
            if (inst != null)
            {
                var go = inst.gameObject;
                if (options.SensorOpts || options.PickupOpts)
                {
                    go.AddOrGet <SensorWrapperUpdater>();
                }
                if (options.AsyncPathProbe)
                {
                    go.AddOrGet <PathProbeJobManager>();
                }
                // If debugging is on, start logging
                if (debug)
                {
                    go.AddOrGet <DebugMetrics>();
                }
            }
        }
Пример #2
0
        internal static void InitNavGrids()
        {
            var fences = NavFences.AllFences;

            PathCacher.Init();
            foreach (var nav_grid in NAV_GRID_LIST.Get(Pathfinding.Instance))
            {
                string id = nav_grid.id;
#if DEBUG
                PUtil.LogDebug("Add nav grid: {0}".F(id));
#endif
                if (fences.TryGetValue(id, out NavFences current))
                {
                    current.Reset();
                }
                else
                {
                    fences.Add(id, new NavFences());
                }
            }
        }