private void Start() { MWDataReader = new MorrowindDataReader(dataPath); MWEngine = new MorrowindEngine(MWDataReader, UIManager); if (playMusic) { // Start the music. musicPlayer = new MusicPlayer(); foreach (var songFilePath in Directory.GetFiles(dataPath + "/Music/Explore")) { if (!songFilePath.Contains("Morrowind Title")) { musicPlayer.AddSong(songFilePath); } } musicPlayer.Play(); } // Spawn the player. //MWEngine.SpawnPlayerInside(playerPrefab, new Vector2i(4537908, 1061158912), new Vector3(0.8f, -0.45f, -1.4f)); MWEngine.SpawnPlayerOutside(playerPrefab, new Vector2i(-2, -9), new Vector3(-137.94f, 2.30f, -1037.6f)); }
public CellManager(MorrowindDataReader dataReader, TextureManager textureManager, NIFManager nifManager, TemporalLoadBalancer temporalLoadBalancer) { this.dataReader = dataReader; this.textureManager = textureManager; this.nifManager = nifManager; this.temporalLoadBalancer = temporalLoadBalancer; }
private void OnDestroy() { if (MWDataReader != null) { MWDataReader.Close(); MWDataReader = null; } }
public MorrowindEngine(MorrowindDataReader mwDataReader, UIManager uiManager) { Debug.Assert(instance == null); instance = this; dataReader = mwDataReader; textureManager = new TextureManager(dataReader); materialManager = new MaterialManager(textureManager); nifManager = new NIFManager(dataReader, materialManager); temporalLoadBalancer = new TemporalLoadBalancer(); cellManager = new CellManager(dataReader, textureManager, nifManager, temporalLoadBalancer); RenderSettings.ambientMode = UnityEngine.Rendering.AmbientMode.Flat; RenderSettings.ambientIntensity = TESUnity.instance.ambientIntensity; sunObj = GameObjectUtils.CreateDirectionalLight(Vector3.zero, Quaternion.Euler(new Vector3(50, 330, 0))); sunObj.GetComponent <Light>().shadows = TESUnity.instance.renderSunShadows ? LightShadows.Soft : LightShadows.None; sunObj.SetActive(false); waterObj = GameObject.Instantiate(TESUnity.instance.waterPrefab); waterObj.SetActive(false); if (!TESUnity.instance.waterBackSideTransparent) { var side = waterObj.transform.GetChild(0); var sideMaterial = side.GetComponent <Renderer>().sharedMaterial; sideMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One); sideMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero); sideMaterial.SetInt("_ZWrite", 1); sideMaterial.DisableKeyword("_ALPHATEST_ON"); sideMaterial.DisableKeyword("_ALPHABLEND_ON"); sideMaterial.DisableKeyword("_ALPHAPREMULTIPLY_ON"); sideMaterial.renderQueue = -1; } Cursor.SetCursor(textureManager.LoadTexture("tx_cursor", true), Vector2.zero, CursorMode.Auto); _uiManager = uiManager; _uiManager.Active = true; }
public TextureManager(MorrowindDataReader dataReader) { this.dataReader = dataReader; }
public NIFManager(MorrowindDataReader dataReader, MaterialManager materialManager) { this.dataReader = dataReader; this.materialManager = materialManager; }
public NIFObjectBuilder(NiFile file, MorrowindDataReader dataReader, MaterialManager materialManager) { this.file = file; this.dataReader = dataReader; this.materialManager = materialManager; }