-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLevelProgressor.cs
More file actions
39 lines (29 loc) · 1.45 KB
/
LevelProgressor.cs
File metadata and controls
39 lines (29 loc) · 1.45 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LevelProgressor : MonoBehaviour
{
public int toLevel;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnTriggerEnter2D(Collider2D col)
{
if(col.tag == "Player")
{
SaveSystem.SavePlayer(GameObject.Find("InventoryManager").GetComponent<InventoryManager>(), GameObject.Find("Player").GetComponent<PlayerBehaviour>(), GameObject.Find("Cam").GetComponent<CamManager>(), GameObject.Find("RootShoot").GetComponent<Shoot>(), GameObject.Find("InventoryManager").GetComponent<InventoryManager>().saveIndex);
GameObject.Find("InventoryManager").GetComponent<InventoryManager>().loaded = true;
GameObject.Find("InventoryManager").GetComponent<InventoryManager>().progressed = true;
SceneManager.LoadScene(toLevel,LoadSceneMode.Additive);
SceneManager.UnloadSceneAsync(GameObject.Find("InventoryManager").GetComponent<InventoryManager>().currentLevelSceneIndex);
GameObject.Find("InventoryManager").GetComponent<InventoryManager>().currentLevelSceneIndex = toLevel;
GameObject.Find("InventoryManager").GetComponent<InventoryManager>().progressed = true;
}
}
}