unity 2d moving the player according to a dice roll

I am new to Unity and I am trying to do a 2d board game. In the game there is a dice and when It is player’s turn he will click on the dice and dice will chose a random number between 1-7. The player will move according to dice. I am using these scripts;

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Dice : MonoBehaviour
{
    Rigidbody rb;

    bool hasLanded;
    bool thrown;

    Vector3 initPosition;

    public int diceValue;

    public DiceSide[] diceSides;

    public bool IsDoneRolling;
    // Assign game object through editor
    public GameObject gameControllerGameObject;
    private GameController gameController;


    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody>();
        initPosition = transform.position;
        rb.useGravity = false;
    }
    void Awake()
    {
        gameController = gameControllerGameObject.GetComponent<GameController>();
    }

    // Update is called once per frame
    void Update()
    {
        if (rb.IsSleeping() && !hasLanded && thrown)
        {
            hasLanded = true;
            rb.useGravity = false;
            rb.isKinematic = true;

            SideValueCheck();

            gameControl.MovePlayer(diceValue);

        }
        else if (rb.IsSleeping() && hasLanded && diceValue == 0)
        {
            RollAgain();
        }
    }

    public void RollDice()
    {
        if (!thrown && !hasLanded)
        {
            IsDoneRolling = false;
            thrown = true;
            rb.useGravity = true;
            rb.AddTorque(Random.Range(0, 250), Random.Range(0, 250), Random.Range(0, 250));
        }
        else if (thrown && hasLanded)
        {
            Reset();
        }
    }

    void Reset()
    {
        transform.position = initPosition;
        thrown = false;
        hasLanded = false;
        rb.useGravity = false;
        rb.isKinematic = false;
        IsDoneRolling = true;
    }

    void RollAgain()
    {
        Reset();
        IsDoneRolling = false;
        thrown = true;
        rb.useGravity = true;
        rb.AddTorque(Random.Range(0, 250), Random.Range(0, 250), Random.Range(0, 250));
    }

    void SideValueCheck()
    {
        diceValue = 0;
        foreach (DiceSide side in diceSides)
        {
            if (side.OnGround())
            {
                diceValue = side.sideValue;
                Debug.Log(diceValue + " has been rolled!");
            }
        }
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerPiece : MonoBehaviour
{
    public Route currentRoute;

    int routePosition;

    // Remove unnecessary variables
    public bool isMoving;

    // Update is called once per frame
    void Update()
    {

    }
    // Make this public so we can call it from GameControl
    // Add number of steps to move as parameter
    public IEnumerator Move(int steps)
    {
        if (isMoving)
        {
            yield break;
        }
        isMoving = true;

        while (steps > 0)
        {
            Debug.Log("Route position: " + routePosition);

            routePosition++;
            routePosition %= currentRoute.childNodeList.Count;

            Vector3 nextPos = currentRoute.childNodeList[routePosition].position;
            while (MoveToNextNode(nextPos)) { yield return null; }

            yield return new WaitForSeconds(0.1f);
            steps--;
        }

        isMoving = false;
    }

    bool MoveToNextNode(Vector3 goal)
    {
        return goal != (transform.position = Vector3.MoveTowards(transform.position, goal, 8f * Time.deltaTime));

    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameControl : MonoBehaviour
{
    // Be careful about using static variables when they're not necessary
    private GameObject player1, player2;
    // Add references to the player piece scripts
    private PlayerPiece player1Piece;
    private PlayerPiece player2Piece;

    private whosTurn;

    // Start is called before the first frame update
    void Awake()
    {
        player1 = GameObject.Find("Player1-Piece");
        player2 = GameObject.Find("Player2-Piece");

        // Set the reference to the script so you don't have to call GetComponent() each time
        player1Piece = player1.GetComponent<PlayerPiece>();
        player2Piece = player2.GetComponent<PlayerPiece>();
    }

    // Update is called once per frame
    void Update()
    {
        // Clean this out and we'll handle movement directly in the PlayerMove
    }
    // Change variable to handle steps to move
    public void MovePlayer(int steps)
    {
        switch (whosTurn)
        {
            case 1:
                StartCoroutine(player1Piece.Move(steps));
                break;

            case 2:
                StartCoroutine(player2Piece.Move(steps));
                break;
        }

        whosTurn *= -1;
    }
}

When I came back to Unity It says there is an error on GameControl.cs (the 3rd one) 13th line. Also the scripts Named Dice.cs , FollowThePath.cs , GameObject.cs respectively

I tried to move a pawn according to a dice. I was expecting when I click on dice it will give a random number and the pawn will move according to number. But all of them didnt happen. I just get some errors

New contributor

Hee jj is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật