示例#1
0
    private void Awake()
    {
        Camera.onPreCull += OnCameraPreCull;
        CellManager.OnFinishedLoadingCells += SwitchCell;

        // Night Sky
        //var nightNif = new Nif.NiFile(nightSkyPath);
        //var nightGo = nightNif.CreateGameObject();

        //nightCommandBuffer = new CommandBuffer();
        //var nightMeshes = nightGo.GetComponentsInChildren<MeshFilter>();
        //var nightMeshRenderers = nightGo.GetComponentsInChildren<MeshRenderer>();
        //for (var i = 0; i < nightMeshes.Length; i++)
        //{
        //	if (i > 3)
        //		continue;

        //	var material = nightMeshRenderers[i].sharedMaterial;
        //	material.shader = MaterialManager.Instance.NightSkyShader;

        //	var mesh = nightMeshes[i].sharedMesh;
        //	nightCommandBuffer.DrawMesh(mesh, Matrix4x4.identity, material);
        //}

        //Camera.main.AddCommandBuffer(CameraEvent.AfterForwardOpaque, nightCommandBuffer);
        //Destroy(nightGo);

        // Load skybox
        var reader = BsaFileReader.LoadArchiveFileData($"meshes\\{skyboxPath}");
        var nif    = new Nif.NiFile(reader);
        var go     = nif.CreateGameObject(Camera.main.transform);

        var renderer = go.GetComponentInChildren <Renderer>();

        skyboxMaterial = new Material(MaterialManager.Instance.SkyShader);
        //var skyCommandBuffer = new CommandBuffer();
        skyboxMesh = go.GetComponentInChildren <MeshFilter>().sharedMesh;
        //skyCommandBuffer.DrawMesh(skyboxMesh, Matrix4x4.TRS(new Vector3(0, -15, 0), Quaternion.identity, Vector3.one), skyboxMaterial);

        //Camera.main.AddCommandBuffer(CameraEvent.BeforeSkybox, skyCommandBuffer);
        if (!Application.isPlaying)
        {
            DestroyImmediate(go);
        }
        else
        {
            Destroy(go);
        }

        minimumTimeBetweenEnvironmentalSounds = IniManager.GetFloat("Weather", "Minimum Time Between Environmental Sounds");
        maximumTimeBetweenEnvironmentalSounds = IniManager.GetFloat("Weather", "Maximum Time Between Environmental Sounds");
    }
示例#2
0
    private void Start()
    {
        var reader = BsaFileReader.LoadArchiveFileData($"meshes\\raindrop.nif");
        var nif    = new Nif.NiFile(reader);
        var go     = nif.CreateGameObject();

        var mesh     = go.GetComponentInChildren <MeshFilter>().sharedMesh;
        var material = go.GetComponentInChildren <Renderer>().sharedMaterial;

        var particleSystemRenderer = GetComponent <ParticleSystemRenderer>();

        particleSystemRenderer.mesh     = mesh;
        particleSystemRenderer.material = material;

        Destroy(go);
    }
示例#3
0
 public NiFloatInterpController(NiFile niFile) : base(niFile)
 {
 }
 public NiWireframeProperty(NiFile niFile) : base(niFile)
 {
     enabled = niFile.Reader.ReadInt16();
 }
示例#5
0
 public NiTexture(NiFile niFile) : base(niFile)
 {
 }
示例#6
0
 public NiObject(NiFile niFile)
 {
     this.niFile = niFile;
 }
 public NiSingleInterpController(NiFile niFile) : base(niFile)
 {
 }
示例#8
0
 public AvoidNode(NiFile niFile) : base(niFile)
 {
 }
示例#9
0
 public Ref(NiFile niFile)
 {
     index     = niFile.Reader.ReadInt32();
     niObjects = niFile.NiObjects;
 }
 public NiParticleRotation(NiFile niFile) : base(niFile)
 {
     randomInitialAxis = niFile.Reader.ReadByte();
     initialAxis       = niFile.Reader.ReadVector3();
     rotationSpeed     = niFile.Reader.ReadSingle();
 }