Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (MainGame.couldControl)
        {
            #region --------------- old --------------
            if (Input.GetMouseButtonDown(0))
            {
                if (CheckIsInGridRange())
                {
                    if (!MainGame.CheckIsContinousOperation() && MainGame.CheckCouldModifyGridFlag(operationState)) //没有连续操作/没有进行任何操作
                    {
                        operationState = MainGame.GetNextGridFlag(operationState);                                  //得到当前格的反操作(黑变白,白变黑,x变白,白变x)
                        MainGame.StartContinousOpeartion(operationState);                                           //画
                        shouldChangeColor = true;
                        //Debug.Log(string.Format("{0} - {1}", ID, operationState.ToString()));
                    }
                }
            }

            if (Input.GetMouseButtonUp(0))
            {
                if (MainGame.CheckIsContinousOperation())
                {
                    MainGame.StopContinuousOperation();
                }
            }
            else if (Input.GetMouseButton(0))
            {
                if (CheckIsInGridRange())
                {
                    if (MainGame.CheckIsContinousOperation())
                    {
                        GridFlag gameOperationState = MainGame.GetContinousGridFlag();
                        if (operationState != gameOperationState)
                        {
                            operationState    = MainGame.GetNextGridFlag(operationState);
                            shouldChangeColor = true;
                        }
                    }
                }
            }

            #endregion
        }
        SetAndDisplayNewColor();
    }