Exemple #1
0
    public void FieldWasClicked(Field field)
    {
        if (field.State != Field.StateOfField.EMPTY)
        {
            return;
        }

        field.State = this.currentTurn == turn.firstPlayerTurn ? firstPlayerMarker : secondPlayerMarker;

        gameResoult currentGameReoult = someoneWon();

        if (currentGameReoult != gameResoult.nobodyWon)
        {
            endGame(currentGameReoult);
        }

        if (currentTurn == turn.firstPlayerTurn)
        {
            this.currentTurn = turn.secondPlayerTurn;
            yourMoveObject.SetActive(false);
            ComputerMove();
        }
        else
        {
            this.currentTurn = turn.firstPlayerTurn;
            yourMoveObject.SetActive(true);
        }
    }
Exemple #2
0
        //旋轉
        public xyz[] turnAround()
        {
            reXYZList    = new xyz[pointList.Length];
            reXYZList[0] = pointList[0];
            turn sings = new turn();

            sings.turnX = sing.turnX * (float)3.1416 / 180;
            sings.turnY = sing.turnY * (float)3.1416 / 180;
            sings.turnZ = sing.turnZ * (float)3.1416 / 180;
            for (int i = 1; i < pointList.Length; i++)
            {
                //定義旋轉軸點
                float x = pointList[i].x - pointList[0].x;
                float y = pointList[i].y - pointList[0].y;
                float z = pointList[i].z - pointList[0].z;
                //旋轉Y軸
                float x1 = (float)(x * Math.Cos(sings.turnY) + z * Math.Sin(sings.turnY));
                float y1 = y;
                float z1 = (float)(-x * Math.Sin(sings.turnY) + z * Math.Cos(sings.turnY));
                //旋轉X軸
                float x2 = x1;
                float y2 = (float)(y1 * Math.Cos(sings.turnX) - z1 * Math.Sin(sings.turnX));
                float z2 = (float)(y1 * Math.Sin(sings.turnX) + z1 * Math.Cos(sings.turnX));
                //旋轉Z軸
                float x3 = (float)(x2 * Math.Cos(sings.turnZ) - y2 * Math.Sin(sings.turnZ));
                float y3 = (float)(x2 * Math.Sin(sings.turnZ) + y2 * Math.Cos(sings.turnZ));
                float z3 = z2;
                //點位往回推
                reXYZList[i]   = new xyz();
                reXYZList[i].x = x3 + pointList[0].x;
                reXYZList[i].y = y3 + pointList[0].y;
                reXYZList[i].z = z3 + pointList[0].z;
            }
            return(reXYZList);
        }
    void OnEnable()
    {
        MoveOnScreen ();
        turnState = turn.START;

        RescaleFish ();
    }
Exemple #4
0
    //悔棋
    void Undo()
    {
        //判断当前栈中是否存在以走步数,只有存在已走步数才能悔棋
        if (stackSteps.Count > 0)
        {
            //弹出最后一步,并将其位置重置为没有棋子的状态
            var lastStep = stackSteps.Pop();
            int x        = (int)lastStep.x;
            int y        = (int)lastStep.y;
            chessState[x, y] = 0;
            if (chessTurn == turn.black)
            {
                chessTurn = turn.white;
            }
            else
            {
                chessTurn = turn.black;
            }

            //并重新设置上一步为当前的棋子
            if (stackSteps.Count == 0)
            {
                curCheesPos.x = -1;
                curCheesPos.y = -1;
            }
            else
            {
                var prevStep = stackSteps.Peek();
                curCheesPos.x = prevStep.x;
                curCheesPos.y = prevStep.y;
            }
        }
    }
Exemple #5
0
 void Start()
 {
     chessPos    = new Vector2[15, 15];
     chessState  = new int[15, 15];
     chessTurn   = turn.black;
     curCheesPos = new Vector2(-1, -1);;
 }
    void OnEnable()
    {
        MoveOnScreen();
        turnState = turn.START;

        RescaleFish();
    }
Exemple #7
0
 void Start()
 {
     //生成棋盘,并按照五子棋规则将先手赋予黑棋
     chessPos   = new Vector2[15, 15];
     chessState = new int[15, 15];
     chessTurn  = turn.black;
 }
    //Called when field was clicked
    public void FieldWasClicked(Field field)
    {
        //Checking if state isn't empty
        if (field.State != Field.StateOfField.EMPTY)
        {
            return;
        }
        //Setting up field state based on current player turn
        field.State = this.currentTurn == turn.firstPlayerTurn ? firstPlayerMarker : secondPlayerMarker;
        //Checking if someone won
        gameResoult currentGameReoult = someoneWon();

        //End when somebody won or is dead-heat
        if (currentGameReoult != gameResoult.nobodyWon)
        {
            endGame(currentGameReoult);
        }

        if (currentTurn == turn.firstPlayerTurn)
        {
            this.currentTurn = turn.secondPlayerTurn;
            this.crossCurrentTurnRepresentation.enabled  = false;
            this.circleCurrentTurnRepresentation.enabled = true;
        }
        else
        {
            this.currentTurn = turn.firstPlayerTurn;
            this.crossCurrentTurnRepresentation.enabled  = true;
            this.circleCurrentTurnRepresentation.enabled = false;
        }
    }
Exemple #9
0
    void PlayerUpkeep() //tasks to execute at start of each player's turn
    {
        turnState      = turn.Player1;
        turnText.color = Color.green;
        turnText.text  = "Your turn";

        if (ultimateUsed == true)
        {
            currentUltimate.ultimateData.cooldown = UltimateMaxCooldown;
            ultimateUsed      = false;
            ultimateText.text = "Ultimate charging"; //updates card UI text
            RelicUpdate();
        }
        else
        {
            currentUltimate.ultimateData.cooldown--; //updates cooldown
            if (currentUltimate.ultimateData.cooldown <= 0)
            {
                currentUltimate.ultimateData.cooldown = 0;
                currentUltimate.useButton.SetActive(true); //enables button
                ultimateText.color = Color.green;          //changes font colour
                ultimateText.text  = "Ultimate Ready";     //updates card UI text
            }
        }
        RelicUpdate();
        APReset();
    }
    public Texture2D black;         //黑棋子贴图

    void Start()
    {
        Debug.Log("启动");

        LeftTop     = GameObject.Find("MainCamera/Plane/LeftTop");
        RightTop    = GameObject.Find("MainCamera/Plane/RightTop");
        LeftBottom  = GameObject.Find("MainCamera/Plane/LeftBottom");
        RightBottom = GameObject.Find("MainCamera/Plane/RightBottom");
        cam         = GameObject.Find("MainCamera").GetComponent <Camera>();

        chessPos   = new Vector2[15, 15];           // 记录落子点位置
        chessState = new int[15, 15];               // 记录下子信息
        chessTurn  = turn.black;                    // 黑棋先手

        //计算锚点位置
        LTPos = cam.WorldToScreenPoint(LeftTop.transform.position);
        RTPos = cam.WorldToScreenPoint(RightTop.transform.position);
        LBPos = cam.WorldToScreenPoint(LeftBottom.transform.position);
        RBPos = cam.WorldToScreenPoint(RightBottom.transform.position);

        //计算网格宽度
        gridWidth  = (RTPos.x - LTPos.x) / 14;
        gridHeight = (LTPos.y - LBPos.y) / 14;
        minGridDis = gridWidth < gridHeight ? gridWidth : gridHeight;

        //计算落子点位置
        for (int i = 0; i < 15; i++)
        {
            for (int j = 0; j < 15; j++)
            {
                chessPos[i, j] = new Vector2(LBPos.x + gridWidth * i, LBPos.y + gridHeight * j);
            }
        }
    }
Exemple #11
0
    bool isPlaying = true; //是否处于对弈状态


    // Start is called before the first frame update
    void Start()
    {
        //棋盘
        chessPos = new Vector2[15, 15];
        //落子
        chessState = new int[15, 15];
        //当前玩家
        chessTurn = turn.black;

        //计算锚点位置
        LTPos = cam.WorldToScreenPoint(LeftTop.transform.position);
        RTPos = cam.WorldToScreenPoint(RightTop.transform.position);
        LBPos = cam.WorldToScreenPoint(LeftBottom.transform.position);
        RBPos = cam.WorldToScreenPoint(RightBottom.transform.position);

        //计算网格宽度
        gridWidth  = (RTPos.x - LTPos.x) / 14;
        gridHeight = (LTPos.y - LBPos.y) / 14;
        minGridDis = gridWidth < gridHeight ? gridWidth : gridHeight;

        //计算落子点位置 - 用于鼠标点击时候判断落子点
        for (int i = 0; i < 15; i++)
        {
            for (int j = 0; j < 15; j++)
            {
                chessPos[i, j] = new Vector2(LBPos.x + gridWidth * i, LBPos.y + gridHeight * j);
            }
        }
    }
Exemple #12
0
 void DrawTurn()
 {
     removeTime            = 0;
     ui                    = ((GameObject)Instantiate(GO_turn)).GetComponent <turn>();
     ui.transform.position = new Vector3(0, 50, 0);
     removeTime           += Time.deltaTime;
     //
 }
    void Grow(ActionObject item, turn new_state)
    {
        item.Grow(1.05f);

        turnState = new_state;

        UpdateTime();
    }
    turn turnState = turn.START; // which fish should grow next?

    #endregion Fields

    #region Methods

    void Grow(ActionObject item, turn new_state)
    {
        item.Grow (1.05f);

        turnState = new_state;

        UpdateTime ();
    }
Exemple #15
0
 public Form1()
 {
     InitializeComponent();
     mainMenuToolStripMenuItem.Enabled = true;
     setupOwners();
     whoseturn = turn.xturn;
     this.Text = "It is " + XPlayer + "'s turn.";
 }
Exemple #16
0
    IEnumerator waitSpawner()
    {
        yield return(new WaitForSeconds(StartWait));

        while (!Stop)
        {
            randBuff = Random.Range(0, 3);
            //Instanciando Amarelo
            if (randBuff == 1)
            {
                if (i == 1)//Se Houver buff amarelo na posição 2 do array será destruido
                {
                    Destroy(BuffClone[2]);
                    Destroy(YellowTriggerClone[2]);
                }
                i++;
                BuffClone[i]          = Instantiate(Buffs[randBuff], BuffReference.position, BuffReference.rotation) as GameObject;
                YellowTriggerClone[i] = Instantiate(YellowTrigger, ReferenceTrigger.position, BuffReference.rotation) as GameObject;
                buffAtual             = turn.yellow;
                YellowOn = true;
                //  Debug.Log("YELLOW TURN");
                // Debug.Log("i= " + i);
            }
            //Instanciando Azul
            if (randBuff == 0)
            {
                if (j == 1)//Se Houver buff azul na posição 2 do array será destruido
                {
                    Destroy(BlueBuffClone[2]);
                    Destroy(BlueTriggerClone[2]);
                }
                j++;
                BlueBuffClone[j]    = Instantiate(Buffs[randBuff], BuffReference.position, BuffReference.rotation) as GameObject;
                BlueTriggerClone[j] = Instantiate(BlueTrigger, ReferenceTrigger.position, BuffReference.rotation) as GameObject;
                buffAtual           = turn.blue;
                //  Debug.Log("BLUE TURN");
                BlueOn = true;
                //   Debug.Log("j= " + j);
            }
            if (randBuff == 2)
            {
                if (l == 1)//Se Houver buff azul na posição 2 do array será destruido
                {
                    Destroy(BlackBuffClone[2]);
                    Destroy(BlackTriggerClone[2]);
                }
                l++;
                BlackBuffClone[l]    = Instantiate(Buffs[randBuff], BuffReference.position, BuffReference.rotation) as GameObject;
                BlackTriggerClone[l] = Instantiate(BlackTrigger, ReferenceTrigger.position, BuffReference.rotation) as GameObject;
                buffAtual            = turn.black;
                //  Debug.Log("BLUE TURN");
                BlackOn = true;
                //   Debug.Log("j= " + j);
            }
            yield return(new WaitForSeconds(SpawnWait));
        }
    }
Exemple #17
0
    //[Serializable]
    //[StructLayout(LayoutKind.Sequential, Pack = 4)]
    //public struct Test
    //{
    //    public int msg_type;
    //    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
    //    public char[] str;

    //    public Test(int msg_type, string msg_date)
    //    {
    //        this.msg_type = msg_type;
    //        this.str = msg_date.PadRight(11, '\0').ToCharArray();
    //    }
    //}

    //public byte[] StructToBytes(Object obj)
    //{

    //}
    void Start()
    {
        // 先连接服务器
        //NetWorkScript.Instance.Init();

        chesspos   = new Vector2[15, 15];
        chessstate = new int[15, 15];
        chessturn  = turn.black;
    }
    // Runs once per frame
    void Update()
    {
        // If it hasn't been half a second since the last action, don't do anything
        if ((DateTime.Now - last).TotalSeconds < 0.5f)
        {
            return;
        }

        // If a fish has already been clicked,
        if (turnState == turn.LEFT || turnState == turn.RIGHT)
        {
            // set grower to be the fish whose turn it is to grow
            ActionObject grower = (turnState == turn.LEFT) ? left.GetComponent <ActionObject> () : right.GetComponent <ActionObject> ();
            // set shrinker to be the fish whose turn it isn't to grow (it will shrink if clicked)
            ActionObject shrinker = (turnState == turn.RIGHT) ? left.GetComponent <ActionObject> () : right.GetComponent <ActionObject> ();

            // If the proper fish is clicked on, grow it
            if (grower.ClickedOn(clickedPos))
            {
                Grow(grower, (turnState == turn.LEFT) ? turn.RIGHT : turn.LEFT);
            }

            // If the improper whale is clicked on, shrink both whales
            else if (shrinker.ClickedOn(clickedPos))
            {
                Shrink(grower, shrinker);
            }

            // If both of the fish are of the winning scale, the user wins!
            if (WinningScale(grower) && WinningScale(shrinker))
            {
                turnState = turn.END;
                MoveOffScreen();
            }
        }

        // No fish has been clicked yet
        else if (turnState == turn.START)
        {
            // Get the ActionObject components of each of the fish
            ActionObject left_ob  = left.GetComponent <ActionObject> ();
            ActionObject right_ob = right.GetComponent <ActionObject> ();

            // Grow a fish if it is clicked on
            if (left_ob.ClickedOn(clickedPos))
            {
                Grow(left_ob, turn.RIGHT);
            }
            else if (right_ob.ClickedOn(clickedPos))
            {
                Grow(right_ob, turn.LEFT);
            }
        }
        else if (turnState == turn.END)
        {
        }
    }
Exemple #19
0
 // Use this for initialization
 void Start()
 {
     //初始化可以落子的位置
     chessPos = new Vector2[15, 15];
     //游戏开始时是黑方先下
     chessTurn = turn.black;
     //初始化棋盘状态
     chessState = new int[15, 15];
 }
    void OnEnable()
    {
        if (GetComponent<Main>().enabled)
            GetComponent<Main>().enabled = false;

        MoveOnScreen ();
        turnState = turn.START;

        RescaleFish ();
    }
    turn turnState = turn.START; // which fish should grow next?

    #endregion Fields

    #region Methods

    void Grow(ActionObject item, turn new_state)
    {
        music.PlayFeedback (music.pos);

        item.Grow (1.05f);

        turnState = new_state;

        UpdateTime ();
    }
Exemple #22
0
 public void switchTurn()
 {
     if (currentTurn == turn.White)
     {
         currentTurn = turn.Black;
     }
     else
     {
         currentTurn = turn.White;
     }
 }
Exemple #23
0
 void Start()
 {
     chessPos                    = new Vector2[x_len, y_len];
     chessPos_nextRed            = new Vector2[x_len_chessboard_next, y_len_chessboard_next];
     chessPos_nextBlue           = new Vector2[x_len_chessboard_next, y_len_chessboard_next];
     chessState                  = new int[x_len, y_len];
     chessState_next             = new int[x_len_chessboard_next, y_len_chessboard_next];
     chessTurn                   = turn.red;
     playerScore                 = new int[2];
     playerScore[(int)turn.red]  = 0;
     playerScore[(int)turn.blue] = 0;
 }
Exemple #24
0
    private void Start()
    {
        whiteTime      = 10;
        blackTime      = 10;
        whiteIncrement = 2;
        blackIncrement = 2;

        whiteString = "";
        blackString = "";
        matchStart  = false;
        currentTurn = turn.White;
    }
        public SanDau(XepMayBay XMBform1, XepMayBay XMBform2)
        {
            playerTurn = turn.player1;  // player1 chơi trước

            player1 = XMBform2;         // đổi 2 player
            player2 = XMBform1;         // đổi 2 player
            InitializeComponent();
            count        = countDown;
            lbTimer.Text = count.ToString();

            arrow.Image = BanMayBay.Properties.Resources.leftArrow;
        }
Exemple #26
0
 public void RestartGame()
 {
     currentTurn = turn.secondPlayerTurn;
     this.gameBoard.LeftTop.State     = Field.StateOfField.EMPTY;
     this.gameBoard.MiddleTop.State   = Field.StateOfField.EMPTY;
     this.gameBoard.RightTop.State    = Field.StateOfField.EMPTY;
     this.gameBoard.LeftMiddle.State  = Field.StateOfField.EMPTY;
     this.gameBoard.Center.State      = Field.StateOfField.EMPTY;
     this.gameBoard.RightMiddle.State = Field.StateOfField.EMPTY;
     this.gameBoard.LeftDown.State    = Field.StateOfField.EMPTY;
     this.gameBoard.MiddleDown.State  = Field.StateOfField.EMPTY;
     this.gameBoard.RightDown.State   = Field.StateOfField.EMPTY;
 }
Exemple #27
0
    // Update is called once per frame
    void Update()
    {
        //检测鼠标输入并确定落子状态
        if (isPlaying && Input.GetMouseButtonDown(0))
        {
            PointPos = Input.mousePosition;
            for (int i = 0; i < 15; i++)
            {
                for (int j = 0; j < 15; j++)
                {
                    //找到最接近鼠标点击位置的落子点,如果空则落子
                    if (Dis(PointPos, chessPos[i, j]) < minGridDis / 2 && chessState[i, j] == 0)
                    {
                        //根据下棋顺序确定落子颜色
                        chessState[i, j] = chessTurn == turn.black ? 1 : -1;
                        //落子成功,更换下棋顺序
                        chessTurn = chessTurn == turn.black ? turn.white : turn.black;
                    }
                }
            }
            //调用判断函数,确定是否有获胜方
            int re = result();
            if (re == 1)
            {
                Debug.Log("黑棋胜");
                winner    = 1;
                isPlaying = false;
            }
            else if (re == -1)
            {
                Debug.Log("白棋胜");
                winner    = -1;
                isPlaying = false;
            }
        }

        //按下空格重新开始游戏
        if (Input.GetKeyDown(KeyCode.Space))
        {
            for (int i = 0; i < 15; i++)
            {
                for (int j = 0; j < 15; j++)
                {
                    chessState[i, j] = 0;
                }
            }
            isPlaying = true;
            chessTurn = turn.black;
            winner    = 0;
        }
    }
Exemple #28
0
 public void Awake()
 {
     if (GameManager.Instance == null)
     {
         GameManager.Instance    = this;
         this.firstPlayerMarker  = Field.StateOfField.CROSS;
         this.secondPlayerMarker = Field.StateOfField.CIRCLE;
         this.currentTurn        = turn.firstPlayerTurn;
     }
     else
     {
         Destroy(this);
     }
 }
Exemple #29
0
        public void turn_purchase()
        {
            //defualt price of one turn is 1000
            int money = 3000;
            int turn  = 0;
            int num   = 4;

            turn sys = new turn();

            Assert.IsNotNull(sys);
            sys.buyturn(num, turn, money);
            //Assert.AreNotEqual(0, turn);
            Assert.AreEqual(-1, sys.buyturn(num, turn, money));
        }
Exemple #30
0
 public ActionResult Create([Bind(Include = "id,code,date,hour,id_place,id_bus,id_client")] turn turn)
 {
     if (ModelState.IsValid)
     {
         turn.date = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
         turn.hour = TimeSpan.Parse(DateTime.Now.ToString("hh:mm"));
         //db.turns.Add(turn);
         //db.SaveChanges();
         return(RedirectToAction("CodigoQr", "Turno", turn));
     }
     ViewBag.id_bus    = new SelectList(db.buses, "id", "plate", turn.id_bus);
     ViewBag.id_client = new SelectList(db.clients, "id", "name", turn.id_client);
     ViewBag.id_place  = new SelectList(db.places, "id", "name", turn.id_place);
     return(View(turn));
 }
Exemple #31
0
    // 游戏重置
    void restart()
    {
        for (int i = 0; i < 15; i++)
        {
            for (int j = 0; j < 15; j++)
            {
                chessState[i, j] = 0;
                cs[i * 15 + j]   = 0;
            }
        }

        isPlaying = true;
        chessTurn = turn.black;
        winner    = 0;
    }
Exemple #32
0
 //重新开始游戏
 void ReStart()
 {
     for (int i = 0; i < 15; i++)
     {
         for (int j = 0; j < 15; j++)
         {
             chessState[i, j] = 0;
         }
     }
     isPlaying   = true;
     chessTurn   = turn.black;
     winner      = 0;
     curCheesPos = new Vector2(-1, -1);
     stackSteps.Clear();
 }
Exemple #33
0
 public JsonResult CancelarTurno(int id_turno)
 {
     try
     {
         code code = db.codes.Where(x => x.id_turn == id_turno).ToList <code>()[0];
         db.codes.Remove(code);
         db.SaveChanges();
         turn turn = db.turns.Where(x => x.id == id_turno).ToList <turn>()[0];
         turn.last = false;
         db.SaveChanges();
         return(Json(true));
     }catch (Exception e)
     {
         return(Json(false + "  " + e));
     }
 }
Exemple #34
0
    void BeginGame() //function for starting the game.
    {
        GameObject controller = GameObject.FindGameObjectWithTag("MenuMusic");

        if (controller != null)
        {
            controller.GetComponent <MenuMusicController>().StopMusic();
        }
        ultimateUsed = false;
        if (LevelController.levelCounter == 0)
        {
            currentAiDeck = aiDeck1;
        }
        else if (LevelController.levelCounter == 1)
        {
            currentAiDeck = aiDeck2;
        }
        else if (LevelController.levelCounter == 2)
        {
            currentAiDeck = aiDeck3;
        }
        else
        {
            print("Level counter error");
        }
        CreatureShuffle(currentAiDeck);
        CreateDictionaries();
        LoadEquipment();
        DealHero();
        DealCreatureHand();
        lootCounter = lootDrop;
        turnState   = turn.Player1;
        if (turnState == turn.Player1)                        //checks if it is the Players's turn
        {
            for (int i = 0; i < equippedWeaponObj.Count; i++) //loop repeats for each weapon on the board
            {
                WeaponCard weapon = equippedWeaponObj[i].GetComponent <WeaponCard>();
                weapon.useButton.SetActive(true);           //enables buttons on all weapon cards during player turn
            }
            if (currentUltimate.ultimateData.cooldown == 0) //Checks if Ultimte is ready
            {
                currentUltimate.useButton.SetActive(true);  //enables button
            }
        }
        APReset();
    }
 public void Awake()
 {
     //Checking if is only one instance of class
     if (GameManager.Instance == null)
     {
         GameManager.Instance = this;
         //setting up default parametrs
         this.firstPlayerMarker  = Field.StateOfField.CROSS;
         this.secondPlayerMarker = Field.StateOfField.CIRCLE;
         this.currentTurn        = turn.firstPlayerTurn;
         this.crossCurrentTurnRepresentation.enabled  = true;
         this.circleCurrentTurnRepresentation.enabled = false;
     }
     else
     {
         Destroy(this);
     }
 }
Exemple #36
0
 static void Main(string[] args)
 {
     coupe coupe1 = new coupe(1,4);
     coupe coupe2 = new coupe(2,3);
     coupe coupe3 = new coupe(3, 3);
     coupe coupe4 = new coupe(4,4);
     coupe coupe5 = new coupe(5,2);
     turn<coupe> carriage = new turn<coupe>();
     carriage.add(coupe1);
     carriage.add(coupe2);
     carriage.add(coupe3);
     carriage.add(coupe4);
     carriage.add(coupe5);
     foreach(coupe c in carriage)
     {
         Console.WriteLine(c.Number.ToString()+"вагон, кол. пассажиров="+c.Number_passenger.ToString());
     }
     Console.ReadLine();
 }
	public void toggle(turn Turn)
    {
        if (Turn == turn.ON) navMesh.enabled = true;
        if (Turn == turn.OFF) navMesh.enabled = false;
    }
Exemple #38
0
        void checkForWin()
        {
            if (whoseturn == turn.xturn)
            {
                if (cellCheck())
                {
                    winner();
                    if (named)
                        MessageBox.Show(XPlayerName + " Wins!");
                    else
                        MessageBox.Show(XPlayer + " Wins!");
                }

                if (playCanContinue())
                {
                    whoseturn = turn.oturn;
                    if (named)
                        this.Text = "It is " + OPlayerName + "'s turn.";
                    else
                        this.Text = "It is " + OPlayer + "'s turn.";
                }
                else
                    gameOver();

            }
            else
            {
                if (cellCheck())
                {
                    winner();
                    if (named)
                        MessageBox.Show(OPlayerName + " Wins!");
                    else
                        MessageBox.Show(OPlayer + " Wins!");
                }
                if (playCanContinue())
                {
                    whoseturn = turn.xturn;
                    if (named)
                        this.Text = "It is " + XPlayerName + "'s turn.";
                    else
                        this.Text = "It is " + XPlayer + "'s turn.";
                }
                else
                    gameOver();
            }
        }
    // Runs once per frame
    void Update()
    {
        // If it hasn't been half a second since the last action, don't do anything
        if ((DateTime.Now - last).TotalSeconds < 0.5f)
            return;

        // If a fish has already been clicked,
        if (turnState == turn.LEFT || turnState == turn.RIGHT) {

            // set grower to be the fish whose turn it is to grow
            ActionObject grower = (turnState == turn.LEFT) ? left.GetComponent<ActionObject> () : right.GetComponent<ActionObject> ();
            // set shrinker to be the fish whose turn it isn't to grow (it will shrink if clicked)
            ActionObject shrinker = (turnState == turn.RIGHT) ? left.GetComponent<ActionObject> () : right.GetComponent<ActionObject> ();

            // If the proper fish is clicked on, grow it
            if (grower.ClickedOn (kinectClickedOn, clickedPos)) {
                Grow (grower, (turnState == turn.LEFT) ? turn.RIGHT : turn.LEFT);
            }

            // If the improper whale is clicked on, shrink both whales
            else if (shrinker.ClickedOn (kinectClickedOn, clickedPos)) {
                Shrink (grower, shrinker);
            }

            // If both of the fish are of the winning scale, the user wins!
            if (WinningScale (grower) && WinningScale (shrinker)) {
                turnState = turn.END;
                MoveOffScreen();
                GetComponent<Main>().enabled = true;
            }
        }

        // No fish has been clicked yet
        else if (turnState == turn.START) {

            // Get the ActionObject components of each of the fish
            ActionObject left_ob = left.GetComponent<ActionObject> ();
            ActionObject right_ob = right.GetComponent<ActionObject> ();

            // Grow a fish if it is clicked on
            if (left_ob.ClickedOn (kinectClickedOn, clickedPos))
            {
                Grow (left_ob, turn.RIGHT);
            }
            else if (right_ob.ClickedOn (kinectClickedOn, clickedPos))
            {
                Grow (right_ob, turn.LEFT);
            }
        }
        else if (turnState == turn.END)
        {

        }
        kinectClickedOn = false;
    }