Exemplo n.º 1
0
    private IEnumerator OnMoving(NumCell movingCell, Vector3 startPos, int targetCol, int targetRow, float movingTime)
    {
        Vector3 currPos = startPos;
        Vector3 goalPos = PointToVector3(targetCol, targetRow);

        for (float t = 0.0f; t <= movingTime; t += Time.deltaTime)
        {
            currPos = Vector3.Lerp(startPos, goalPos, t / movingTime);
            movingCell.transform.localPosition = currPos;
            yield return(null);  //왜 여기에?????  //렍더기다리는???
        }

        movingCell.GetComponent <RectTransform>().localPosition = goalPos;
    }
Exemplo n.º 2
0
    private bool SetMovingPointofCell(bool checkMove, NumCell cell, int col, int row)
    {
        int     currCol    = cell.c;
        int     currRow    = cell.r;
        Vector3 currPos    = cell.GetComponent <RectTransform>().localPosition;
        float   movingTime = cellMovingTime;

        if (currCol == col && currRow == row)
        {
            checkMove = false;
            return(checkMove);
        }

        cell.c = col;
        cell.r = row;
        StartCoroutine(OnMoving(cell, currPos, col, row, movingTime));

        checkMove = true;
        return(checkMove);
    }