Пример #1
0
    // Update is called once per frame
    void Update()
    {
        //Life
        text            = nb_vie.ToString();
        canvas_vie.text = "Vie : " + text;

        //Combo
        timer += Time.deltaTime;         //Temps depuis le début du jeu
        if (timer > combotime)
        {
            in_combo = false;
        }
        if (in_combo == false)
        {
            canvas_combo.enabled = false;
            barre_combo.enabled  = false;
            comboValue           = 0;
        }
        else
        {
            barre_combo.transform.localScale = new Vector2(0.7f * (combotime - timer) / (float)combotime, 0.05f);
        }

        //Spawn des reliques
        timer_relique += Time.deltaTime; //Temps depuis le début du jeu
        if (timer_relique > random_time)
        {
            int random_number = Random.Range(0, relique_spawn.Length);
            random_relique = Random.Range(0, relique.Length);

            Instantiate(relique[random_relique], relique_spawn[random_number].transform.position, Quaternion.identity);
            timer_relique = 0;
            random_time   = Random.Range(25, 40);
        }

        //Spawn des ennemis
        timer_ennemy += Time.deltaTime;
        Vector2 Player_position = new Vector2(Player.transform.position.x, Player.transform.position.y);

        if (timer_ennemy > time_to_spawn)
        {
            int random_number = Random.Range(0, ennemy_spawn.Length);
            random_ennemy = Random.Range(0, ennemy_type.Length);

            SpawnPlayer.Spawn_near_player();
            Instantiate(ennemy_type[random_ennemy], ennemy_spawn[random_number].transform.position, Quaternion.identity);
            timer_ennemy = 0;
        }
    }