示例#1
0
    // Player 1 to Player 2 only
    public void ChangeTurn(Defines.TURN prev, Defines.TURN current)
    {
        if (!NetworkManager.IsPlayerOne())
        {
            return;
        }

        photonView.RPC("ChangeTurn_RPC", PhotonTargets.Others, prev, current);
    }
示例#2
0
    public void BtnYes()
    {
        if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().pausedState == 1)
        {
            if (NetworkManager.IsConnected())
            {
                NetworkManager.DebugLog("Cannot restart!\n");
            }
            else
            {
                GameObject.FindGameObjectWithTag("GUIManager").GetComponent <GUIManagerScript>().UpdateAnalyticsGameEnd();
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.CLICK);
                }
                BGManager.Instance.partsParent.SetActive(false);
                BackToMainMenu(2, false);
                Adverts.Instance.RandomShowAd();
            }
        }
        else if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().pausedState == 2)
        {
            GameObject.FindGameObjectWithTag("GUIManager").GetComponent <GUIManagerScript>().UpdateAnalyticsGameEnd();
            BGManager.Instance.partsParent.SetActive(false);

            GameObject [] allGUI = GameObject.FindGameObjectsWithTag("GUIManager");
            foreach (GameObject curr in allGUI)
            {
                Destroy(curr);
            }

            if (NetworkManager.IsConnected())
            {
                Defines.TURN turn = GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn;
                Debug.Log("ttt: : " + turn);
                if (turn == Defines.TURN.P1 || turn == Defines.TURN.P2 || turn == Defines.TURN.NOTSTARTED)
                {
                    NetworkManager.Disconnect();
                }
                else
                {
                    NetworkGameLogic networkLogic = NetworkGameLogic.GetNetworkGameLogic();
                    networkLogic.AfterActionDecision(NetworkGameLogic.GetPlayerNumber(), NetworkGameLogic.AFTERMATH_ACTION.QUIT);
                    GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn = Defines.TURN.DISCONNECTED;
                    NetworkManager.Disconnect();
                }
            }

            if (AudioManager.Instance)
            {
                AudioManager.Instance.PlaySoundEvent(SOUNDID.CLICK);
            }
            BGManager.Instance.partsParent.SetActive(false);
            BackToMainMenu(1, false);
            Adverts.Instance.RandomShowAd();
        }
    }
示例#3
0
    public void ChangeTurn_RPC(Defines.TURN prev, Defines.TURN current)
    {
        // Ignore
        if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn != prev)
        {
            return;
        }

        GameObject.FindGameObjectWithTag("GUIManager").GetComponent <GUIManagerScript>().ChangeTurn();
    }
示例#4
0
    void ConfirmPlacement_RPC(int bigID, int smallID, Defines.TURN turn, float time)
    {
        BoardScript      board     = GameObject.Find("Board").GetComponent <BoardScript>();
        BigGridScript    bigGrid   = board.bigGrids[bigID].GetComponent <BigGridScript>();
        GridScript       smallGrid = bigGrid.grids[smallID].GetComponent <GridScript>();
        GUIManagerScript guiScript = GameObject.FindGameObjectsWithTag("GUIManager")[0].GetComponent <GUIManagerScript>();

        smallGrid.ConfirmPlacement();
        guiScript.SetTimer(turn, time);
    }
示例#5
0
    public void ProcessBigGridCompleted(Defines.TURN _turn)
    {
        if (IsGridCompleted(_turn))
        {
            //begin to do the shakings
            begin = true;
            grids[pos1].GetComponent <Shaker>().StartShaking();
            //grids[pos2].GetComponent<Shaker>().StartShaking();
            //grids[pos3].GetComponent<Shaker>().StartShaking();
            // Win!
            gridWinner = (int)_turn;
            GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().ProcessBoardCompleted();

            /*GetComponent<LineRenderer>().SetPosition(0,grids[pos1].transform.position+new Vector3(0,0,1));
            *  GetComponent<LineRenderer>().SetPosition(1,grids[pos3].transform.position+new Vector3(0,0,1));*/
            if (winMethod == WINMETHOD.H_TOP)
            {
                transform.Find("H1").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.H_MID)
            {
                transform.Find("H2").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.H_BOT)
            {
                transform.Find("H3").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.V_LEFT)
            {
                transform.Find("V1").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.V_MID)
            {
                transform.Find("V2").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.V_RIGHT)
            {
                transform.Find("V3").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.BACKSLASH)
            {
                transform.Find("LeftSlash").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.SLASH)
            {
                transform.Find("RightSlash").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
        }

        /*else if(IsDraw())
         * {
         *      gridWinner = 3;
         *      sIconTexture.GetComponent<SpriteRenderer>().sprite = sBigDraw;
         * }*/
    }
示例#6
0
 public void ChangeTurn()
 {
     if (turn == Defines.TURN.P1)
     {
         turn = Defines.TURN.P2;
     }
     else if (turn == Defines.TURN.P2)
     {
         turn = Defines.TURN.P1;
     }
 }
示例#7
0
 public void SetTimer(Defines.TURN turn, float time)
 {
     if (turn == Defines.TURN.P1)
     {
         timerP1 = time;
     }
     else if (turn == Defines.TURN.P2)
     {
         timerP2 = time;
     }
 }
示例#8
0
 // Update is called once per frame
 void Update()
 {
     if (turn == Defines.TURN.NOTSTARTED)
     {
         if (GameStartAnim.Instance.GameStartAnimEnded() &&
             GameObject.FindGameObjectWithTag("GUIManager").GetComponent <GUIManagerScript>().IsNetworkReady())
         {
             turn = Defines.TURN.P1;
         }
     }
 }
示例#9
0
    void ResetVars()
    {
        highlighted    = false;
        depth          = 9;
        currentBigGrid = 10;
        EmptyCell      = 0;

        AIStage    = 0;
        diff       = Difficulty.Hard;
        AITurn     = Defines.TURN.P2;           // TEMPORARY. MUST CHANGE!!
        PlayerTurn = Defines.TURN.P1;

        fakeTimesCurr = 0;
    }
示例#10
0
    public void ChangeTurn()
    {
        if (turn == Defines.TURN.P1)
        {
            turn = Defines.TURN.P2;
        }
        else if (turn == Defines.TURN.P2)
        {
            turn = Defines.TURN.P1;
        }

        if (AudioManager.Instance)
        {
            AudioManager.Instance.PlaySoundEvent(SOUNDID.CHANGETURN);
        }
    }
示例#11
0
 // Update is called once per frame
 void Update()
 {
     if (turn == Defines.TURN.NOTSTARTED)
     {
         countdownToStart -= Time.deltaTime;
         if (countdownToStart < 0.5f)
         {
             Color temp = GameObject.FindGameObjectWithTag("GUIManager").GetComponent <GUIManagerScript>().GUICenterText.GetComponent <Text>().color;
             temp.a -= 0.1f;
             GameObject.FindGameObjectWithTag("GUIManager").GetComponent <GUIManagerScript>().GUICenterText.GetComponent <Text>().color = temp;
         }
         if (countdownToStart <= 0.0f)
         {
             turn = Defines.TURN.P1;
         }
     }
 }
示例#12
0
    void ConfirmPlacement_RPC(int bigID, int smallID, Defines.TURN turn, float time)
    {
        // If not correct turn
        if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn != turn)
        {
            return;
        }

        BoardScript      board     = GameObject.Find("Board").GetComponent <BoardScript>();
        BigGridScript    bigGrid   = board.bigGrids[bigID].GetComponent <BigGridScript>();
        GridScript       smallGrid = bigGrid.grids[smallID].GetComponent <GridScript>();
        GUIManagerScript guiScript = GameObject.FindGameObjectWithTag("GUIManager").GetComponent <GUIManagerScript>();

        smallGrid.ConfirmPlacement();
        //guiScript.SetTimer(turn, time);
        guiScript.ResetTimer();

        // Confirms p2 action and ask p2 to execute it.
        if (NetworkManager.IsPlayerOne() && turn == Defines.TURN.P2)
        {
            GetNetworkGameLogic().ConfirmPlacement(bigID, smallID, turn, time);
        }
    }
示例#13
0
    void UpdateTurnGUI()
    {
        // Whose Turn
        if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn == Defines.TURN.P1)
        {
            if (!TutorialScript.Instance.isTutorial && !isPaused)
            {
                timerP1 -= Time.deltaTime;
            }

            if (timerP1 < 6.0f && !isCDSoundPlayed6)
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.COUNTDOWN);
                }
                isCDSoundPlayed6 = true;
            }
            if (timerP1 < 5.0f && !isCDSoundPlayed5)
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.COUNTDOWN);
                }
                isCDSoundPlayed5 = true;
            }
            else if (timerP1 < 4.0f && !isCDSoundPlayed4)
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.COUNTDOWN);
                }
                isCDSoundPlayed4 = true;
            }
            else if (timerP1 < 3.0f && !isCDSoundPlayed3)
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.COUNTDOWN);
                }
                isCDSoundPlayed3 = true;
            }
            else if (timerP1 < 2.0f && !isCDSoundPlayed2)
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.COUNTDOWN);
                }
                isCDSoundPlayed2 = true;
            }
            else if (timerP1 < 1.0f && !isCDSoundPlayed1)
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.COUNTDOWN);
                }
                isCDSoundPlayed1 = true;
            }

            if (timerP1 <= 0.0f)
            {
                if (GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().gameMode != Defines.GAMEMODE.ONLINE)
                {
                    ChangeTurn();
                }
                else if (GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().gameMode == Defines.GAMEMODE.ONLINE && NetworkManager.IsPlayerOne())
                {
                    ChangeTurn();
                    Defines.TURN current = GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn;
                    NetworkGameLogic.GetNetworkGameLogic().ChangeTurn(Defines.TURN.P1, current);
                }
                else if (GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().gameMode == Defines.GAMEMODE.ONLINE && !NetworkManager.IsPlayerOne())
                {
                    timerP1 = 0.0f;
                }
                GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().ResetAllHighlights();
            }
            //GameObject.FindGameObjectWithTag("Board").GetComponent<BoardScript>().SetWinner((int)Defines.TURN.P2);

            GUINameP1.GetComponent <Text>().color = Color.green;

            if (timerP1 > 6.0f)
            {
                GUITimerP1.GetComponent <Text>().color = Color.green;
            }
            else
            {
                GUITimerP1.GetComponent <Text>().color = Defines.ICON_COLOR_P2;
            }
            GUINameP2.GetComponent <Text>().color  = Color.grey;
            GUITimerP2.GetComponent <Text>().color = Color.grey;

            GUITurn.GetComponent <Text>().text = GetTurnName();
            //GUITurn.GetComponent<Text>().color = Defines.ICON_COLOR_P1;

            // Icon Frame Animation during the player's turn
            FrameLeft.GetComponent <Animator>().SetBool("isMoving", true);
            FrameRight.GetComponent <Animator>().SetBool("isMoving", false);

            /*if(FrameLeft.transform.localScale.x < currMax)
             * {
             *      FrameLeft.transform.localScale = new Vector3(FrameLeft.transform.localScale.x + (frameScaleSpeed * Time.deltaTime),
             *                                                      FrameLeft.transform.localScale.y + (frameScaleSpeed * Time.deltaTime),
             *                                                      FrameLeft.transform.localScale.z);
             *
             *      ImageLeft.transform.localScale = new Vector3(ImageLeft.transform.localScale.x + (frameScaleSpeed * Time.deltaTime),
             *                                                      ImageLeft.transform.localScale.y + (frameScaleSpeed * Time.deltaTime),
             *                                                      ImageLeft.transform.localScale.z);
             * }
             *
             * if(FrameRight.transform.localScale.y > currMin)
             * {
             *      FrameRight.transform.localScale = new Vector3(FrameRight.transform.localScale.x + (frameScaleSpeed * Time.deltaTime),
             *                                                      FrameRight.transform.localScale.y - (frameScaleSpeed * Time.deltaTime),
             *                                                      FrameRight.transform.localScale.z);
             *
             *      ImageRight.transform.localScale = new Vector3(ImageRight.transform.localScale.x + (frameScaleSpeed * Time.deltaTime),
             *                                                      ImageRight.transform.localScale.y - (frameScaleSpeed * Time.deltaTime),
             *                                                      ImageRight.transform.localScale.z);
             * }*/
        }
        else if (GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn == Defines.TURN.P2)
        {
            if (!TutorialScript.Instance.isTutorial && !isPaused)
            {
                timerP2 -= Time.deltaTime;
            }

            if (timerP2 < 6.0f && !isCDSoundPlayed6)
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.COUNTDOWN);
                }
                isCDSoundPlayed6 = true;
            }
            if (timerP2 < 5.0f && !isCDSoundPlayed5)
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.COUNTDOWN);
                }
                isCDSoundPlayed5 = true;
            }
            else if (timerP2 < 4.0f && !isCDSoundPlayed4)
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.COUNTDOWN);
                }
                isCDSoundPlayed4 = true;
            }
            else if (timerP2 < 3.0f && !isCDSoundPlayed3)
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.COUNTDOWN);
                }
                isCDSoundPlayed3 = true;
            }
            else if (timerP2 < 2.0f && !isCDSoundPlayed2)
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.COUNTDOWN);
                }
                isCDSoundPlayed2 = true;
            }
            else if (timerP2 < 1.0f && !isCDSoundPlayed1)
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.COUNTDOWN);
                }
                isCDSoundPlayed1 = true;
            }

            if (timerP2 <= 0.0f)
            {
                if (GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().gameMode != Defines.GAMEMODE.ONLINE)
                {
                    ChangeTurn();
                }
                else if (GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().gameMode == Defines.GAMEMODE.ONLINE && NetworkManager.IsPlayerOne())
                {
                    ChangeTurn();
                    Defines.TURN current = GameObject.FindGameObjectWithTag("GUIManager").GetComponent <TurnHandler>().turn;
                    NetworkGameLogic.GetNetworkGameLogic().ChangeTurn(Defines.TURN.P2, current);
                }
                else if (GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().gameMode == Defines.GAMEMODE.ONLINE && !NetworkManager.IsPlayerOne())
                {
                    timerP2 = 0.0f;
                }
                GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().ResetAllHighlights();
            }
            //GameObject.FindGameObjectWithTag("Board").GetComponent<BoardScript>().SetWinner((int)Defines.TURN.P2);

            GUINameP1.GetComponent <Text>().color  = Color.grey;
            GUITimerP1.GetComponent <Text>().color = Color.grey;
            GUINameP2.GetComponent <Text>().color  = Color.green;
            if (timerP2 > 6.0f)
            {
                GUITimerP2.GetComponent <Text>().color = Color.green;
            }
            else
            {
                GUITimerP2.GetComponent <Text>().color = Defines.ICON_COLOR_P2;
            }

            GUITurn.GetComponent <Text>().text = GetTurnName();
            //GUITurn.GetComponent<Text>().color = Defines.ICON_COLOR_P2;

            // Icon Frame Animation during the player's turn
            FrameLeft.GetComponent <Animator>().SetBool("isMoving", false);
            FrameRight.GetComponent <Animator>().SetBool("isMoving", true);

            /*if(FrameLeft.transform.localScale.y > currMin)
             * {
             *      FrameLeft.transform.localScale = new Vector3(FrameLeft.transform.localScale.x - (frameScaleSpeed * Time.deltaTime),
             *                                                      FrameLeft.transform.localScale.y - (frameScaleSpeed * Time.deltaTime),
             *                                                      FrameLeft.transform.localScale.z);
             *
             *      ImageLeft.transform.localScale = new Vector3(ImageLeft.transform.localScale.x - (frameScaleSpeed * Time.deltaTime),
             *                                                      ImageLeft.transform.localScale.y - (frameScaleSpeed * Time.deltaTime),
             *                                                      ImageLeft.transform.localScale.z);
             * }
             *
             * if(FrameRight.transform.localScale.y < currMax)
             * {
             *      FrameRight.transform.localScale = new Vector3(FrameRight.transform.localScale.x - (frameScaleSpeed * Time.deltaTime),
             *                                                      FrameRight.transform.localScale.y + (frameScaleSpeed * Time.deltaTime),
             *                                                      FrameRight.transform.localScale.z);
             *
             *      ImageRight.transform.localScale = new Vector3(ImageRight.transform.localScale.x - (frameScaleSpeed * Time.deltaTime),
             *                                                      ImageRight.transform.localScale.y + (frameScaleSpeed * Time.deltaTime),
             *                                                      ImageRight.transform.localScale.z);
             * }*/
        }
        else
        {
            GUITurn.GetComponent <Text>().text = "";
        }
    }
示例#14
0
    public void ProcessBigGridCompleted(Defines.TURN _turn)
    {
        if (IsGridCompleted(_turn))
        {
            if (GameData.current.hasVibrate && VibrationManager.HasVibrator())
            {
                VibrationManager.Vibrate(Defines.V_WINBIGGRID);
            }

            GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().bigGridsCompleted++;

            if (!(TutorialScript.Instance.isTutorial && bigGridID == 7) && !(GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().IsBigGridCompleted()))
            {
                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.WIN_BIGGRID);
                }
            }

            //add the points
            if (CanGetScore())
            {
                int _score = Defines.smallGridWin;
                if (GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().gameMode == Defines.GAMEMODE.LOCAL)
                {
                    _score = Defines.smallGridWin_Local;
                }
                else if (GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().gameMode == Defines.GAMEMODE.AI)
                {
                    _score = Defines.smallGridWin_AI;
                }

                Defines.Instance.playerScore += _score;
                GameObject tmp;

                tmp    = (GameObject)Instantiate(scrollingText);             //.gameObject.GetComponent<FloatingText>().BeginScrolling(" + " + _score + "!");
                canvas = transform.parent.parent.gameObject.GetComponent <BoardScript>().canvas;
                tmp.transform.SetParent(canvas.transform);
                tmp.transform.localScale       = new Vector3(1, 1, 1);
                tmp.transform.localPosition    = new Vector3(0, 0, 0);
                tmp.GetComponent <Text>().text = "+ " + _score + "!";

                if (AudioManager.Instance)
                {
                    AudioManager.Instance.PlaySoundEvent(SOUNDID.GETPOINTS);
                }
            }

            //begin to do the shakings
            begin = true;
            grids[pos1].GetComponent <Shaker>().StartShaking();
            //grids[pos2].GetComponent<Shaker>().StartShaking();
            //grids[pos3].GetComponent<Shaker>().StartShaking();
            // Win!

            gridWinner = (int)_turn;

            /*GetComponent<LineRenderer>().SetPosition(0,grids[pos1].transform.position+new Vector3(0,0,1));
            *  GetComponent<LineRenderer>().SetPosition(1,grids[pos3].transform.position+new Vector3(0,0,1));*/
            if (winMethod == WINMETHOD.H_TOP)
            {
                transform.Find("H1").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.H_MID)
            {
                transform.Find("H2").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.H_BOT)
            {
                transform.Find("H3").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.V_LEFT)
            {
                transform.Find("V1").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.V_MID)
            {
                transform.Find("V2").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.V_RIGHT)
            {
                transform.Find("V3").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.BACKSLASH)
            {
                transform.Find("LeftSlash").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
            else if (winMethod == WINMETHOD.SLASH)
            {
                transform.Find("RightSlash").GetComponent <WinLine>().startLine(grids[pos1].GetComponent <Shaker>().duration *3);
            }
        }
        else if (IsDraw())
        {
            if (GameData.current.hasVibrate && VibrationManager.HasVibrator())
            {
                VibrationManager.Vibrate(Defines.V_WINBIGGRID);
            }

            gridWinner = 3;
            sWinFrame.SetActive(true);
            sWinFrame.GetComponent <SpriteRenderer>().color =
                new Color(Defines.ICON_COLOR_DRAW.r, Defines.ICON_COLOR_DRAW.g, Defines.ICON_COLOR_DRAW.b, 0.5f);
            sWinFrame.GetComponent <Animator>().SetTrigger("isSpin");
            GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().ProcessBoardCompleted();
        }
    }
示例#15
0
 public void ConfirmPlacement(int bigID, int smallID, Defines.TURN turn, float time)
 {
     photonView.RPC("ConfirmPlacement_RPC", PhotonTargets.Others, bigID, smallID, turn, time);
 }
示例#16
0
 void Place(int gridID, Defines.TURN turn)
 {
     GameObject.FindGameObjectWithTag("Board").GetComponent <BoardScript>().bigGrids[currentBigGrid].GetComponent <BigGridScript>().grids[gridID].GetComponent <GridScript>().gridState = (int)turn;
 }
示例#17
0
 public void InformDisconnect()
 {
     turn = Defines.TURN.DISCONNECTED;
 }
示例#18
0
 public void WaitingForOtherPlayer()
 {
     turn = Defines.TURN.WAITING;
 }
示例#19
0
 void ResetVars()
 {
     turn             = Defines.TURN.NOTSTARTED;
     pausedState      = 0;
     countdownToStart = 1.5f;
 }
示例#20
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);
    }