// Update is called once per frame
    void Update()
    {
        if (triggeredLevelFinished)
        {
            return;
        }

        GetComponent <Slider>().value = Time.timeSinceLevelLoad / levelTime;

        bool timeFinished = (Time.timeSinceLevelLoad >= levelTime);

        if (timeFinished)
        {
            FindObjectOfType <LevelController>().LevelTimerFinished();
            triggeredLevelFinished = true;
        }
        if (PlayerPrefsController.GetDifficulty() == 1)
        {
            levelTime = 30f;
        }

        if (PlayerPrefsController.GetDifficulty() == 2)
        {
            levelTime = 50f;
        }
    }
Exemple #2
0
 private void Start()
 {
     lives     = baseLives - PlayerPrefsController.GetDifficulty();
     livesText = GetComponent <Text>();
     UpdateDisplay();
     print("difficulty setting is " + PlayerPrefsController.GetDifficulty());
 }
Exemple #3
0
 private void Start()
 {
     life            = baseLife - PlayerPrefsController.GetDifficulty();
     textLife        = GetComponent <Text>();
     levelController = FindObjectOfType <LevelController>();
     dangerLife      = life / 2;
 }
Exemple #4
0
 void Start()
 {
     health = baseLives - Mathf.FloorToInt(PlayerPrefsController.GetDifficulty() * (baseLives - 1));
     Debug.Log("difficulty setting currently is " + PlayerPrefsController.GetDifficulty());
     healthText = GetComponent <Text>();
     UpdateDisplay();
 }
Exemple #5
0
 void Start()
 {
     playerHealth = basePlayerHealth - PlayerPrefsController.GetDifficulty();
     healthText   = GetComponent <Text>();
     UpdateDisplay();
     Debug.Log("Is: " + PlayerPrefsController.GetDifficulty());
 }
    private void AdjustDifficulty()
    {
        float difficultyIncreasesValue = 1f;
        float difficultyDecreasesValue = 1f;

        switch (PlayerPrefsController.GetDifficulty())
        {
        case 0:
            difficultyIncreasesValue = 0.5f;
            difficultyDecreasesValue = 1.5f;
            break;

        case 1:
            difficultyIncreasesValue = 1f;
            difficultyDecreasesValue = 1f;
            break;

        case 2:
            difficultyIncreasesValue = 1.5f;
            difficultyDecreasesValue = 1f;
            break;

        case 3:
            difficultyIncreasesValue = 2f;
            difficultyDecreasesValue = 0.5f;
            break;

        default:
            break;
        }// end of switch

        health        = Mathf.RoundToInt(baseHealth * difficultyDecreasesValue);
        stars         = Mathf.RoundToInt(baseStars * difficultyDecreasesValue);
        levelDuration = Mathf.RoundToInt(baseLevelDuration * difficultyIncreasesValue);
    }
Exemple #7
0
    IEnumerator Start()
    {
        adjustedDelay = maxSpawnDelay - PlayerPrefsController.GetDifficulty();
        Debug.Log("Playing at difficulty" + adjustedDelay);
        var startTime = Time.time;

        while (spawn)
        {//while spawn is true
            if (timer < 15)
            {
                timer = Time.time - startTime;
            }

            yield return(new WaitForSeconds(UnityEngine.Random.Range(minSpawnDelay, adjustedDelay)));

            //SpawnAttacker();
            //Debug.Log("scene index is"+ SceneManager.GetActiveScene().buildIndex);
            if (timer < 15 && SceneManager.GetActiveScene().buildIndex >= 26)
            {
                //Debug.Log($"Timer: {timer}. RealTime: {Time.time - startTime}. Don't spawn. ");
                continue;
            }
            //else if (timer < 25 && SceneManager.GetActiveScene().buildIndex == 27)
            //{
            //    Debug.Log($"Timer: {timer}. RealTime: {Time.time - startTime}. Don't spawn. ");
            //    continue;
            //}

            SpawnAttacker();
        }
    }
 void Start()
 {
     lives     = baseLives - PlayerPrefsController.GetDifficulty();
     livesText = GetComponent <Text>(); //hiển thị số lượng mạng lên màn hình
     UpdateDisplay();
     Debug.Log("Difficulty is : " + PlayerPrefsController.GetDifficulty());
 }
    private void Start()
    {
        _lives     = _baseLives - PlayerPrefsController.GetDifficulty();
        _livesText = GetComponent <Text>();

        UpdateDisplay();
    }
    // Start is called before the first frame update
    void Start()
    {
        musicPlayer = FindObjectOfType <MusicPlayer>();

        volumeSlider.value     = PlayerPrefsController.GetMasterVolume();
        difficultySlider.value = PlayerPrefsController.GetDifficulty();
    }
Exemple #11
0
 // Start is called before the first frame update
 void Start()
 {
     Debug.Log(PlayerPrefsController.GetDifficulty());
     startingHealth   = Mathf.RoundToInt(100 / PlayerPrefsController.GetDifficulty());
     playerHealthText = GetComponent <PlayerHealth>().GetComponent <Text>();
     UpdatePlayerHealthDisplay();
 }
 // Start is called before the first frame update
 void Start()
 {
     currentHealth = maxHealth;
     maxHealth    *= (int)PlayerPrefsController.GetDifficulty();
     damage       *= (int)PlayerPrefsController.GetDifficulty();
     baseDamage   *= (int)PlayerPrefsController.GetDifficulty();
 }
Exemple #13
0
 void Start()
 {
     playerHealth = baseHealth - PlayerPrefsController.GetDifficulty();
     healthText   = GetComponent <Text>();
     UpdateDisplay();
     Debug.Log("difficulty setting currently is " + PlayerPrefsController.GetDifficulty());
 }
 void Start()
 {
     difficulty = (int)PlayerPrefsController.GetDifficulty(difficulty);
     stars      = starsAtLowestDifficulty / difficulty;
     starText   = GetComponent <Text>();
     UpdateDisplay();
 }
Exemple #15
0
 private void Start()
 {
     lvlModification();
     playerLivesText = GetComponent <Text>();
     Debug.Log("DIFFICULTY LEVEL: " + PlayerPrefsController.GetDifficulty() + " PLAYER LIVES: " + playerLives);
     displayUpdate();
 }
    public DifficultyLevel[] GetDifficultyLevels()
    {
        difficultySetting = PlayerPrefsController.GetDifficulty();

        if (difficultySetting == 0)
        {
            Debug.Log("easy levels");
            return(easyDifficultyLevels);
        }
        else if (difficultySetting == 1)
        {
            Debug.Log("normal levels");
            return(normalDifficultyLevels);
        }
        else if (difficultySetting == 2)
        {
            Debug.Log("hard levels");
            return(hardDifficultyLevels);
        }
        else
        {
            Debug.LogError("Difficulty Setting is wrong, setting to normal difficulty");
            PlayerPrefsController.SetDifficulty(1);
            return(normalDifficultyLevels);
        }
    }
Exemple #17
0
 // Start is called before the first frame update
 void Start()
 {
     lives     = baseLives - PlayerPrefsController.GetDifficulty();
     livesText = GetComponent <Text>();
     UpdateDisplay();
     Debug.Log("Difficulty setting currently is " + PlayerPrefsController.GetDifficulty());
 }
Exemple #18
0
 void Start()
 {
     lives    -= PlayerPrefsController.GetDifficulty() * 2;
     livesText = GetComponent <TextMeshProUGUI>();
     UpdateText();
     level = FindObjectOfType <LevelController>();
 }
    private void Start()
    {
        baseHealth = PlayerPrefsController.GetDifficulty();

        healthDisplay = FindObjectOfType <BaseHealthDisplay>();
        healthDisplay.UpdateHealthDisplay(baseHealth);
    }
Exemple #20
0
 void Start()
 {
     fltlives = fltbaselives - PlayerPrefsController.GetDifficulty();
     txtLives = GetComponent <Text>();
     UpdateDisplay();
     UnityEngine.Debug.Log("Difficulty Setting Is Presently " + PlayerPrefsController.GetDifficulty());
 } // Start()
Exemple #21
0
 private void Awake()
 {
     if (PlayerPrefsController.GetDifficulty() == 1)
     {
         gameObject.SetActive(false);
     }
 }
Exemple #22
0
    void Start()
    {
        spawnTimerMin = spawnTimerMin / PlayerPrefsController.GetDifficulty();
        spawnTimerMax = spawnTimerMax / PlayerPrefsController.GetDifficulty();

        Invoke("DelayAndStart", spawnDelay);
    }
Exemple #23
0
 // Start is called before the first frame update
 void Start()
 {
     // sets the slider value to whatever is stored in the master volume method
     volumeSlider.value = PlayerPrefsController.GetMasterVolume();
     // sets the slider value to whatever is stored in the difficulty method
     difficultySlider.value = PlayerPrefsController.GetDifficulty();
 }
Exemple #24
0
    private void Start()
    {
        livesText = GetComponent <TextMeshProUGUI>();
        var difficulty = PlayerPrefsController.GetDifficulty();

        switch (difficulty)
        {
        case 1:
        {
            totalLives = 100;
            break;
        }

        case 2:
        {
            totalLives = 75;
            break;
        }

        case 3:
        {
            totalLives = 50;
            break;
        }

        default:
        {
            totalLives = 75;
            break;
        }
        }
        UpdateLives();
    }
 private void LaunchOnMouseClick()
 {
     if (Input.GetMouseButton(0))
     {
         hasStarted           = true;
         rigidBody2D.velocity = new Vector2(xPush, yPush - ((2 - PlayerPrefsController.GetDifficulty()) * 5));
     }
 }
Exemple #26
0
    private void Start()
    {
        levelLoader = FindObjectOfType <LevelLoader>();
        musicPlayer = FindObjectOfType <MusicPlayer>();

        volumeSlider.value     = PlayerPrefsController.GetMasterVolume();
        difficultySlider.value = (float)PlayerPrefsController.GetDifficulty();
    }
 private void AddJustHealthToDifficulty()
 {
     baseHealth = (int)(baseHealth / PlayerPrefsController.GetDifficulty());
     if (baseHealth <= 0)
     {
         baseHealth = 1;
     }
 }
Exemple #28
0
    // Start is called before the first frame update
    void Start()
    {
        float healthInFloat = (float)health;

        health     = health - (int)(healthInFloat * PlayerPrefsController.GetDifficulty());
        healthText = GetComponent <Text>();
        UpdateDisplay();
    }
    private void Start()
    {
        volumeSlider.onValueChanged.AddListener(SetVolume);
        difficultySlider.onValueChanged.AddListener(SetDifficulty);

        volumeSlider.value     = PlayerPrefsController.GetVolume();
        difficultySlider.value = PlayerPrefsController.GetDifficulty();
    }
Exemple #30
0
    void Start()
    {
        var difficulty = (int)PlayerPrefsController.GetDifficulty();

        lives = Mathf.CeilToInt(GetHalf(baseLives, difficulty));
        label = GetComponent <TMP_Text>();
        UpdateDisplay();
    }