예제 #1
0
    // Use this for initialization
    void Start()
    {
        //this is unnecessary, add this because I messed up the direction in the beginning
        Vector3 gravity = Physics.gravity;

        gravity.y       = 0;
        gravity.z       = 9.8f;
        Physics.gravity = gravity;

        chesses = new Chess[30];
        inGame  = false;
        inGameCanvas.hideButton();
        message         = "";
        winning_message = "welcome!";
        firstMove       = false;
        extraTurn       = false;
        multiplayer     = false;

        ai_enemy.SetActive(false);
    }
예제 #2
0
    ///
    /// SETTING UP OR ENDING GAME BELOW
    ///

    //for starting or restarting the game
    public void setupGame(bool multi)
    {
        for (int i = 0; i < chesses.Length; i++)
        {
            chesses[i] = null;
        }
        //reset all the rotations for the chess
        for (int i = 0; i < rabbits.Length; i++)
        {
            resetChess(rabbits[i]);
        }
        for (int i = 0; i < penguins.Length; i++)
        {
            resetChess(penguins[i]);
        }
        //for setting all chesses into the gameboard
        for (int i = 0; i < rabbits.Length * 2; i += 2)
        {
            moveToBlock(penguins[i / 2], i);
        }
        for (int i = 1; i < penguins.Length * 2; i += 2)
        {
            moveToBlock(rabbits[i / 2], i);
        }

        inGame      = true;
        turn        = "rabbit";
        canDice     = true;
        diceValue   = 0;
        message     = "Game Start";
        forward     = true;
        firstMove   = true;
        multiplayer = multi;
        ai_enemy.SetActive(!multi);

        winRabbit  = 0;
        winPenguin = 0;

        inGameCanvas.showButton();
        menuCanvas.hideButton();
    }