예제 #1
0
        public void RefreshWhenWorldLoaded()
        {
            PG.Instance = null;
            CompCtrl.SetActors(null);
            //nodes.RefreshActors();
            //sceneGraph.RefreshFromWorld(VP1.World);
            Outliner.BindingWorld(VP1.World);
            Outliner.SetViewPort(VP1);
            CompCtrl.ViewPort = VP1;
            if (VP1.World.DefaultScene.SunActor != null)
            {
                var sunComp = VP1.World.DefaultScene.SunActor.GetComponent <EngineNS.GamePlay.Component.GDirLightComponent>();
                if (sunComp != null)
                {
                    var editorInstance = EngineNS.CEngine.Instance.GameEditorInstance as CoreEditor.CEditorInstance;
                    sunComp.View = editorInstance.RenderPolicy.BaseSceneView;
                }
            }

            VP1.World.RemoveEditorActor(VP1.World.NavMeshActorID);
            NavModifierVolumes.Clear();
            NavMeshBoundVolumes.Clear();
            if (VP1.World.DefaultScene.NavAreaActor != null)
            {
                //var test = BuildNavtion();
                List <EngineNS.GamePlay.Actor.GActor> Children = VP1.World.DefaultScene.NavAreaActor.GetChildrenUnsafe();
                foreach (var actor in Children)
                {
                    var component = actor.GetComponent <EngineNS.Bricks.RecastRuntime.NavMeshBoundVolumeComponent>();
                    if (component != null)
                    {
                        if (component.RCAreaType == EngineNS.Bricks.RecastRuntime.NavMeshBoundVolumeComponent.AreaType.NoWalk)
                        {
                            actor.PlacementChange -= RefreshNavModifierVolumes;
                            actor.PlacementChange += RefreshNavModifierVolumes;

                            NavModifierVolumes.Add(new WeakReference <EngineNS.GamePlay.Actor.GActor>(actor));
                        }
                        else if (component.RCAreaType == EngineNS.Bricks.RecastRuntime.NavMeshBoundVolumeComponent.AreaType.Walk)
                        {
                            actor.PlacementChange -= RefreshNavMeshBoundVolumes;
                            actor.PlacementChange += RefreshNavMeshBoundVolumes;

                            NavMeshBoundVolumes.Add(new WeakReference <EngineNS.GamePlay.Actor.GActor>(actor));
                        }

                        if (RCTileMeshBuilder.InputGeom == null)
                        {
                            //var result = BuildNavtion();
                        }
                        AddActorToNavModifierVolume(actor);
                    }
                }

                //test = BuildNavMesh();
            }

            var test = CreateNavRenderMesh();

            RefreshActorControlInfo();
        }