Пример #1
0
    public void CreateDistanceMarker()
    {
        GameObject go = Instantiate(distanceMarkerPrefab);

        go.transform.SetParent(transform, false);
        DistanceMarkerController distanceMarkerController = go.GetComponent <DistanceMarkerController>();

        MarkersStorer.Instance.DistanceMarkerController = distanceMarkerController;
    }
Пример #2
0
    protected override void Enter()
    {
        _nextState = null;
        _openCloseCircleController = OpenCloseCircleStorer.Instance.OpenCloseCircleController;

        DistanceMarkerController       distanceMarkerController       = MarkersStorer.Instance.DistanceMarkerController;
        CorrectAnswersMarkerController correctAnswersMarkerController = MarkersStorer.Instance.CorrectAnswersMarkerController;

        bool distanceRecord = distanceMarkerController.GetDistance() > Data.DistanceRecord;

        if (distanceRecord)
        {
            Data.DistanceRecord = distanceMarkerController.GetDistance();
        }

        bool correctAnswersRecord = correctAnswersMarkerController.GetNCorrectAnswers() > Data.NCorrectAnswersRecord;

        if (correctAnswersRecord)
        {
            Data.NCorrectAnswersRecord = correctAnswersMarkerController.GetNCorrectAnswers();
        }

        _gameOverMenuController = UIFactory.Instance.CreateGameOverMenu(
            correctAnswersMarkerController.GetNCorrectAnswers(),
            correctAnswersRecord,
            Data.NCorrectAnswersRecord,
            distanceMarkerController.GetDistance(),
            distanceRecord,
            Data.DistanceRecord
            );

        distanceMarkerController.SetInactive();

        correctAnswersMarkerController.SetInactive();

        _gameOverMenuController.On(GameOverMenuEvent.TRY_AGAIN_BUTTON_CLICK, OnTryAgainButtonClick);
        _gameOverMenuController.On(GameOverMenuEvent.MAIN_MENU_BUTTON_CLICK, OnMainMenuButtonClick);
    }