Пример #1
0
    void Update()
    {
        bool isMouseClicked = Input.GetMouseButtonDown(0);

        switch (currentGameState)
        {
        case GameState.ReadingIntroduction:
            if (isMouseClicked)
            {
                ChangeToReadingCharacterIntroduction();
            }
            break;

        case GameState.ReadingCharacterIntroduction:
            if (isMouseClicked)
            {
                ChangeToReadingDaysState();
            }
            break;

        case GameState.ReadingDays:
            if (isMouseClicked)
            {
                if (networkAmount > NETWORK_AMOUNT_TO_WIN)
                {
                    ChangeToWinningState();
                }
                else
                {
                    SwitchToChoiceView();
                }
            }
            break;

        case GameState.Reading:
            if (isMouseClicked)
            {
                ChangeToReadingDaysState();
            }
            break;

        case GameState.Arrested:
            if (isMouseClicked)
            {
                playerScript.NewPlayer();
                ResetRisk();
                DegradeNetworkAfterDeath();
                musicScript.PlayMusicForLevel(riskAmount);
                ChangeToReadingCharacterIntroduction();
            }
            break;

        default:
            break;
        }
    }
Пример #2
0
    void Awake()
    {
        overlay.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace;
        characterIntroductionInterface.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace;
        actionInterface.GetComponent <Canvas>().renderMode = RenderMode.WorldSpace;

        musicScript = musicManager.GetComponent <MusicScript>();
        musicScript.Init();
        musicScript.PlayMusicForLevel(riskAmount);

        story = new Story();

        string filePath   = Path.Combine(Application.streamingAssetsPath, "story.json");
        string dataAsJson = File.ReadAllText(filePath);

        story = JsonUtility.FromJson <Story>(dataAsJson);

        actionImageComponent = actionImage.GetComponent <Image>();
        actionImage.SetActive(false);

        audioSourceComponent = gameObject.GetComponent <AudioSource>();

        timerBar.maxValue = MAX_TIMER_VALUE;
        timerBar.value    = timerBar.maxValue;

        playerScript = player.GetComponent <PlayerScript>();
        playerScript.InitialPlayer();

        ChangeToIntroductionState();
    }