示例#1
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);
        }
示例#2
0
        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;
        }
示例#3
0
 public static ICellManager GetUltimaCellManager(this TemporalLoadBalancer loadBalancer, IAssetPack assetPack, IDataPack dataPack, Func <object> func = null) => new UltimaCellManager(loadBalancer, (UltimaAssetPack)assetPack, (UltimaDataPack)dataPack);
示例#4
0
 public CellManager(MorrowindDataReader dataReader, TextureManager textureManager, NIFManager nifManager, TemporalLoadBalancer temporalLoadBalancer)
 {
     this.dataReader           = dataReader;
     this.textureManager       = textureManager;
     this.nifManager           = nifManager;
     this.temporalLoadBalancer = temporalLoadBalancer;
 }
示例#5
0
 public static ICellManager GetTesCellManager(this TemporalLoadBalancer loadBalancer, IAssetPack assetPack, IDataPack dataPack, Func <object> func = null) => new TesCellManager(loadBalancer, (TesAssetPack)assetPack, (TesDataPack)dataPack);
示例#6
0
 public UltimaCellManager(UltimaAssetPack asset, UltimaDataPack data, TemporalLoadBalancer loadBalancer)
 {
     _asset        = asset;
     _data         = data;
     _loadBalancer = loadBalancer;
 }
示例#7
0
 public TesCellManager(TesAssetPack asset, TesDataPack data, TemporalLoadBalancer loadBalancer)
 {
     _asset        = asset;
     _data         = data;
     _loadBalancer = loadBalancer;
 }
示例#8
0
 public TesCellManager(TemporalLoadBalancer loadBalancer, TesAssetPack assetPack, TesDataPack dataPack)
 {
     _loadBalancer = loadBalancer;
     _assetPack    = assetPack;
     _dataPack     = dataPack;
 }
示例#9
0
 public UltimaCellManager(TemporalLoadBalancer loadBalancer, UltimaAssetPack assetPack, UltimaDataPack dataPack)
 {
     _loadBalancer = loadBalancer;
     _assetPack    = assetPack;
     _dataPack     = dataPack;
 }
示例#10
0
 public ICellManager GetCellManager(IAssetPack asset, IDataPack data, TemporalLoadBalancer loadBalancer)
 {
     return(new UltimaCellManager((UltimaAssetPack)asset, (UltimaDataPack)data, loadBalancer));
 }
示例#11
0
 public ICellManager GetCellManager(IAssetPack asset, IDataPack data, TemporalLoadBalancer temporalLoadBalancer)
 {
     throw new NotImplementedException();
 }
示例#12
0
 public ICellManager GetCellManager(IAssetPack asset, IDataPack data, TemporalLoadBalancer loadBalancer)
 {
     return(new TesCellManager((TesAssetPack)asset, (TesDataPack)data, loadBalancer));
 }