コード例 #1
0
ファイル: GameController.cs プロジェクト: raymondlu/UnityGem
 public void OnGemOperation(int row, int column, GemOperation operation)
 {
     //Debug.Log(string.Format("Gem:{0},{1} is {2}.", row, column, operation.ToString()));
     if (_states[_currentGameBoardState] != null)
     {
         _states[_currentGameBoardState].OnGemOperation(row, column, operation);
     }
 }
コード例 #2
0
ファイル: GameController.cs プロジェクト: raymondlu/UnityGem
 public override void OnGemOperation(int row, int column, GemOperation operation)
 {
     base.OnGemOperation(row, column, operation);
     if (operation == GemOperation.TouchDown)
     {
         _controller._firstSelectedGemControler = _controller._currentGemControllerMatrix[row, column];
         _controller.ChangeToState(GameBoardState.FirstSelection);
     }
 }
コード例 #3
0
ファイル: GameController.cs プロジェクト: raymondlu/UnityGem
 public override void OnGemOperation(int row, int column, GemOperation operation)
 {
     base.OnGemOperation(row, column, operation);
     if (operation == GemOperation.TouchDown /* || operation == GemOperation.TouchEnter*/)
     {
         // check if the two selected gem is adjacent
         var  selectedGemControler = _controller._currentGemControllerMatrix[row, column];
         bool isAdjacent           = GemController.IsAdjacent(_controller._firstSelectedGemControler, selectedGemControler);
         if (isAdjacent)
         {
             _controller._secondSelectedGemControler = selectedGemControler;
             _controller.ChangeToState(GameBoardState.SecondSelection);
         }
         else
         {
             _controller._firstSelectedGemControler.SetIsSelected(false);
             _controller._firstSelectedGemControler = selectedGemControler;
             _controller._firstSelectedGemControler.SetIsSelected(true);
         }
     }
 }
コード例 #4
0
ファイル: GameController.cs プロジェクト: raymondlu/UnityGem
 virtual public void OnGemOperation(int row, int column, GemOperation operation)
 {
     //Implemented in child class
 }