示例#1
0
        private IEnumerator GameLoop()
        {
            Mode = GameMode.eMode.Game;
            while (true)
            {
                Tutorial();
                if (Mode == GameMode.eMode.Tutorial)
                {
                    if (TouchInput.GetState() == TouchInput.State.Began)
                    {
                        Time.timeScale = 1.0f;
                        Mode           = GameMode.eMode.Game;
                    }
                }

                if (playerController.transform.position.y >= 15.0f)
                {
                    blockGenerator.SetPosition(Vector3.down * 10.0f);
                    playerController.SetPosition(Vector3.down * 10.0f);
                }
                if (blockGenerator.IsNeedleCollision)
                {
                    saveData.IsTutorial = false;
                    SaveDataManager.Set(saveData);

                    Time.timeScale = 1.0f;
                    Mode           = GameMode.eMode.GameOver;
                    break;
                }

                yield return(null);
            }

            yield break;
        }
示例#2
0
 // 非アクティブ時にポーズ画面へ遷移
 private void OnApplicationFocus(bool focus)
 {
     if (focus && Mode == GameMode.eMode.Game)
     {
         Time.timeScale = 0.0f;
         Mode           = GameMode.eMode.Pause;
     }
 }
示例#3
0
        public void ChangeMode(GameMode.eMode mode)
        {
            foreach (var pair in dictionary)
            {
                pair.Key.SetActive(pair.Value.Any(v => v == mode));
            }

            gameCanvasController.ChangeMode(mode);
            gameOverCanvasController.ChangeMode(mode);
        }
示例#4
0
        private void Awake()
        {
            canvasManager = CanvasManagerObject.GetComponent <CanvasManager>();

            var blockGo = Instantiate(BlockGeneratorPrefab);

            blockGenerator = blockGo.GetComponent <BlockGenerator>();

            playerController = PlayerObject.GetComponent <PlayerController>();
            saveData         = SaveDataManager.Get();

            Mode = GameMode.eMode.Title;
        }
示例#5
0
 public void OnClickPauseButton()
 {
     if (Mode == GameMode.eMode.Pause)
     {
         Time.timeScale = 1.0f;
         Mode           = GameMode.eMode.Game;
     }
     else
     {
         Time.timeScale = 0.0f;
         Mode           = GameMode.eMode.Pause;
     }
 }
示例#6
0
        public void ChangeMode(GameMode.eMode mode)
        {
            switch (mode)
            {
            case GameMode.eMode.Credits:
                PanelObject.SetActive(true);
                break;

            default:
                PanelObject.SetActive(false);
                break;
            }
        }
示例#7
0
        public void ChangeMode(GameMode.eMode mode)
        {
            switch (mode)
            {
            case GameMode.eMode.Pause:
                PanelObject.SetActive(true);
                PauseButton.SetActive(true);
                break;

            case GameMode.eMode.Tutorial:
                PanelObject.SetActive(false);
                PauseButton.SetActive(false);
                break;

            default:
                PanelObject.SetActive(false);
                PauseButton.SetActive(true);
                break;
            }
        }
示例#8
0
        private void Tutorial()
        {
            if (!saveData.IsTutorial)
            {
                return;
            }
            if (Mode != GameMode.eMode.Game)
            {
                return;
            }

            var   target = blockGenerator.GetTarget();
            float tx     = target.transform.position.x;

            tx *= (target.GetDirection() == BlockBehaviour.eDirection.Left) ? -1 : 1;

            if (!playerController.IsJumping() &&
                tx <= playerController.transform.position.x + 13.0f &&
                ScoreManager.Altitude <= 2.0m)
            {
                Time.timeScale = 0.0f;
                Mode           = GameMode.eMode.Tutorial;
            }
        }
示例#9
0
 public void OnClickCredisButton()
 {
     Mode = (Mode == GameMode.eMode.GameOver) ? GameMode.eMode.Credits : GameMode.eMode.GameOver;
 }