Esempio n. 1
0
    IEnumerator DragUnit(GameObject unit)
    {
        hovering = true;
        yield return(new WaitWhile(() => !Input.GetMouseButton(0) && hovering));

        if (!hovering)
        {
            yield break;
        }

        dragBlock = true;
        while (Input.GetMouseButton(0))
        {
            unit.transform.position = (Vector2)transform.position + col.offset;
            yield return(new WaitForEndOfFrame());

            characterMenu.UpdateSelection(unit);
        }
        characterMenu.AddUnit(unit);
        dragBlock = false;
        yield break;
    }