Beispiel #1
0
        public void Update()
        {
            if (MyPerGameSettings.EnablePathfinding)
            {
                m_obstacles.Update();

                MyPathfindingStopwatch.CheckStopMeasuring();
                MyPathfindingStopwatch.Start();
                m_gridPathfinding.Update();
                m_voxelPathfinding.Update();
                MyPathfindingStopwatch.Stop();
            }
        }
Beispiel #2
0
        public IMyPath FindPathGlobal(Vector3D begin, IMyDestinationShape end, MyEntity entity = null)
        {
            Debug.Assert(MyPerGameSettings.EnablePathfinding, "Pathfinding is not enabled!");
            if (!MyPerGameSettings.EnablePathfinding)
            {
                return(null);
            }

            ProfilerShort.Begin("MyPathfinding.FindPathGlobal");
            MyPathfindingStopwatch.Start();

            // CH: TODO: Use pooling
            MySmartPath newPath = new MySmartPath(this);
            MySmartGoal newGoal = new MySmartGoal(end, entity);

            newPath.Init(begin, newGoal);

            MyPathfindingStopwatch.Stop();
            ProfilerShort.End();
            return(newPath);
        }