Пример #1
0
 public static void AddFadeAnim(GameObject obj, string s, float dur)
 {
     if (obj.name.Contains("Particles"))
     {
         return;
     }
     obj.GetComponent <Animator>().SetTrigger(s);
     AnimCollection.AddAnim(dur);
 }
Пример #2
0
    private void Drag(int deltaDirection)
    {
        if (Panels.IsOpen == 1)
        {
            return;
        }

        if (MapData.GameJudge != 0)
        {
            return;
        }

        MapData.MoveBlocks(deltaDirection);
        AnimCollection.AddAnim(0.45f, true);
    }
Пример #3
0
    public void MapReset()
    {
        if (MapData.GameJudge == 1)
        {
            return;
        }
        if (AnimCollection.IsAnim())
        {
            return;
        }
        if (IsInvoking("MapReset"))
        {
            CancelInvoke("MapReset");
        }

        Functions.Reset();
    }
Пример #4
0
    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);
        }
    }
Пример #5
0
 public static void AddFlyThroughAnim(GameObject obj, string s, float dur)
 {
     obj.GetComponent <Animator>().SetTrigger(s);
     AnimCollection.AddAnim(dur);
 }
Пример #6
0
    // 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;
        }
    }