void Setup() { uiManager.Setup(); uiManager.DisplayActiveTank(activeTank); terrainManager.CreateTerrain(10f); tank0Manager.CreateTankOnTerrain(0, terrainManager.RandomPosition()); tank1Manager.CreateTankOnTerrain(1, terrainManager.RandomPosition()); SetActiveTank(0); }
public void WhenANewTerrainIsAdded_TheNumberOfTerrainsIncreasesBy1() { using (var db = new FeudalismContext()) { var numTerrains = db.TerrainDetails.Count(); _terrainManager.CreateTerrain("LavaFlow", 10); var result = db.TerrainDetails.Count(); Assert.AreEqual(1, result - numTerrains); } }
private IEnumerator Start() { TerrainManager.CreateTerrain(Vector3.zero); yield return(null); //CameraManager.AddCamera("Default Camera 1", new Vector3(-40, 115, -138), Quaternion.Euler(30, 10, 0)); //CameraManager.AddCamera("Default Camera 2", new Vector3(33, 70.5f, -49), Quaternion.Euler(50, -32, 0)); //CameraManager.AddCamera("Default Camera 3", new Vector3(36.5f, 180f, 138), Quaternion.Euler(63, 230, -5f)); CameraManager.Remove("GUI Camera"); NPCInit.Initialize(); UIManager.Create <HUDViewModel>().IsActive = true; UIManager.Create <NPCDialogueViewModel>().IsActive = false; UIManager.Create <BlacksmithViewModel>().IsActive = false; UIManager.Create <InGameMenuViewModel>().IsActive = false; UIManager.Create <RecipeViewModel>().IsActive = false; //TODO: Parametrize prefab name with a UI selector CodeEditorViewModel codeEditorViewModel = UIManager.Create <CodeEditorViewModel>(); StartCoroutine(codeEditorViewModel.ToggleEditorCoroutine()); GameObject robot = RobotManager.CreateRobot("robotSphere", new Vector3(-10, 20, 0), Quaternion.identity); RobotManager.ActiveRobot = robot; RobotManager.CreateRobot("robotSphere", new Vector3(0, 20, 0), Quaternion.identity); RobotManager.CreateRobot("robotSphere", new Vector3(10, 20, 0), Quaternion.identity); RobotManager.CreateRobot("robotSphere", new Vector3(-10, 20, -10), Quaternion.identity); RobotManager.CreateRobot("robotSphere", new Vector3(0, 20, -10), Quaternion.identity); RobotManager.CreateRobot("robotSphere", new Vector3(10, 20, -10), Quaternion.identity); RobotManager.CreateRobot("robotSphere", new Vector3(-10, 20, -20), Quaternion.identity); RobotManager.CreateRobot("robotSphere", new Vector3(0, 20, -20), Quaternion.identity); RobotManager.CreateRobot("robotSphere", new Vector3(10, 20, -20), Quaternion.identity); GameObject enemyManagerPrefab = Resources.Load <GameObject>("InfrastructurePrefabs/EnemyManager"); Instantiate(enemyManagerPrefab); InventoryManager.Inventory = new Inventory(); InventoryViewModel inventoryViewModel = UIManager.Create <InventoryViewModel>(); ItemDialogViewModel itemDialogViewModel = UIManager.Create <ItemDialogViewModel>(); inventoryViewModel.IsActive = false; codeEditorViewModel.IsActive = false; itemDialogViewModel.IsActive = false; CameraManager.SetCameraWall(); }
// Use this for initialization void OnGUI() { EditorGUILayout.PrefixLabel("Map Settings", EditorStyles.boldLabel); // Add Width, height controls m_Width = (int)EditorGUILayout.IntField("Width", m_Width); m_Height = (int)EditorGUILayout.IntField("Hieght", m_Height); if (GUILayout.Button("Create")) { // Create map GO GameObject map_go = new GameObject("Map"); // Reset position map_go.transform.position.Set(0, 0, 0); // Add terrain component TerrainManager terrain_manager = map_go.AddComponent <TerrainManager>(); // Create terrain terrain_manager.CreateTerrain(new ja2.Map(m_Width, m_Height, "summer"), new ja2.TerrainMaterialManager(Application.dataPath)); } }
private IEnumerator CommonInitRoutine() { UIManager.Get <BackgroundViewModel>().IsActive = false; StartCoroutine(PrefabPool.Instance.LoadPrefabs(prefabList)); TerrainManager.CreateTerrain(Vector3.zero); CameraManager.Remove("GUI Camera"); UIManager.Create <HUDViewModel>().IsActive = true; UIManager.Create <NPCDialogueViewModel>().IsActive = false; UIManager.Create <BlacksmithViewModel>().IsActive = false; InGameMenuViewModel inGameMenuViewModel = UIManager.Create <InGameMenuViewModel>(); inGameMenuViewModel.IsActive = false; inGameMenuViewModel.ExitGameButton.onClick.AddListener(OnExit); NPCInit.Initialize(); CodeEditorViewModel codeEditorViewModel = UIManager.Create <CodeEditorViewModel>(); StartCoroutine(codeEditorViewModel.ToggleEditorCoroutine()); codeEditorViewModel.IsActive = false; while (!PrefabPool.Instance.Initialized) { yield return(null); } yield return(null); }
private void CreateTerrain() { mTMgr = new MET.TerrainManager(OgreEngine.mMgr, "MET"); mTMgr.SetLodErrorMargin(2, OgreEngine.mWin.Height); mTMgr.SetUseLodMorphing(true, 0.2f, "morphFactor"); mTInfo = new MET.TerrainInfo(); Mogre.Image image = new Mogre.Image(); image.Load("heightmap.png", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); MET.TerrainInfo.LoadHeightmapFromImage(mTInfo, image); //mTInfo.Extents = new Mogre.AxisAlignedBox(0, 0, 0, land.SizeX + stepWidth, land.SizeZ, land.SizeY + stepHeight); mTInfo.Extents = new Mogre.AxisAlignedBox(Vector3.ZERO, Size); //lightmap Mogre.Image lmImage = new Mogre.Image(); MET.TerrainInfo.CreateTerraingLightmap(mTInfo, lmImage, Constants.Land.LightmapSize, Constants.Land.LightmapSize, new Vector3(-1, -1, -1), new ColourValue(1, 1, 1), new ColourValue(0.2f, 0.2f, 0.2f), true); //lmImage.Save("lightmapa" + land.Id + ".png"); TexturePtr lightmapTex = TextureManager.Singleton.CreateManual( "ETLightmap", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, Mogre.TextureType.TEX_TYPE_2D, Constants.Land.LightmapSize, Constants.Land.LightmapSize, 1, Mogre.PixelFormat.PF_BYTE_RGB); TexturePtr tex = TextureManager.Singleton.GetByName("ETLightmap"); tex.GetBuffer(0, 0).BlitFromMemory(lmImage.GetPixelBox(0, 0)); mTMgr.CreateTerrain(mTInfo); mTInfo.Dispose(); mTInfo = mTMgr.TerrainInfo; image = new Image(); image.Load("textureMap0.png", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); TextureSize = image.Width; mSMgr = new MET.SplattingManager("ETSplatting", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, image.Width, image.Width, 3); mSMgr.NumTextures = 6; mSMgr.LoadMapFromImage(0, image); image = new Image(); image.Load("textureMap1.png", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); mSMgr.LoadMapFromImage(1, image); mTMgr.Material = MaterialManager.Singleton.GetByName("ETTerrainMaterial"); // lightmapa Pass pass = mTMgr.Material.GetTechnique(0).CreatePass(); pass.LightingEnabled = false; pass.SetSceneBlending(SceneBlendType.SBT_MODULATE); pass.SetVertexProgram("ET/Programs/VSLodMorph2"); pass.SetFragmentProgram("ET/Programs/PSLighting"); pass.CreateTextureUnitState("ETLightmap"); pass = mTMgr.Material.GetTechnique(1).CreatePass(); pass.LightingEnabled = false; pass.SetSceneBlending(SceneBlendType.SBT_MODULATE); pass.SetVertexProgram("ET/Programs/VSLodMorph2"); pass.SetFragmentProgram("ET/Programs/PSLighting"); pass.CreateTextureUnitState("ETLightmap"); //base texture for non shader graphics lmImage = new Mogre.Image(); //TODO: replace by real bic texture lmImage.Load("baseTexture.jpg", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); //lmImage.Save("lightmapa" + land.Id + ".png"); lightmapTex = TextureManager.Singleton.CreateManual( "ETBasemap", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, Mogre.TextureType.TEX_TYPE_2D, Constants.Land.LightmapSize, Constants.Land.LightmapSize, 1, Mogre.PixelFormat.PF_BYTE_RGB); tex = TextureManager.Singleton.GetByName("ETBasemap"); tex.GetBuffer(0, 0).BlitFromMemory(lmImage.GetPixelBox(0, 0)); Technique tech = mTMgr.Material.CreateTechnique(); pass = tech.CreatePass(); pass.CreateTextureUnitState("ETBasemap"); }