private void Loader_LoadMapFinished() { aimesh = new AIMesh(); gameObjects = new Dictionary <string, List <GameObject> >(); var file = scriptLoader.Parse(logicScriptFile, ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); scriptLoader.ExecuteFunction(file, "map_loaded", world); //Currently terrain use a mesh which id is MAP_TERRAIN var terrainEntName = loader.Entities.Where(o => o == "MAP_TERRAIN").FirstOrDefault(); if (!string.IsNullOrEmpty(terrainEntName)) { var terrainEnt = sceneManager.GetEntity(terrainEntName); navmesh = MeshToNavmesh.LoadNavmesh(terrainEnt); } TriggerManager.Instance.Init(world, scriptLoader.currentContext); editor.Initization(); LoadMapFinished?.Invoke(); }
public void createScene() { // set background and some fog AdvancedMogreFramework.Singleton.m_pViewport.BackgroundColour = new ColourValue(1.0f, 1.0f, 0.8f); m_pSceneMgr.SetFog(FogMode.FOG_LINEAR, new ColourValue(1.0f, 1.0f, 0.8f), 0, 15, 100); // set shadow properties m_pSceneMgr.ShadowTechnique = ShadowTechnique.SHADOWTYPE_TEXTURE_MODULATIVE; m_pSceneMgr.ShadowColour = new ColourValue(0.5f, 0.5f, 0.5f); m_pSceneMgr.SetShadowTextureSize(1024); m_pSceneMgr.ShadowTextureCount = 1; // disable default camera control so the character can do its own m_pCameraMan.setStyle(CameraStyle.CS_MANUAL); // use a small amount of ambient lighting m_pSceneMgr.AmbientLight = new ColourValue(0.3f, 0.3f, 0.3f); // add a bright light above the scene Light light = m_pSceneMgr.CreateLight(); light.Type = (Light.LightTypes.LT_POINT); light.Position = new Mogre.Vector3(-10, 40, 20); light.SpecularColour = ColourValue.White; // create a floor mesh resource MeshManager.Singleton.CreatePlane("floor", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, new Plane(Mogre.Vector3.UNIT_Y, 0), 100, 100, 10, 10, true, 1, 10, 10, Mogre.Vector3.UNIT_Z); // create a floor entity, give it a material, and place it at the origin SceneProp floorSceneProp = new SceneProp( this, m_pSceneMgr, m_pSceneMgr.RootSceneNode, physicsScene, "Floor", "floor" ); floorSceneProp.SetMaterialName("Examples/Rockwall"); //Navmesh Navmesh floorNavMesh = MeshToNavmesh.LoadNavmesh(floorSceneProp.Entity); NavmeshQuery query; NavmeshPoint retStartPoint; NavmeshPoint retEndPoint; org.critterai.Vector3 pointStart = new org.critterai.Vector3(0, 0, 0); org.critterai.Vector3 pointEnd = new org.critterai.Vector3(0, 0, 0); org.critterai.Vector3 extents = new org.critterai.Vector3(2, 2, 2); NavStatus status = NavmeshQuery.Create(floorNavMesh, 100, out query); Console.WriteLine("Status returned when NavmeshQuery was built: " + status); NavmeshQueryFilter filter = new NavmeshQueryFilter(); filter.IncludeFlags = 1; status = query.GetNearestPoint(pointStart, extents, filter, out retStartPoint); Console.WriteLine("\nStatus of startPoint GetNearestPoint: " + status); status = query.GetNearestPoint(pointEnd, extents, filter, out retEndPoint); Console.WriteLine("\nStatus of endPoint GetNearestPoint: " + status); uint[] path = new uint[100]; int pathCount; status = query.FindPath(retStartPoint, retEndPoint, filter, path, out pathCount); Console.WriteLine("\nStatus of Find path: " + status); // create our character controller m_pChara = new SinbadCharacterController(this, physicsScene, m_pCamera, new Mogre.Vector3(0, 5, 0), 0); SinbadCharacterController bot1 = new SinbadCharacterController(this, physicsScene, m_pCamera, new Mogre.Vector3(-10, 5, 0), 1, false); SinbadCharacterController bot2 = new SinbadCharacterController(this, physicsScene, m_pCamera, new Mogre.Vector3(0, 5, -10), 2, false); SinbadCharacterController bot3 = new SinbadCharacterController(this, physicsScene, m_pCamera, new Mogre.Vector3(10, 5, 0), 3, false); agents.Add(m_pChara); agents.Add(bot1); agents.Add(bot2); agents.Add(bot3); AdvancedMogreFramework.Singleton.m_pTrayMgr.toggleAdvancedFrameStats(); StringVector items = new StringVector(); items.Insert(items.Count, "Help"); ParamsPanel help = AdvancedMogreFramework.Singleton.m_pTrayMgr.createParamsPanel(TrayLocation.TL_TOPLEFT, "HelpMessage", 100, items); help.setParamValue("Help", "H / F1"); }