Пример #1
0
 void ResetVars()
 {
     gridWinner = 0;
     sWinIcon.transform.localScale = new Vector3(1.8f, 1.8f, 1.0f);
     winMethod   = WINMETHOD.NIL;
     gridsPlaced = 0;
 }
Пример #2
0
    void ResetVars()
    {
        depth     = 22.0f;
        isTouched = false;
        winMethod = WINMETHOD.NIL;

        // Check if connected
        if (NetworkManager.IsConnected())
        {
            gameMode = Defines.GAMEMODE.ONLINE;
            // same as GameObject.FindGameObjectWithTag("GlobalScript").GetComponent<GlobalScript>().gameMode == 2
        }
        else
        {
            if (GlobalScript.Instance.gameMode == 0)
            {
                gameMode = Defines.GAMEMODE.AI;
            }
            else if (GlobalScript.Instance.gameMode == 1)
            {
                gameMode = Defines.GAMEMODE.LOCAL;
            }
        }

        GameData.current.matchPlayed += 1;
        SaveLoad.Save();

        activeBigGrid = 10;
        UpdateActiveGridBG(0, true);

        gameWinner  = -1;
        jerkTimerP1 = Random.Range(35.0f, 80.0f);
        jerkTimerP2 = Random.Range(35.0f, 80.0f);

        currHighlighted_BigGrid             = 10;
        currHighlighted_Grid                = 10;
        showWinScreen                       = false;
        GlobalScript.Instance.isInputPaused = false;
        bigGridsCompleted                   = 0;
    }
Пример #3
0
    public bool IsGridCompleted(Defines.TURN _turn)
    {
        if (grids[0].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[1].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[2].GetComponent <GridScript>().gridState == (int)_turn)
        {
            //Debug.Log("TUrn: " + _turn);
            pos1      = 0;
            pos2      = 1;
            pos3      = 2;
            winMethod = WINMETHOD.H_TOP;
            return(true);
        }

        if (grids[3].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[4].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[5].GetComponent <GridScript>().gridState == (int)_turn)
        {
            pos1      = 3;
            pos2      = 4;
            pos3      = 5;
            winMethod = WINMETHOD.H_MID;
            return(true);
        }

        if (grids[6].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[7].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[8].GetComponent <GridScript>().gridState == (int)_turn)
        {
            pos1      = 6;
            pos2      = 7;
            pos3      = 8;
            winMethod = WINMETHOD.H_BOT;
            return(true);
        }

        if (grids[0].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[3].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[6].GetComponent <GridScript>().gridState == (int)_turn)
        {
            pos1      = 0;
            pos2      = 3;
            pos3      = 6;
            winMethod = WINMETHOD.V_LEFT;
            return(true);
        }

        if (grids[1].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[4].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[7].GetComponent <GridScript>().gridState == (int)_turn)
        {
            pos1      = 1;
            pos2      = 4;
            pos3      = 7;
            winMethod = WINMETHOD.V_MID;

            return(true);
        }

        if (grids[2].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[5].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[8].GetComponent <GridScript>().gridState == (int)_turn)
        {
            pos1      = 2;
            pos2      = 5;
            pos3      = 8;
            winMethod = WINMETHOD.V_RIGHT;
            return(true);
        }

        if (grids[0].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[4].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[8].GetComponent <GridScript>().gridState == (int)_turn)
        {
            pos1      = 0;
            pos2      = 4;
            pos3      = 8;
            winMethod = WINMETHOD.BACKSLASH;
            return(true);
        }

        if (grids[2].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[4].GetComponent <GridScript>().gridState == (int)_turn &&
            grids[6].GetComponent <GridScript>().gridState == (int)_turn)
        {
            pos1      = 2;
            pos2      = 4;
            pos3      = 6;
            winMethod = WINMETHOD.SLASH;
            return(true);
        }
        return(false);
    }
Пример #4
0
    bool IsBigGridCompleted()
    {
        int turn = (int)GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn;


        if (bigGrids[0].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[1].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[2].GetComponent <BigGridScript>().gridWinner == turn)
        {
            winMethod = WINMETHOD.H_TOP;
            pos1      = 0;
            pos2      = 1;
            pos3      = 2;
        }
        else if (bigGrids[3].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[4].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[5].GetComponent <BigGridScript>().gridWinner == turn)
        {
            winMethod = WINMETHOD.H_MID;
            pos1      = 3;
            pos2      = 4;
            pos3      = 5;
        }
        else if (bigGrids[6].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[7].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[8].GetComponent <BigGridScript>().gridWinner == turn)
        {
            winMethod = WINMETHOD.H_BOT;
            pos1      = 6;
            pos2      = 7;
            pos3      = 8;
        }
        else if (bigGrids[0].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[3].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[6].GetComponent <BigGridScript>().gridWinner == turn)
        {
            winMethod = WINMETHOD.V_LEFT;
            pos1      = 0;
            pos2      = 3;
            pos3      = 6;
        }
        else if (bigGrids[1].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[4].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[7].GetComponent <BigGridScript>().gridWinner == turn)
        {
            winMethod = WINMETHOD.V_MID;
            pos1      = 1;
            pos2      = 4;
            pos3      = 7;
        }
        else if (bigGrids[2].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[5].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[8].GetComponent <BigGridScript>().gridWinner == turn)
        {
            winMethod = WINMETHOD.V_RIGHT;
            pos1      = 2;
            pos2      = 5;
            pos3      = 8;
        }
        else if (bigGrids[0].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[4].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[8].GetComponent <BigGridScript>().gridWinner == turn)
        {
            winMethod = WINMETHOD.BACKSLASH;
            pos1      = 0;
            pos2      = 4;
            pos3      = 8;
        }
        else if (bigGrids[2].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[4].GetComponent <BigGridScript>().gridWinner == turn && bigGrids[6].GetComponent <BigGridScript>().gridWinner == turn)
        {
            winMethod = WINMETHOD.SLASH;
            pos1      = 2;
            pos2      = 4;
            pos3      = 6;
        }

        if (winMethod == WINMETHOD.NIL)
        {
            return(false);
        }
        return(true);
    }