예제 #1
0
    // THE REWARD FOR THE COMPLETED QUEST IS ASSIGNED TO THE PLAYER -------------------------------------------------------------------- quest reward ------------------------------------
    private void Reward(General_Controls player)
    {
        Debug.Log("REWARD is assigned to: " + player.gameObject.name);

        #region NEW CODE


        if (player.GetComponent <IA_controller>() != null)
        {
            questCompletedP2.Play();
            questCompletedP2b.Play();
        }
        else
        {
            questCompletedP1.Play();
            questCompletedP1a.Play();
        }

        #endregion
        quest_sound_completed.Play();
        player.player_score += match_quests[current_quest].quest_reward; // quest reward is assigned to the player

        for (int i = 0; i < player.player_combo.Length; i++)
        {
            player.player_combo[i] = null;
            QuestList[i]           = null;
        }

        //the combo icon is generated to show the value of the quest
        GameObject combo_icon;
        combo_icon = Instantiate(player.GetComponent <General_Controls>().combo_icon, transform.position, Quaternion.identity);
        combo_icon.GetComponent <Arrow_Score>().score = match_quests[current_quest].quest_reward;
        combo_icon.transform.parent = null;

        //the quest icon is generated to enfatize the player who completed the quest
        Instantiate(player.quest_icon, transform.position, Quaternion.identity);


        StopAllCoroutines(); // PROVVISORIO --> perchè non posso fermare la singola coroutine?

        RemoveQuest();       // removes the current quest

        NextWave();          // prepares the next wave
    }
예제 #2
0
    // POWER TIME DECREMENT --------------------------------------------------------------------------------------------------- cooldown ---------------------------------------------------
    void Update()
    {
        if (!power_activated && owner.ready)
        {
            if (special_attack_actual_time < special_attack_reload_time) // cooldown
            {
                special_attack_actual_time += Time.deltaTime;            //* streak_factor; // time of the attack is reduced according to the status of the kill streak

                fill_image.fillAmount = (special_attack_actual_time / special_attack_reload_time);
            }
            else if (!ready) // cooldown ends
            {
                special_attack_actual_time = special_attack_reload_time;
                transform.localScale      *= button_bump_scale_factor;
                fill_image.fillAmount      = 1;

                if (owner.GetComponent <IA_controller>() == null)
                {
                    power_is_ready_sound.Play();
                }

                #region NEW CODE

                if (owner.GetComponent <IA_controller>() == null && buttonReadyFX != null)
                {
                    buttonReady = Instantiate(buttonReadyFX);
                }

                #endregion

                ready = true;
            }
        }

        // bump effect resizing
        if (transform.localScale.z > 1)
        {
            transform.localScale -= Vector3.one * button_scale_reduction;
        }
        else if (transform.localScale.z < 1)
        {
            transform.localScale = Vector3.one;
        }
    }