Пример #1
0
        void Update()
        {
            if (gameModeManager.GetGameMode() == GameEnum.GAME_MODE.CLEAR ||
                gameModeManager.GetGameMode() == GameEnum.GAME_MODE.GAMEOVER)
            {
                return;
            }
            float x = Input.GetAxisRaw("Horizontal");

            if (Input.GetKeyDown(KeyCode.Space))
            {
                if (!jumpButtonUsingManager.GetIsUsing())
                {
                    playerJumper.ButtonJump();
                    playerMoveAnimator.Jump();
                    playerJumpSEPlayer.Play();
                }
            }
            else
            {
            }

            if (x == 0)
            {
                if (!leftButtonUsingManager.GetIsUsing() && !rightButtonUsingManager.GetIsUsing())
                {
                    playerMoveAnimator.Stop();
                    playerMover.Stop();
                }
            }
            else
            {
                if (x < 0)
                {
                    if (!leftButtonUsingManager.GetIsUsing() && !rightButtonUsingManager.GetIsUsing())
                    {
                        playerMover.SetMoveDirection(GameEnum.MOVE_DIR.LEFT);
                    }
                }
                else
                {
                    if (!leftButtonUsingManager.GetIsUsing() && !rightButtonUsingManager.GetIsUsing())
                    {
                        playerMoveAnimator.Move();
                        playerMover.SetMoveDirection(GameEnum.MOVE_DIR.RIGHT);
                    }
                }
            }
        }
Пример #2
0
    private void Start()
    {
        GameModeManager _mode = FindObjectOfType <GameModeManager>();

        switch (_mode.GetGameMode())
        {
        case GameModes.Modes.NoneGame:
            break;

        case GameModes.Modes.Classic:
            gameManager = FindObjectOfType <ClassicGameManager>();
            if (!gameManager)
            {
                Log.WriteLog("ClassicGameManager not set.", Log.LevelsOfLogs.ERROR, "SwipeManager");
            }
            break;

        case GameModes.Modes.Challenge:
            gameManager = FindObjectOfType <ChallengeGameManager>();
            if (!gameManager)
            {
                Log.WriteLog("ClassicGameManager not set.", Log.LevelsOfLogs.ERROR, "SwipeManager");
            }
            break;

        default:
            break;
        }
    }
Пример #3
0
    /// <summary>
    /// Prepare Money Manager
    /// </summary>
    private void Start()
    {
        GameModeManager _mode = FindObjectOfType <GameModeManager>();

        if (!_mode)
        {
            Log.WriteLog("Can not set game mode." + gameMode.ToString() + ".", Log.LevelsOfLogs.ERROR, "ScoreManager");
        }
        gameMode = _mode.GetGameMode();
        Log.WriteLog("Set game mode: " + gameMode.ToString() + ".", Log.LevelsOfLogs.INFO, "ScoreManager");
        // Get best score of current mode
        switch (gameMode)
        {
        case GameModes.Modes.Classic:
            bestScore = PlayerPrefs.GetInt(PlayerPrefsKeys.BestScoreClassic);
            break;

        case GameModes.Modes.Challenge:
            bestScore = PlayerPrefs.GetInt(PlayerPrefsKeys.BestScoreChallenge);
            break;
        }
        Log.WriteLog("Best score: " + bestScore + ".", Log.LevelsOfLogs.INFO, "ScoreManager");

        var uiUpdater = FindObjectOfType <GameLoopUIUpdate>();

        updateScoreUI += uiUpdater.UpdateGameScoreUI;
        updateLoseUI  += uiUpdater.UpdateLoseUI;

        updateScoreUI?.Invoke(new ScoreUpdateUIEventArgs(0));
    }
Пример #4
0
        private void OnTriggerEnter2D(Collider2D collision)
        {
            if (gameModeManager.GetGameMode() == GameEnum.GAME_MODE.CLEAR)
            {
                return;
            }
            var hitObject     = collision.gameObject;
            var handlercaller = hitObject.GetComponent <IPlayerHitHandlerCaller>();

            if (handlercaller != null)
            {
                handlercaller.CallHandler();
            }
        }
Пример #5
0
    private void Start()
    {
        money   = PlayerPrefs.GetInt(PlayerPrefsKeys.Money);
        gems    = PlayerPrefs.GetInt(PlayerPrefsKeys.Gems);
        tickets = PlayerPrefs.GetInt(PlayerPrefsKeys.TicketsForEnterToChallenge);

        GameModeManager _mode = FindObjectOfType <GameModeManager>();

        if (_mode)
        {
            gameMode = _mode.GetGameMode();
        }

        //var updateUI = FindObjectOfType<GameLoopUIUpdate>();
        //SetEvents(updateUI.UpdateMoneyUI, updateUI.UpdateGemsUI, updateUI.UpdateTicketsUI);
    }
Пример #6
0
 public void BtnMode1ClickOn()
 {
     gmd.GetGameMode();
 }