void Fader_Edge(ZigFader f) { if (f != waveFader) { return; } // prune while (timestampBuffer.Count > 0 && (Time.time - timestampBuffer[0] > 2.0f)) { timestampBuffer.RemoveAt(0); } if (timestampBuffer.Count == 0) { lastEdge = -1; } if (!Mathf.Approximately(lastEdge, f.value)) { timestampBuffer.Add(Time.time); } lastEdge = f.value; if (timestampBuffer.Count >= Waves) { wavePoint = waveFader.GetPosition(0.5f); OnWave(); timestampBuffer.Clear(); } }
// Use this for initialization void Awake() { horizFader = gameObject.AddComponent <ZigFader>(); horizFader.direction = Vector3.right; horizFader.driftAmount = 15; horizFader.Edge += delegate { if (Mathf.Approximately(horizFader.value, 0)) { DoSwipe("Left"); } else { DoSwipe("Right"); } }; vertFader = gameObject.AddComponent <ZigFader>(); vertFader.direction = Vector3.up; vertFader.driftAmount = 10; vertFader.Edge += delegate { if (Mathf.Approximately(horizFader.value, 0)) { DoSwipe("Down"); } else { DoSwipe("Up"); } }; }
// Use this for initialization void Awake () { horizFader = gameObject.AddComponent<ZigFader>(); horizFader.direction = Vector3.right; horizFader.driftAmount = 15; horizFader.Edge += delegate { if (Mathf.Approximately(horizFader.value, 0)) { DoSwipe("Left"); } else { DoSwipe("Right"); } }; vertFader = gameObject.AddComponent<ZigFader>(); vertFader.direction = Vector3.up; vertFader.driftAmount = 10; vertFader.Edge += delegate { if (Mathf.Approximately(horizFader.value, 0)) { DoSwipe("Down"); } else { DoSwipe("Up"); } }; }
void Awake() { timestampBuffer = new List <float>(); waveFader = gameObject.AddComponent <ZigFader>(); waveFader.size = 100; waveFader.driftAmount = 15; }
void Fader_HoverStart(ZigFader fader) { currentItem = fader.hoverItem; output.text = fader.hoverItem.ToString(); origColor = items[fader.hoverItem].GetComponent <Renderer>().material.color; items[fader.hoverItem].GetComponent <Renderer>().material.color = hoverColor; // Debug.Log("HoverStart: " + fader.hoverItem.ToString()); }
void Fader_HoverStart(ZigFader fader) { currentItem = fader.hoverItem; output.text = fader.hoverItem.ToString(); origColor = items[fader.hoverItem].GetComponent<Renderer>().material.color; items[fader.hoverItem].GetComponent<Renderer>().material.color = hoverColor; // Debug.Log("HoverStart: " + fader.hoverItem.ToString()); }
void Fader_Edge(ZigFader f) { if (f != waveFader) return; // prune while (timestampBuffer.Count > 0 && (Time.time - timestampBuffer[0] > 2.0f)) { timestampBuffer.RemoveAt(0); } if (timestampBuffer.Count == 0) { lastEdge = -1; } if (!Mathf.Approximately(lastEdge, f.value)) { timestampBuffer.Add(Time.time); } lastEdge = f.value; if (timestampBuffer.Count >= Waves) { wavePoint = waveFader.GetPosition(0.5f); OnWave(); timestampBuffer.Clear(); } }
void Start() { pushFader = gameObject.AddComponent <ZigFader>(); pushFader.direction = -Vector3.forward; }
void Fader_ValueChange(ZigFader fader) { nub.localPosition = Vector3.Lerp(point0, point1, fader.value); }
void Fader_HoverStop(ZigFader fader) { items[fader.hoverItem].GetComponent <Renderer>().material.color = origColor; // Debug.Log("HoverStop: " + fader.hoverItem.ToString()); }
void Fader_HoverStop(ZigFader fader) { items[fader.hoverItem].GetComponent<Renderer>().material.color = origColor; // Debug.Log("HoverStop: " + fader.hoverItem.ToString()); }
void Awake() { timestampBuffer = new List<float>(); waveFader = gameObject.AddComponent<ZigFader>(); waveFader.size = 100; waveFader.driftAmount = 15; }
void Start() { pushFader = gameObject.AddComponent<ZigFader>(); pushFader.direction = -Vector3.forward; }