void SetMaterial() { var ris = new ClickRippleInfo[maxRipples]; if (rippleInfos.Count > maxRipples) { Debug.LogWarning($"number of ripples exceeds max, please reduce ripple duration or increase max ripple count"); } // Debug.Log($"setting {rippleInfos.Count} ripples"); for (int i = 0; i < maxRipples; i++) { if (i < rippleInfos.Count) { ris[i] = rippleInfos[i]; } else { ris[i] = new ClickRippleInfo(); ris[i].timeStamp = -10000; } } // foreach (var ri in ris) // { // Debug.Log(ri.timeStamp); // } rippleObjects.SetData(ris); // clickRippleMat.SetBuffer("rippleObjects", rippleObjects); }
public void AddRipple(Vector3 position) { var ri = new ClickRippleInfo(); ri.timeStamp = Time.time; ri.position = position; rippleInfos.Add(ri); FilterRippleInfos(); SetMaterial(); }