Beispiel #1
0
    override public float Run()
    {
        if (newNavMesh)
        {
            SceneSettings  sceneSettings = GameObject.FindWithTag(Tags.gameEngine).GetComponent <SceneSettings>();
            NavigationMesh oldNavMesh    = sceneSettings.navMesh;
            oldNavMesh.TurnOff();
            newNavMesh.TurnOn();
            sceneSettings.navMesh = newNavMesh;
        }

        return(0f);
    }
Beispiel #2
0
    private void Awake()
    {
        if (navMesh && navMesh.GetComponent <Collider>())
        {
            // Turn off all NavMesh objects, then turn on the selected one

            NavigationMesh[] navMeshes = FindObjectsOfType(typeof(NavigationMesh)) as NavigationMesh[];
            foreach (NavigationMesh _navMesh in navMeshes)
            {
                if (navMesh != _navMesh)
                {
                    _navMesh.TurnOff();
                }
            }

            navMesh.TurnOn();
        }
    }