public static void AddFadeAnim(GameObject obj, string s, float dur) { if (obj.name.Contains("Particles")) { return; } obj.GetComponent <Animator>().SetTrigger(s); AnimCollection.AddAnim(dur); }
private void Drag(int deltaDirection) { if (Panels.IsOpen == 1) { return; } if (MapData.GameJudge != 0) { return; } MapData.MoveBlocks(deltaDirection); AnimCollection.AddAnim(0.45f, true); }
public void MapReset() { if (MapData.GameJudge == 1) { return; } if (AnimCollection.IsAnim()) { return; } if (IsInvoking("MapReset")) { CancelInvoke("MapReset"); } Functions.Reset(); }
private void Update() { if (AnimCollection.IsAnim()) { return; } if (MapData.GameJudge == -1 && !IsInvoking("MapReset")) { Invoke("MapReset", 1.5f); } else if (MapData.GameJudge == 1 && !IsInvoking("MapNext")) { Particle.AddParticle(new Vector2(0, 0), 3); Invoke("MapNext", 1.5f); } }
public static void AddFlyThroughAnim(GameObject obj, string s, float dur) { obj.GetComponent <Animator>().SetTrigger(s); AnimCollection.AddAnim(dur); }
// Update is called once per frame void Update() { if (AnimCollection.IsAnim()) { Reset(); return; } if (Input.GetMouseButtonDown(0)) { tap = dragFlag = true; deltaTouchPos = Input.mousePosition; if (deltaTouchPos.y < Center) { Reset(); } } else if (Input.GetMouseButtonUp(0)) { Reset(); } if (Input.touches.Length > 0) { if (Input.touches[0].phase == TouchPhase.Began) { tap = dragFlag = true; deltaTouchPos = Input.touches[0].position; if (deltaTouchPos.y < Center) { Reset(); } } else if (Input.touches[0].phase == TouchPhase.Ended || Input.touches[0].phase == TouchPhase.Canceled) { Reset(); } } swipeDelta = Vector2.zero; if (dragFlag) { if (Input.GetMouseButton(0)) { swipeDelta = (Vector2)Input.mousePosition - deltaTouchPos; } else if (Input.touches.Length > 0) { swipeDelta = Input.touches[0].position - deltaTouchPos; } } if (swipeDelta.magnitude > 125f) { float x = swipeDelta.x, y = swipeDelta.y; _swipeMode = (Mathf.Abs(y) <= Mathf.Abs(x)) ? (1 + 2 * ((x <= 0f) ? 1 : 0)) : (2 * ((y <= 0f) ? 1 : 0)); Drag(_swipeMode); Reset(); } else { swipeMode = -1; } }