Example #1
0
    IEnumerator _Move(Transform from, Transform to, int col, int n, int btn, int[,] lt)
    {
        //yield return new WaitWhile(() => neww);
        neww = false;
        Vector2 original = from.position;

        from.gameObject.SetActive(true);
        Image hint_background = hint.GetComponent <Image>();
        Image child           = hint.transform.GetChild(0).GetComponent <Image>();

        child.sprite = s1[n];
        child.transform.localScale = scale_for_move(n);
        hint_background.color      = ColorIndeed(lt[btn, 1]);
        Color color    = hint_background.color;
        float timer    = 0.0f;
        float overTime = ColorIndeed(col).a;
        float y        = 1;

        if (overTime < 1)
        {
            y = 2.22f;
        }
        while (timer < overTime)
        {
            float step = Vector2.Distance(original, to.position) * (Time.deltaTime);
            from.position         = Vector2.MoveTowards(from.position, to.position, step);
            color.a               = timer;
            hint_background.color = color;
            child.color           = new Color(child.color.r, child.color.g, child.color.b, timer * y);
            timer += Time.deltaTime / y;
            yield return(null);
        }
        action_chose(n);
        InputField.button_list[btn].image.color = ColorIndeed(lt[btn, 1]);
        from.gameObject.SetActive(false);
        color.a = 0;
        hint_background.color   = color;
        child.color             = new Color(child.color.r, child.color.g, child.color.b, 0);
        from.transform.position = original;
        Inputbuttons.move_btn   = true;
        if (btn + 1 < Btnplay.func[fun].input_arr.Count)
        {
            if (btn == 0)
            {
                input.secondbutton();
            }
            else if (btn == 1)
            {
                input.threebutton();
            }
            else if (btn == 2)
            {
                input.fourbutton();
            }
            else if (btn == 3)
            {
                input.fivebutton();
            }
            else if (btn == 4)
            {
                input.sixbutton();
            }
            else if (btn == 5)
            {
                input.sevenbutton();
            }
            else if (btn == 6)
            {
                input.eightbutton();
            }
        }
        neww = true;
    }