Ejemplo n.º 1
0
    public void Restart()
    {
        Enemies = GameObject.FindGameObjectsWithTag("Enemy");
        for (int i = 0; i < Enemies.Length; i++)
        {
            Destroy(Enemies [i]);
        }
        Money = GameObject.FindGameObjectsWithTag("Money");
        for (int i = 0; i < Money.Length; i++)
        {
            Destroy(Money [i]);
        }
        GameObject[] Spawnholes = GameObject.FindGameObjectsWithTag("Spawnhole");
        for (int i = 0; i < Spawnholes.Length; i++)
        {
            Destroy(Spawnholes [i]);
        }
        EnemySpawnScene = GameObject.FindGameObjectWithTag("EnemySpawn");
        Destroy(EnemySpawnScene);
        Instantiate(EnemySpawn);
        GameObject boss = GameObject.FindGameObjectWithTag("quack");

        Destroy(boss);
        Instantiate(Bossspawn);
        if (playeracc.activeSelf == false)
        {
            playeracc.SetActive(true);
        }
        else
        {
            playeracc.transform.position = new Vector2(0, 0);
            playeracc.GetComponent <OtherMove> ().enabled = true;
        }
        //OtherMove playscript = playeracc.GetComponent<OtherMove> ();
        //playscript.canmove = true;
        Destroy(Instr1);
        Destroy(Instr2);
        Restartbutton.SetActive(false);
        Menubutton.SetActive(false);
        Deadtext.SetActive(false);
        highsc.SetActive(false);
        Restartpause.SetActive(false);
        Continue.SetActive(false);
        //camtrans.transform.rotation = Quaternion.Euler(0, 0, 0);
        //cam.GetComponent<Camera> ().orthographicSize = 5;
        Time.timeScale = 1;
        UI scorescript = UIop.GetComponent <UI> ();

        scoreacc   = 0;
        score1     = 0;
        timedisp   = scoreacc.ToString();
        scorereset = true;
        playeracc.GetComponent <AudioSource>().Play();
    }