aboutsummaryrefslogtreecommitdiffstats
path: root/Assets/Scripts/LevelController.cs
blob: 7c7355eb6aa3c440f411ee3f130342dff3300d7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class LevelController : MonoBehaviour
{
    [SerializeField] GameObject treasure;
    // Start is called before the first frame update

    public void StartGame()
    {
        SceneManager.LoadScene("Jungle");
    }

    public void ResetLevel()
    {
        Destroy(GameObject.Find("Boulder(Clone)"));
        Destroy(GameObject.Find("BoobyTrapSpawnPoint(Clone)"));
        var currentTreasure = GameObject.Find("Treasure");
        if(currentTreasure)
            Destroy(currentTreasure);
        else
            Destroy(GameObject.Find("Treasure(Clone)"));
        Instantiate(treasure);
    }
}