Asteroid Belts
Sector renderer is now also rendering asteroid belts. All gravity calculations have been moved out of monobehaviors.
This commit is contained in:
parent
d12d7c5c45
commit
a981a46170
76 changed files with 25027 additions and 2016 deletions
30
Assets/Scripts/Sector Display/BlueNoiseProvider.cs
Normal file
30
Assets/Scripts/Sector Display/BlueNoiseProvider.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class BlueNoiseProvider : MonoBehaviour
|
||||
{
|
||||
public Texture2D NoiseTexture;
|
||||
|
||||
private Camera _camera;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_camera = Camera.main;
|
||||
|
||||
Shader.SetGlobalTexture("_DitheringTex", NoiseTexture);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Shader.SetGlobalVector("_DitheringCoords", new Vector4(
|
||||
(float)_camera.scaledPixelWidth / (float)NoiseTexture.width,
|
||||
(float)_camera.scaledPixelWidth / (float)NoiseTexture.height,
|
||||
Random.value,
|
||||
Random.value
|
||||
));
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Sector Display/BlueNoiseProvider.cs.meta
Normal file
11
Assets/Scripts/Sector Display/BlueNoiseProvider.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 13f1fa636e0245e42be783568a76e3d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -7,5 +7,4 @@ public class GasGiantObject : PlanetObject
|
|||
public SunMaterial SunMaterial;
|
||||
public GradientMapper GradientMapper;
|
||||
public MeshRenderer GravityWaves;
|
||||
public WaveScroll WaveScroll;
|
||||
}
|
||||
|
|
|
|||
119
Assets/Scripts/Sector Display/GradientMapper.cs
Normal file
119
Assets/Scripts/Sector Display/GradientMapper.cs
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class GradientMapper : MonoBehaviour
|
||||
{
|
||||
[Header("Gradient map parameters")] public Vector2Int GradientMapDimensions = new Vector2Int(32, 1);
|
||||
public Gradient Gradient;
|
||||
|
||||
[Header("Enable testing")] public bool Testing = false;
|
||||
|
||||
private MeshRenderer _meshRenderer;
|
||||
private Material _material;
|
||||
|
||||
[HideInInspector] public Texture2D Texture;
|
||||
|
||||
public static int TotalMaps = 0;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_meshRenderer = GetComponent<MeshRenderer>();
|
||||
if (_meshRenderer == null)
|
||||
{
|
||||
Debug.LogWarning("No mesh renderer on this game object! Removing GradientMapper");
|
||||
DestroyImmediate(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
_material = _meshRenderer.sharedMaterial;
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Testing)
|
||||
{
|
||||
ApplyGradient(Gradient);
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyGradient(Gradient gradient)
|
||||
{
|
||||
Texture = new Texture2D(GradientMapDimensions.x, GradientMapDimensions.y);
|
||||
Texture.wrapMode = TextureWrapMode.Clamp;
|
||||
for (int x = 0; x < GradientMapDimensions.x; x++)
|
||||
{
|
||||
for (int y = 0; y < GradientMapDimensions.y; y++)
|
||||
{
|
||||
Texture.SetPixel(x, y, gradient.Evaluate( max((float)x / GradientMapDimensions.x,(float)y / GradientMapDimensions.y)));
|
||||
}
|
||||
}
|
||||
|
||||
Texture.Apply();
|
||||
if (_material.HasProperty("_ColorRamp"))
|
||||
{
|
||||
_material.SetTexture("_ColorRamp", Texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[CustomEditor(typeof(GradientMapper))]
|
||||
public class GradientMapperEditor : Editor
|
||||
{
|
||||
private int _subfolder;
|
||||
private string[] Subfolders = {"Sun", "Gas Giant"};
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
GradientMapper gradientMapper = target as GradientMapper;
|
||||
DrawDefaultInspector();
|
||||
if (gradientMapper.Testing)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Testing is active.", MessageType.Warning, true);
|
||||
}
|
||||
|
||||
_subfolder = EditorGUILayout.Popup("Subfolder", _subfolder, Subfolders);
|
||||
|
||||
if (GUILayout.Button("Make Gradient Map"))
|
||||
{
|
||||
gradientMapper.Testing = false;
|
||||
if (!AssetDatabase.IsValidFolder("Assets/Resources/Gradients"))
|
||||
{
|
||||
AssetDatabase.CreateFolder("Assets/Resources/", "Gradients");
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
if (!Directory.Exists($"{Application.dataPath}Resources/Gradients/{Subfolders[_subfolder]}"))
|
||||
{
|
||||
Directory.CreateDirectory($"{Application.dataPath}/Resources/Gradients/{Subfolders[_subfolder]}");
|
||||
GradientMapper.TotalMaps = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GradientMapper.TotalMaps = Directory.GetFiles(Application.dataPath + "/Resources/Gradients/").Length;
|
||||
}
|
||||
|
||||
byte[] bytes = gradientMapper.Texture.EncodeToPNG();
|
||||
|
||||
string fileName;
|
||||
do fileName = $"{Application.dataPath}/Resources/Gradients/{Subfolders[_subfolder] + '/'}gradient_{GradientMapper.TotalMaps++}.png";
|
||||
while (File.Exists(fileName));
|
||||
|
||||
File.WriteAllBytes(fileName, bytes);
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
Debug.Log("Gradient map saved!");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Scripts/Sector Display/GradientMapper.cs.meta
Normal file
11
Assets/Scripts/Sector Display/GradientMapper.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6d2f8d4338ab9044cb603b1d3e8f189a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Assets/Scripts/Sector Display/GravityObject.cs
Normal file
18
Assets/Scripts/Sector Display/GravityObject.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GravityObject : MonoBehaviour
|
||||
{
|
||||
[HideInInspector]
|
||||
public Material GravityMaterial;
|
||||
|
||||
[HideInInspector]
|
||||
public string Shader;
|
||||
|
||||
void Start () {
|
||||
Gravity.Instance.GravityObjects.Add(this);
|
||||
GravityMaterial = GetComponent<MeshRenderer>().material;
|
||||
Shader = GravityMaterial.shader.name;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Sector Display/GravityObject.cs.meta
Normal file
11
Assets/Scripts/Sector Display/GravityObject.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a13344dbee46f384881bd54203513967
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -5,7 +5,6 @@ using UnityEngine;
|
|||
public class PlanetObject : MonoBehaviour
|
||||
{
|
||||
public MeshRenderer Body;
|
||||
public SnapToGrid GridSnap;
|
||||
public MeshRenderer GravityWell;
|
||||
public MeshRenderer Icon;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,13 +9,8 @@ public class SectorDisplayProperties : ScriptableObject
|
|||
public float DefaultViewDistance;
|
||||
public float DefaultMinimapDistance;
|
||||
public ExponentialCurve BodyDiameter;
|
||||
public ExponentialCurve GravityDepth;
|
||||
public ExponentialCurve GravityRadius;
|
||||
public ExponentialCurve WaveDepth;
|
||||
public ExponentialCurve WaveRadius;
|
||||
public ExponentialCurve WaveFrequency;
|
||||
public ExponentialCurve WaveSpeed;
|
||||
public GravitySettings GravitySettings;
|
||||
public ExponentialCurve FogTintRadius;
|
||||
public ExponentialCurve LightRadius;
|
||||
public Gradient DefaultGradient;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cinemachine;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
using static Unity.Mathematics.math;
|
||||
using Unity.Mathematics;
|
||||
|
||||
public class SectorRenderer : MonoBehaviour
|
||||
{
|
||||
|
|
@ -14,9 +18,10 @@ public class SectorRenderer : MonoBehaviour
|
|||
public Camera[] FogCameras;
|
||||
public Camera[] MinimapCameras;
|
||||
public Material FogMaterial;
|
||||
public ActionGameManager Manager;
|
||||
public float FogFarFadeFraction = .125f;
|
||||
public float FarPlaneDistanceMultiplier = 2;
|
||||
public Mesh[] AsteroidMeshes;
|
||||
public Material AsteroidMaterial;
|
||||
|
||||
[Header("Prefabs")]
|
||||
public GameObject Belt;
|
||||
|
|
@ -31,6 +36,8 @@ public class SectorRenderer : MonoBehaviour
|
|||
private Dictionary<Guid, Transform> _planets = new Dictionary<Guid, Transform>();
|
||||
private Zone _zone;
|
||||
private float _viewDistance;
|
||||
|
||||
public GameContext Context { get; set; }
|
||||
|
||||
public float ViewDistance
|
||||
{
|
||||
|
|
@ -56,29 +63,36 @@ public class SectorRenderer : MonoBehaviour
|
|||
|
||||
void Start()
|
||||
{
|
||||
LoadZone(Manager.CurrentZone);
|
||||
ViewDistance = Properties.DefaultViewDistance;
|
||||
MinimapDistance = Properties.DefaultMinimapDistance;
|
||||
Manager.ZoneChanged += (_, args) => LoadZone(args.NewZone);
|
||||
}
|
||||
|
||||
void LoadZone(Zone zone)
|
||||
public void LoadZone(Zone zone)
|
||||
{
|
||||
_zone = zone;
|
||||
_zone.GravitySettings = Properties.GravitySettings;
|
||||
SectorBrushes.localScale = zone.Data.Radius * 2 * Vector3.one;
|
||||
if (_planets.Count > 0)
|
||||
{
|
||||
foreach (var planet in _planets.Values)
|
||||
{
|
||||
Destroy(planet.gameObject);
|
||||
}
|
||||
_planets.Clear();
|
||||
}
|
||||
_zone.ZoneDepth = 50;
|
||||
_zone.ZoneDepthExponent = .25f;
|
||||
_zone.ZoneDepthRadius = zone.Data.Radius * 2;
|
||||
ClearZone();
|
||||
foreach(var p in zone.Planets.Values)
|
||||
LoadPlanet(p);
|
||||
}
|
||||
|
||||
void LoadPlanet(PlanetData planetData)
|
||||
public void ClearZone()
|
||||
{
|
||||
if (_planets.Count > 0)
|
||||
{
|
||||
foreach (var planet in _planets.Values)
|
||||
{
|
||||
DestroyImmediate(planet.gameObject);
|
||||
}
|
||||
_planets.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
void LoadPlanet(BodyData planetData)
|
||||
{
|
||||
if (planetData is AsteroidBeltData beltData)
|
||||
{
|
||||
|
|
@ -93,49 +107,85 @@ public class SectorRenderer : MonoBehaviour
|
|||
{
|
||||
planet = Instantiate(Sun, SectorRoot);
|
||||
var sun = (SunObject) planet;
|
||||
sun.Light.color = sunData.LightColor;
|
||||
sun.Light.range = Properties.LightRadius.Evaluate(sunData.Mass);
|
||||
sun.FogTint.material.SetColor("_Color", sunData.FogTintColor);
|
||||
sun.FogTint.transform.localScale = Properties.FogTintRadius.Evaluate(sunData.Mass) * Vector3.one;
|
||||
sunData.LightColor.Subscribe(c => sun.Light.color = c);
|
||||
sunData.Mass.Subscribe(m => sun.Light.range = Properties.LightRadius.Evaluate(m));
|
||||
sunData.FogTintColor.Subscribe(c => sun.FogTint.material.SetColor("_Color", c));
|
||||
sunData.Mass.Subscribe(m => sun.FogTint.transform.localScale = Properties.FogTintRadius.Evaluate(m) * Vector3.one);
|
||||
}
|
||||
else planet = Instantiate(GasGiant, SectorRoot);
|
||||
|
||||
var gas = (GasGiantObject) planet;
|
||||
gas.GradientMapper.ApplyGradient(gasGiantData.Colors);
|
||||
gas.SunMaterial.AlbedoRotationSpeed = gasGiantData.AlbedoRotationSpeed;
|
||||
gas.SunMaterial.FirstOffsetRotationSpeed = gasGiantData.AlbedoRotationSpeed;
|
||||
gas.SunMaterial.SecondOffsetRotationSpeed = gasGiantData.AlbedoRotationSpeed;
|
||||
gas.SunMaterial.FirstOffsetDomainRotationSpeed = gasGiantData.AlbedoRotationSpeed;
|
||||
gas.SunMaterial.SecondOffsetDomainRotationSpeed = gasGiantData.AlbedoRotationSpeed;
|
||||
gas.GravityWaves.material.SetFloat("_Depth", Properties.WaveDepth.Evaluate(planetData.Mass));
|
||||
gas.GravityWaves.material.SetFloat("_Frequency", Properties.WaveFrequency.Evaluate(planetData.Mass));
|
||||
gas.WaveScroll.Speed = Properties.WaveSpeed.Evaluate(planetData.Mass);
|
||||
gas.GravityWaves.transform.localScale = Properties.WaveRadius.Evaluate(planetData.Mass) * Vector3.one;
|
||||
gasGiantData.Colors.Subscribe(c => gas.GradientMapper.ApplyGradient(c.ToGradient()));
|
||||
gasGiantData.AlbedoRotationSpeed.Subscribe(f => gas.SunMaterial.AlbedoRotationSpeed = f);
|
||||
gasGiantData.FirstOffsetRotationSpeed.Subscribe(f => gas.SunMaterial.FirstOffsetRotationSpeed = f);
|
||||
gasGiantData.SecondOffsetRotationSpeed.Subscribe(f => gas.SunMaterial.SecondOffsetRotationSpeed = f);
|
||||
gasGiantData.FirstOffsetDomainRotationSpeed.Subscribe(f => gas.SunMaterial.FirstOffsetDomainRotationSpeed = f);
|
||||
gasGiantData.SecondOffsetDomainRotationSpeed.Subscribe(f => gas.SunMaterial.SecondOffsetDomainRotationSpeed = f);
|
||||
planetData.Mass.CombineLatest(planetData.GravityRadiusMultiplier,
|
||||
(mass, radius) => Properties.GravitySettings.WaveRadius.Evaluate(mass) * radius)
|
||||
.Subscribe(f => gas.GravityWaves.transform.localScale = f * Vector3.one);
|
||||
planetData.Mass.CombineLatest(planetData.GravityDepthMultiplier,
|
||||
(mass, depth) => Properties.GravitySettings.WaveDepth.Evaluate(mass) * depth)
|
||||
.Subscribe(f => gas.GravityWaves.material.SetFloat("_Depth", f));
|
||||
planetData.Mass.Subscribe(f =>
|
||||
{
|
||||
gas.GravityWaves.material.SetFloat("_Frequency", Properties.GravitySettings.WaveFrequency.Evaluate(f));
|
||||
//gas.WaveScroll.Speed = Properties.GravitySettings.WaveSpeed.Evaluate(f);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
planet = Instantiate(Planet, SectorRoot);
|
||||
planet.Icon.material.mainTexture = planetData.Mass > Manager.Context.GlobalData.PlanetMass ? PlanetIcon : PlanetoidIcon;
|
||||
//planet.Icon.material.mainTexture = planetData.Mass > Context.GlobalData.PlanetMass ? PlanetIcon : PlanetoidIcon;
|
||||
}
|
||||
|
||||
planetData.Mass.Subscribe(mass =>
|
||||
{
|
||||
var diameter = Properties.BodyDiameter.Evaluate(mass);
|
||||
planet.Body.transform.localScale = diameter * Vector3.one;
|
||||
//planet.GridSnap.Offset = diameter * 2;
|
||||
});
|
||||
|
||||
var diameter = Properties.BodyDiameter.Evaluate(planetData.Mass);
|
||||
planet.Body.transform.localScale = diameter * Vector3.one;
|
||||
planet.GravityWell.transform.localScale = Properties.GravityRadius.Evaluate(planetData.Mass) * Vector3.one;
|
||||
planet.GravityWell.material.SetFloat("_Depth", Properties.GravityDepth.Evaluate(planetData.Mass));
|
||||
planet.GridSnap.Offset = diameter * 2;
|
||||
planetData.Mass.CombineLatest(planetData.GravityRadiusMultiplier,
|
||||
(mass, radius) => Properties.GravitySettings.GravityRadius.Evaluate(mass) * radius)
|
||||
.Subscribe(f => planet.GravityWell.transform.localScale = f * Vector3.one);
|
||||
planetData.Mass.CombineLatest(planetData.GravityDepthMultiplier,
|
||||
(mass, depth) => Properties.GravitySettings.GravityDepth.Evaluate(mass) * depth)
|
||||
.Subscribe(f => planet.GravityWell.material.SetFloat("_Depth", f));
|
||||
|
||||
_planets.Add(planetData.ID, planet.transform);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
foreach(var belt in _zone.AsteroidBelts.Values)
|
||||
{
|
||||
for (int i = 0; i < AsteroidMeshes.Length; i++)
|
||||
{
|
||||
var matrices = belt.Transforms
|
||||
.Skip((int) (((float)i / AsteroidMeshes.Length) * belt.Transforms.Length))
|
||||
.Take((int) (1f / AsteroidMeshes.Length * belt.Transforms.Length))
|
||||
.Select(v => Matrix4x4.TRS(
|
||||
new Vector3(v.x, _zone.GetHeight(v.xy) + 5, v.y),
|
||||
Quaternion.Euler(cos(v.z + (float) i / AsteroidMeshes.Length) * 100, sin(v.z + (float) i / AsteroidMeshes.Length) * 100, 0),
|
||||
Vector3.one * (v.w)))
|
||||
.ToArray();
|
||||
Graphics.DrawMeshInstanced(AsteroidMeshes[i], 0, AsteroidMaterial, matrices);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LateUpdate()
|
||||
{
|
||||
foreach (var planet in _planets)
|
||||
{
|
||||
planet.Value.position = ((Vector2) _zone.GetOrbitPosition(_zone.Planets[planet.Key].Orbit)).Flatland();
|
||||
var p = _zone.GetOrbitPosition(_zone.Planets[planet.Key].Orbit);
|
||||
planet.Value.position = new Vector3(p.x, _zone.GetHeight(p) + 10, p.y);
|
||||
}
|
||||
|
||||
var pos = FogCameraParent.position;
|
||||
FogMaterial.SetVector("_GridTransform", new Vector4(pos.x,pos.z,_viewDistance*2));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
//[ExecuteInEditMode]
|
||||
public class SunMaterial : MonoBehaviour
|
||||
|
|
@ -39,14 +40,23 @@ public class SunMaterial : MonoBehaviour
|
|||
_secondOffsetRotation = Random.value * Mathf.PI;
|
||||
_albedoRotation = Random.value * Mathf.PI;
|
||||
}
|
||||
|
||||
public void ApplyGradient(Gradient gradient)
|
||||
{
|
||||
var tex = gradient.ToTexture();
|
||||
if (_material.HasProperty("_ColorRamp"))
|
||||
{
|
||||
_material.SetTexture("_ColorRamp", tex);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnWillRenderObject()
|
||||
{
|
||||
_firstOffsetDomainRotation = FirstOffsetDomainRotationSpeed * SpeedMultiplier * Time.time;
|
||||
_firstOffsetRotation = FirstOffsetRotationSpeed * SpeedMultiplier * Time.time;
|
||||
_secondOffsetDomainRotation = SecondOffsetDomainRotationSpeed * SpeedMultiplier * Time.time;
|
||||
_secondOffsetRotation = SecondOffsetRotationSpeed * SpeedMultiplier * Time.time;
|
||||
_albedoRotation = AlbedoRotationSpeed * SpeedMultiplier * Time.time;
|
||||
_firstOffsetDomainRotation += FirstOffsetDomainRotationSpeed * SpeedMultiplier * Time.deltaTime;
|
||||
_firstOffsetRotation += FirstOffsetRotationSpeed * SpeedMultiplier * Time.deltaTime;
|
||||
_secondOffsetDomainRotation += SecondOffsetDomainRotationSpeed * SpeedMultiplier * Time.deltaTime;
|
||||
_secondOffsetRotation += SecondOffsetRotationSpeed * SpeedMultiplier * Time.deltaTime;
|
||||
_albedoRotation += AlbedoRotationSpeed * SpeedMultiplier * Time.deltaTime;
|
||||
|
||||
_material.SetVector("_LightingDirection", LightingDirection);
|
||||
_material.SetMatrix("_FirstOffsetDomainRotation", Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, Mathf.Rad2Deg * _firstOffsetDomainRotation, 0), Vector3.one));
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ public class WaveScroll : MonoBehaviour
|
|||
}
|
||||
|
||||
void Update () {
|
||||
_material.SetFloat("_Phase", _phase+=Time.deltaTime*Speed);
|
||||
_material.SetFloat("_Phase", _phase=Time.time*Speed);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue