Beispiel #1
0
        void Start()
        {
            var dataPath = FileManager.GetFilePath(".", _gameId);

            _asset  = new TesAssetPack(dataPath, null);
            _data   = new TesDataPack(dataPath, null, _gameId);
            _engine = new TesEngine(AssetManager.GetAssetManager(EngineId.Tes), _asset, _data, UIManager);
            if (_playMusic)
            {
                // Start the music.
                _musicPlayer = new MusicPlayer();
                if (_gameId == GameId.Morrowind)
                {
                    foreach (var songFilePath in Directory.GetFiles(dataPath + "/Music/Explore"))
                    {
                        if (!songFilePath.Contains("Morrowind Title"))
                        {
                            _musicPlayer.AddSong(songFilePath);
                        }
                    }
                }
                _musicPlayer.Play();
            }

            // Spawn the player.
            _engine.SpawnPlayer(PlayerPrefab, new Vector3(-137.94f, 2.30f, -1037.6f)); // new Vector3Int(-2, -9, 0),
        }
        public static void Start()
        {
            var assetManager = AssetManager.GetAssetManager(EngineId.Ultima);

            Asset = assetManager.GetAssetPack(null).Result;
            Data  = assetManager.GetDataPack(null).Result;
        }
Beispiel #3
0
        public static void Start()
        {
            var assetManager = AssetManager.GetAssetManager(EngineId.Ultima);

            Asset = assetManager.GetAssetPack(null).Result;
            Data  = assetManager.GetDataPack(null).Result;

            //MakeObject("sta010").transform.Translate(Vector3.left * 1 + Vector3.up);
            //MakeObject("sta069").transform.Translate(Vector3.left * 1 + Vector3.down);

            MakeObject("lnd001").transform.Translate(Vector3.right * 1);
            MakeObject("lnd002").transform.Translate(Vector3.right * 1 + Vector3.up);
            MakeObject("lnd516").transform.Translate(Vector3.right * 1 + Vector3.down);

            //MakeObject("gmp065").transform.Translate(Vector3.back * 5);

            //MakeTexture("sta010");
            //MakeTexture("sta069");

            //MakeTexture("lnd001");
            //MakeTexture("lnd002");
            //MakeTexture("lnd516");
            //MakeTexture("lnd1137");

            //MakeTexture("gmp065");

            //MakeTexture("tex789");
        }
Beispiel #4
0
        public static void Start()
        {
            var assetUri = "game://Morrowind/Morrowind.bsa";
            var dataUri  = "game://Morrowind/Morrowind.esm";

            var assetManager = AssetManager.GetAssetManager(EngineId.Tes);

            Asset       = assetManager.GetAssetPack(assetUri).Result;
            Data        = assetManager.GetDataPack(dataUri).Result;
            CellManager = assetManager.GetCellManager(Asset, Data, LoadBalancer);

            // ambient
            RenderSettings.ambientMode      = UnityEngine.Rendering.AmbientMode.Flat;
            RenderSettings.ambientIntensity = 1.5f;

            // sun
            _sunObj = GameObjectUtils.CreateDirectionalLight(Vector3.zero, Quaternion.Euler(new Vector3(50, 330, 0)));
            _sunObj.GetComponent <Light>().shadows = LightShadows.Soft;
            _sunObj.SetActive(false);

            Cursor.SetCursor(Asset.LoadTexture("tx_cursor", 1), Vector2.zero, CursorMode.Auto);

            // engine
            SpawnPlayer(PlayerPrefab, new Vector3Int(-2, -9, 0), new Vector3(-137.94f, 2.30f, -1037.6f));
        }
        //var assetUri = "file:///C:/Program%20Files%20(x86)/Steam/steamapps/common/Morrowind/Data%20Files/Morrowind.*";
        //var dataUri = "file:///C:/Program%20Files%20(x86)/Steam/steamapps/common/Morrowind/Data%20Files/Morrowind.esm#Morrowind";
        //var file2Uri = "file://192.168.1.3/User/_ASSETS/Fallout4/Textures1";
        //var file4Uri = "http://192.168.1.3/assets/Morrowind/Morrowind.bsa";
        //var file4Uri = "http://192.168.1.3/assets/Morrowind/Morrowind.bsa";
        public static void Start()
        {
            //var assetUri = "game://Morrowind/Morrowind.bsa";
            //var dataUri = "game://Morrowind/Morrowind.esm";
            var assetUri = "game://SkyrimVR/Skyrim*";
            //var dataUri = "game://SkyrimVR/Skyrim.esm";
            //var assetUri = "game://Fallout4VR/Fallout4*";
            //var dataUri = "game://Fallout4VR/Fallout4.esm";

            var assetManager = AssetManager.GetAssetManager(EngineId.Tes);

            Asset = assetManager.GetAssetPack(assetUri).Result;
            //Data = assetManager.GetDataPack(dataUri).Result;

            // Morrowind
            //MakeObject("meshes/i/in_dae_room_l_floor_01.nif");
            //MakeObject("meshes/w/w_arrow01.nif");
            //MakeObject("meshes/x/ex_common_balcony_01.nif");

            // Skyrim
            var nifFileLoadingTask = Asset.LoadObjectInfoAsync("meshes/actors/alduin/alduin.nif").Result;

            MakeObject("meshes/markerx.nif");
            //MakeObject("meshes/w/w_arrow01.nif");
            //MakeObject("meshes/x/ex_common_balcony_01.nif");
        }
Beispiel #6
0
 public static void OnDestroy()
 {
     if (Asset != null)
     {
         Asset.Dispose();
         Asset = null;
     }
     if (Data != null)
     {
         Data.Dispose();
         Data = null;
     }
 }
Beispiel #7
0
 void OnDestroy()
 {
     if (_asset != null)
     {
         _asset.Dispose();
         _asset = null;
     }
     if (_data != null)
     {
         _data.Dispose();
         _data = null;
     }
 }
        public static void Start()
        {
            var assetManager = AssetManager.GetAssetManager(EngineId.Ultima);

            Asset  = assetManager.GetAssetPack(null).Result;
            Data   = assetManager.GetDataPack(null).Result;
            Engine = new UltimaEngine(assetManager, Asset, Data, null);

            var scale = ConvertUtils.ExteriorCellSideLengthInMeters;

            //Engine.SpawnPlayerAndUpdate(PlayerPrefab, new Vector3(4 * scale, 20, 25 * scale));
            //Engine.SpawnPlayerAndUpdate(PlayerPrefab, new Vector3(15 * scale, 20, 25 * scale));
            Engine.SpawnPlayerAndUpdate(PlayerPrefab, new Vector3(11 * scale, 10, 29 * scale));
        }
Beispiel #9
0
        public BaseEngine(IAssetManager assetManager, IAssetPack asset, IDataPack data)
        {
            AssetManager = assetManager;
            Asset        = asset;
            Data         = data;

            LoadBalancer = new TemporalLoadBalancer();
            CellManager  = assetManager.GetCellManager(asset, data, LoadBalancer);
            var game = BaseSettings.Game;

            // ambient
            RenderSettings.ambientMode      = UnityEngine.Rendering.AmbientMode.Flat;
            RenderSettings.ambientIntensity = game.AmbientIntensity;

            // sun
            _sunObj = GameObjectUtils.CreateDirectionalLight(Vector3.zero, Quaternion.Euler(new Vector3(50, 330, 0)));
            _sunObj.GetComponent <Light>().shadows = game.RenderSunShadows ? LightShadows.Soft : LightShadows.None;
            _sunObj.SetActive(false);
            if (game.DayNightCycle)
            {
                _sunObj.AddComponent <DayNightCycle>();
            }

            //// water
            //_waterObj = GameObject.Instantiate(TesGame.instance.WaterPrefab);
            //_waterObj.SetActive(false);
            //var water = _waterObj.GetComponent<Water>();
            //water.waterMode = game.instance.WaterQuality;
            //if (!TesGame.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(Asset.LoadTexture("tx_cursor", 1), Vector2.zero, CursorMode.Auto);
        }
Beispiel #10
0
        public SimpleEngine(IEstateHandler handler, IAssetPack assetPack, IDataPack dataPack)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }
            AssetPack   = assetPack ?? throw new ArgumentNullException(nameof(assetPack));
            DataPack    = dataPack ?? throw new ArgumentNullException(nameof(dataPack));
            CellManager = handler.CellManagerFunc(LoadBalancer, assetPack, dataPack, null) ?? throw new ArgumentNullException(nameof(handler.CellManagerFunc));

            // ambient
            RenderSettings.ambientMode      = UnityEngine.Rendering.AmbientMode.Flat;
            RenderSettings.ambientIntensity = AmbientIntensity;

            // sun
            _sunObj = GameObjectUtils.CreateDirectionalLight(Vector3.zero, Quaternion.Euler(new Vector3(50, 330, 0)));
            _sunObj.GetComponent <Light>().shadows = RenderSunShadows ? LightShadows.Soft : LightShadows.None;
            _sunObj.SetActive(false);
            if (DayNightCycle)
            {
                _sunObj.AddComponent <DayNightCycle>();
            }

            //// water
            //_waterObj = GameObject.Instantiate(TesGame.instance.WaterPrefab);
            //_waterObj.SetActive(false);
            //var water = _waterObj.GetComponent<Water>();
            //water.waterMode = game.instance.WaterQuality;
            //if (!TesGame.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(Asset.LoadTexture("tx_cursor", 1), Vector2.zero, CursorMode.Auto);
        }
Beispiel #11
0
        public static void Start()
        {
            var assetUri = "game://Morrowind/Morrowind.bsa";
            var dataUri  = "game://Morrowind/Morrowind.esm";

            //var assetUri = "game://Oblivion/Oblivion*";
            //var dataUri = "game://Oblivion/Oblivion.esm";

            var assetManager = AssetManager.GetAssetManager(EngineId.Tes);

            Asset  = assetManager.GetAssetPack(assetUri).Result;
            Data   = assetManager.GetDataPack(dataUri).Result;
            Engine = new BaseEngine(assetManager, Asset, Data);

            // engine
            Engine.SpawnPlayer(PlayerPrefab, new Vector3(-137.94f, 2.30f, -1037.6f)); // new Vector3Int(-2, -9)

            // engine - oblivion
            //Engine.SpawnPlayer(PlayerPrefab, new Vector3Int(0, 0, 60), new Vector3(0, 0, 0));
        }
Beispiel #12
0
 public UltimaEngine(IAssetManager assetManager, IAssetPack asset, IDataPack data, UltimaUIManager uiManager)
     : base(assetManager, asset, data)
 {
     UIManager = uiManager;
     //UIManager.Active = true;
 }
Beispiel #13
0
 public ICellManager GetCellManager(IAssetPack asset, IDataPack data, TemporalLoadBalancer temporalLoadBalancer)
 {
     throw new NotImplementedException();
 }
Beispiel #14
0
 public static ICellManager GetUltimaCellManager(this TemporalLoadBalancer loadBalancer, IAssetPack assetPack, IDataPack dataPack, Func <object> func = null) => new UltimaCellManager(loadBalancer, (UltimaAssetPack)assetPack, (UltimaDataPack)dataPack);
 public static ICellManager GetTesCellManager(this TemporalLoadBalancer loadBalancer, IAssetPack assetPack, IDataPack dataPack, Func <object> func = null) => new TesCellManager(loadBalancer, (TesAssetPack)assetPack, (TesDataPack)dataPack);
Beispiel #16
0
 public TesEngine(IAssetManager assetManager, IAssetPack asset, IDataPack data, TesUIManager uiManager)
     : base(assetManager, asset, data)
 {
     UIManager        = uiManager;
     UIManager.Active = true;
 }
Beispiel #17
0
 public TextureManager(IAssetPack asset)
 {
     _asset = asset;
 }
Beispiel #18
0
 public ICellManager GetCellManager(IAssetPack asset, IDataPack data, TemporalLoadBalancer loadBalancer)
 {
     return(new TesCellManager((TesAssetPack)asset, (TesDataPack)data, loadBalancer));
 }
 public ICellManager GetCellManager(IAssetPack asset, IDataPack data, TemporalLoadBalancer loadBalancer)
 {
     return(new UltimaCellManager((UltimaAssetPack)asset, (UltimaDataPack)data, loadBalancer));
 }