Пример #1
0
 // Update is called once per frame
 void Update()
 {
     if (mist && value < 1)
     {
         value += Time.deltaTime * 0.1f;
         Graph.SetInputFloat("Normal", value);
         Graph.SetInputFloat("Roughness", value);
         Graph.QueueForRender();
         Graph.RenderSync();
     }
     if (!mist && value > 0)
     {
         value -= Time.deltaTime * 0.1f;
         Graph.SetInputFloat("Normal", value);
         Graph.SetInputFloat("Roughness", value);
         Graph.QueueForRender();
         Graph.RenderSync();
     }
 }
Пример #2
0
 // Update is called once per frame
 void Update()
 {
     if (IsDown && Graph.GetInputFloat("WaterLevel1") < 1)
     {
         value += Time.deltaTime * 0.7f;
         Graph.SetInputFloat("WaterLevel1", value);
         Graph.QueueForRender();
         Graph.RenderSync();
     }
     if (!IsDown && Graph.GetInputFloat("WaterLevel2") < 1)
     {
         value += Time.deltaTime * 0.7f;
         Graph.SetInputFloat("WaterLevel2", value);
         Graph.QueueForRender();
         Graph.RenderSync();
     }
     if (Input.GetButtonDown("Jump"))
     {
         ChangeBehavior();
     }
 }
Пример #3
0
        /// <summary>
        /// Updates procedural textures.
        /// Array of float values for the texture is included as well as reference to the (this) object that the texture should be sent to.
        /// Public becasue PlanetManagerEditor needs to access this method to force updating of procedural textures.
        /// </summary>
        /// <param name="_textureName">Name of texture to be rebuilt (or "All")</param>
        public override void UpdateProceduralTexture(string _textureName)
        {
            if ((int)PlanetManager.DebugLevel > 1)
            {
                Debug.Log("GasPlanet.cs: UpdateProceduralTexture(" + _textureName + ")");
            }

            if (PlanetManager.TextureDetailMode == PlanetManager.TextureDetailModes.Progressive ||
                PlanetManager.TextureDetailMode == PlanetManager.TextureDetailModes.Progressive_Separate)
            {
                if (textureProgressiveStep == -1)
                {
                    SetDefaultProgressiveTextureLOD();
                }
            }

            if (_textureName == "All" || _textureName == "Maps")
            {
                _proceduralMaterialMaps = PlanetManager.Instance.GetUniqueProceduralMaterial(_dictionaryMaterials["gas"].GetPropertyMaterial(), gameObject, "gas");
                SetProceduralMaterialFloats("Maps", _proceduralMaterialMaps);
                _proceduralMaterialMaps.SetInputVector2Int("$outputsize", _lodGas + 4, _lodGas + 4);
                _proceduralMaterialMaps.RenderSync();
                _textureMaps          = _proceduralMaterialMaps.GetGeneratedTextures().ToList().Where(texture => texture.name.Contains("any")).FirstOrDefault();
                _textureCapNormal     = _proceduralMaterialMaps.GetGeneratedTextures().ToList().Where(texture => texture.name.Contains("CapNormal")).FirstOrDefault();
                _textureBodyNormal    = _proceduralMaterialMaps.GetGeneratedTextures().ToList().Where(texture => texture.name.Contains("BodyNormal")).FirstOrDefault();
                _texturePaletteLookup = _proceduralMaterialMaps.GetGeneratedTextures().ToList().Where(texture => texture.name.Contains("Palette_Diffuse")).FirstOrDefault();
                _material.SetTexture("_BodyTexture", _textureMaps);
                _material.SetTexture("_CapTexture", _textureMaps);
                _material.SetTexture("_BodyNormal", _textureBodyNormal);
                _material.SetTexture("_CapNormal", _textureCapNormal);
                _material.SetTexture("_PaletteLookup", _texturePaletteLookup);
            }

            // Start timer when rebuild of textures started
            _timerStartBuildingTextures = Time.realtimeSinceStartup;
        }