Exemple #1
0
    private IEnumerator Digging()
    {
        yield return(new WaitForEndOfFrame());

        float progress = 0.0f;

        while (progress < 0.5f)
        {
            progress += Time.deltaTime;

            if (targetTile == null || !digCollider.enabled)
            {
                isDigging = null;
                yield break;
            }

            yield return(new WaitForEndOfFrame());
        }

        Destroy(targetTile);
        GameAudioController.playDig();
        targetTile = null;

        isDigging = null;
        yield return(null);
    }
    public static void StopAmbience()
    {
        GameAudioController.StopUIMusic();
        GameAudioController.PlayGameMusic();

        //if(AudioSystem.Instance != null)
        //	AudioSystem.Instance.StopAmbience();
    }
Exemple #3
0
 private void OnCollisionStay2D(Collision2D collision)
 {
     if (collision.collider.CompareTag("Player"))
     {
         ScoreTracker.AddScore(scoreOnPickup);
         GameAudioController.playRubyPickup();
         Destroy(gameObject);
     }
 }
    public static void SetAmbienceVolume(double volume)
    {
        GameAudioController.SetVolume(volume);

        if (AudioSystem.Instance != null)
        {
            AudioSystem.Instance.SetAmbienceVolume(volume);
        }
    }
Exemple #5
0
    public void UpdateResultItemData()
    {
        LogUtil.Log("UIPanelModeTypeChoice:UpdateResultItemData");

        UIUtil.SetLabelValue(labelResultItemStatus, GetStatusItemProgress());

        UIColors.UpdateColors();

        AppContentChoice choice = GetCurrentChoice();

        string typeValue = "CORRECT";
        string codeValue = "FALSE";

        if (isCorrect) //currentChoiceData.CheckChoices(true)) {
        {
            UIColors.UpdateColor(containerChoiceResultItem, UIColors.colorGreen);
            typeValue = "CORRECT!";
            GameAudioController.PlaySoundPlayerActionGood();
            choicesCorrect += 1;
        }
        else
        {
            UIColors.UpdateColor(containerChoiceResultItem, UIColors.colorRed);
            typeValue = "INCORRECT...";
            GameAudioController.PlaySoundPlayerActionBad();
        }

        foreach (AppContentChoiceItem choiceItem in choice.choices)
        {
            if (choiceItem != null)
            {
                if (choiceItem.IsTypeCorrect())
                {
                    codeValue = choiceItem.display;
                }
            }
        }

        if (choice != null)
        {
            string choiceResultType        = typeValue;
            string choiceResultValue       = codeValue;
            string choiceResultDescription = choice.description;
            string choiceResultDisplayName = choice.display_name;

            if (choice != null)
            {
                //choiceQuestion = choice.display_name + choice.code;
            }

            UIUtil.SetLabelValue(labelResultItemChoiceDisplayName, choiceResultDisplayName);
            UIUtil.SetLabelValue(labelResultItemChoiceDescription, choiceResultDescription);
            UIUtil.SetLabelValue(labelResultItemChoiceResultValue, choiceResultValue);
            UIUtil.SetLabelValue(labelResultItemChoiceResultType, choiceResultType);
        }
    }
    //static bool ambienceDelayed = false;

    public static void StartAmbience()
    {
        //if(ambienceDelayed) {
        GameAudioController.PlayUIMusic();
        GameAudioController.StopGameMusic();
        //    ambienceDelayed = true;
        //}
        //if(AudioSystem.Instance != null)
        //	AudioSystem.Instance.StartAmbience();
    }
    private void Awake()
    {
        DontDestroyOnLoad(this.gameObject);

        Cursor.lockState = CursorLockMode.Locked;

        game_state = GameState.MainMenu;
        game_state_change_event_args            = new GameStateChangeEventArgs();
        game_state_change_event_args.game_state = game_state;

        load_level_controller     = this.gameObject.AddComponent <GameLoadLevelController>();
        input_controller          = this.gameObject.GetComponent <GameInputController>();
        audio_controller          = this.gameObject.GetComponent <GameAudioController>();
        player_controller         = this.gameObject.GetComponent <GamePlayerController>();
        data_controller           = this.gameObject.GetComponent <GameDataController>();
        cutscene_controller       = this.gameObject.GetComponent <GameCutsceneController>();
        user_interface_controller = this.gameObject.GetComponent <GameUserInterfaceController>();
    }
    // Use this for initialization
    void Start()
    {
        audioController = gameObject.GetComponent <GameAudioController>();
        countdownObject = GameObject.Find("Countdown");
        timerObject     = GameObject.Find("Timer");
        switch (Instance._mode)
        {
        case Mode.BATTLE:
        case Mode.SURVIVAL:
            SetTimerText(-1);
            break;

        default:
            SetTimerText(gameTime);
            break;
        }

        //Initiate countdown
        StartCoroutine(StartCountdown());
    }
Exemple #9
0
    private void DamageUpdate()
    {
        if (!startTakingDamage)
        {
            return;
        }

        //  Update amount of health by which to decrease
        if (startTakingDamage)
        {
            currentHealthDecrease += healthDecrementRate * Time.deltaTime;;
            if (currentHealthDecrease >= 1.0f)
            {
                currentHealthDecrease -= 1.0f;
                currentHealth         -= 1;
            }
            else
            {
                GameAudioController.playBuzz();
            }
        }

        //  Update slider
        if (currentHealth != healthbar.GetSliderValue())
        {
            healthbar.SetHealth(currentHealth);
            AudioManager.Instance.StopSfx();
            GameAudioController.playHurt();
        }

        //  Update isAlive
        if (currentHealth == 0)
        {
            isAlive = false;
        }
    }
Exemple #10
0
    public void UpdateDisplayStateResultsData()
    {
        LogUtil.Log("UIPanelModeTypeChoice:UpdateDisplayStateResultsData");

        UIColors.UpdateColors();

        UIUtil.SetLabelValue(labelResultsStatus, "Results");

        GameAudioController.PlaySoundPlayerActionGood();

        //double timeCompleted = 30; // TODO
        double coins         = 500;
        double choiceTotal   = choices.Count;
        double choicesResult = choicesCorrect / choiceTotal;

        coins = choicesCorrect * 100;

        string scoreFractionValue   = string.Format("{0}/{1}", choicesCorrect, choiceTotal);
        string scorePercentageValue = choicesResult.ToString("P0");
        //string scoreTitleValue = ;
        //string scoreTypeValue = "4/5";
        string scoreCoinsValue = coins.ToString("N0");

        UIUtil.SetSliderValue(sliderScore, choicesResult);

        UIUtil.SetLabelValue(labelResultsScoreFractionValue, scoreFractionValue);
        UIUtil.SetLabelValue(labelResultsScorePercentageValue, scorePercentageValue);
        //UIUtil.SetLabelValue(labelResultsTitle, choiceResultValue);
        //UIUtil.SetLabelValue(labelResultsType, choiceResultType);
        UIUtil.SetLabelValue(labelResultsCoinsValue, scoreCoinsValue);

        // REWARDS

        GameProfileRPGs.Current.AddCurrency(coins);

        GamePlayerProgress.SetStatCoins(coins);
        GamePlayerProgress.SetStatCoinsEarned(coins);

        double xpEarned = coins * 2;

        GamePlayerProgress.SetStatXP(xpEarned);

        GameProfileCharacters.Current.CurrentCharacterAddGamePlayerProgressXP(xpEarned);
        GameProfileCharacters.Current.CurrentCharacterAddGamePlayerProgressEnergy(1f); // refill
        GameProfileCharacters.Current.CurrentCharacterAddGamePlayerProgressHealth(1f); // refill

        GameController.ProcessLevelStats();


        /*
         * AppContentChoice choice = GetCurrentChoice();
         *
         * if(choice != null) {
         *
         *  string choiceTitle = "Loading...";
         *  string choiceQuestion = "Loading...";
         *
         *  if(choice != null) {
         *      choiceTitle = "Question";
         *      choiceQuestion = choice.display_name + choice.code;
         *  }
         *
         *  UIUtil.SetLabelValue(labelDisplayItemTitle, choiceTitle);
         *  UIUtil.SetLabelValue(labelDisplayItemQuestion, choiceQuestion);
         * }
         */
    }
Exemple #11
0
 // Use this for initialization
 void Start()
 {
     gameAudio = GameObject.Find("GameController").GetComponent <GameAudioController>();
 }
Exemple #12
0
 private void Awake() => instance = this;