public void OnOptionOpen() { _gameBoardTrans.localPosition = new Vector3(10000, 0, 0); _optionManager.gameObject.SetActive(true); _gamePhase = eGamePhase.NONE; _mode = eGameMode.OPTION; }
void Update() { switch (_gamePhase) { case eGamePhase.NONE: break; case eGamePhase.INITIAL_STAGE: MakeUselessBubbles(); _gamePhase = eGamePhase.UPDATE_BUBBLE; break; case eGamePhase.UPDATE_BUBBLE: if (UpdateBubble() == true) { switch (_missSwap) { case eMissAniPhase.Begin: BubbleSwap(_swapSourceBubble, _swapTargetBubble); _missSwap = eMissAniPhase.Return; OnClickBubble(null, false); _swapTargetBubble = null; _swapSourceBubble = null; break; case eMissAniPhase.Return: _missSwap = eMissAniPhase.None; _gamePhase = eGamePhase.PLAYER_TURN; break; case eMissAniPhase.None: _gamePhase = eGamePhase.BUBBLE_BOMB; break; } } break; case eGamePhase.BUBBLE_BOMB: if (CalcBubbleBomb() == true) { _gamePhase = eGamePhase.UPDATE_BUBBLE; } else { _gamePhase = eGamePhase.PLAYER_TURN; } break; case eGamePhase.PLAYER_TURN: CheckSwapBubble(); break; case eGamePhase.CLEAR: break; } }
public void OnStartGame() { if (_mode == eGameMode.OPTION) { InitStage(TileWidth, TileHeight); MakeUselessBubbles(); InitScale(); } _gamePhase = eGamePhase.INITIAL_STAGE; _missSwap = eMissAniPhase.None; _swapTargetBubble = null; _swapSourceBubble = null; _optionManager.gameObject.SetActive(false); _mode = eGameMode.GAME; }
// Update is called once per frame void Update() { if (Score != 0) { TotalScore++; ScoreTxt.text = TotalScore.ToString(); Score--; } TimeReset(); if (_killPoint < 10) { curPhase = eGamePhase.Phase1; } if (_killPoint < 20 && _killPoint >= 10) { curPhase = eGamePhase.Phase2; } if (_killPoint < 30 && _killPoint >= 20) { curPhase = eGamePhase.Phase3; } if (_killPoint >= 30) { curPhase = eGamePhase.Phase4; } //switch() if (_killPoint == ChoiceCount) { Debug.Log("choiceeeeeeeeeee"); if (!UItrigger) { Time.timeScale = 0.0f; ChoiceCount += _killPoint; _openUI = true; UItrigger = true; abilchoice.SetActive(_openUI); } } else { UItrigger = false; abilchoice.SetActive(_openUI); } }
public void CheckSwapBubble() { if (_gamePhase != eGamePhase.PLAYER_TURN || _pressdBubble == null) { return; } Ray ray = UICamera.currentCamera.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 10f, _bubbleLayerMask)) { BubbleScript bubble = hit.collider.gameObject.GetComponent <BubbleScript>(); if (bubble == null) { return; } if (bubble.TargetMapTile.IsNearbyMapTile(_pressdBubble.TargetMapTile) == true) { if (SwapBubble(_pressdBubble, bubble) == true) { BubbleSwap(_pressdBubble, bubble); OnClickBubble(null, false); } else { _missSwap = eMissAniPhase.Begin; BubbleSwap(_pressdBubble, bubble); _swapTargetBubble = bubble; _swapSourceBubble = _pressdBubble; } _gamePhase = eGamePhase.UPDATE_BUBBLE; } } }
void Start() { Debug.Log(solution("1924", 2)); _gamePhase = eGamePhase.NONE; if (_instance == null) { _instance = this; } _tileBGRes = Resources.Load(TILEBG_PATH) as GameObject; _bubbleRes = Resources.Load(BUBBLE_PATH) as GameObject; _bubbleLayerMask = 1 << LayerMask.NameToLayer("Bubble"); OnOptionOpen(); _startButton.onClick.Add(new EventDelegate(() => OnStartGame())); _optionButton.onClick.Add(new EventDelegate(() => OnOptionOpen())); //_startButton.OnClickAsObservable().Subscribe(_ => OnStartGame()); //_optionButton.OnClickAsObservable().Subscribe(_ => OnOptionOpen(), ()=>Debug.Log("Complete")); //Observable.EveryUpdate() // .Where(_ => _gamePhase == eGamePhase.INITIAL_STAGE) // .Subscribe(_ => { // MakeUselessBubbles(); // _gamePhase = eGamePhase.UPDATE_BUBBLE; // }); //Observable.EveryUpdate() // .Where(_ => _gamePhase == eGamePhase.UPDATE_BUBBLE) // .Where(_ => UpdateBubble()) // .Subscribe(_ => // { // switch (_missSwap) // { // case eMissAniPhase.Begin: // BubbleSwap(_swapSourceBubble, _swapTargetBubble); // _missSwap = eMissAniPhase.Return; // OnClickBubble(null, false); // _swapTargetBubble = null; // _swapSourceBubble = null; // break; // case eMissAniPhase.Return: // _missSwap = eMissAniPhase.None; // _gamePhase = eGamePhase.PLAYER_TURN; // break; // case eMissAniPhase.None: // _gamePhase = eGamePhase.BUBBLE_BOMB; // break; // } // }); //Observable.EveryUpdate() // .Where(_ => _gamePhase == eGamePhase.BUBBLE_BOMB) // .Subscribe(_ => { // if (CalcBubbleBomb() == true) _gamePhase = eGamePhase.UPDATE_BUBBLE; // else _gamePhase = eGamePhase.PLAYER_TURN; // }); //Observable.EveryUpdate() // .Where(_ => _gamePhase == eGamePhase.PLAYER_TURN) // .Subscribe(_ => CheckSwapBubble()); }