Created
January 10, 2021 06:03
-
-
Save fredknack/0c6690a068f811758a803f31d481e24c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.SceneManagement; | |
public class PersistentManagerScript : MonoBehaviour { | |
public static PersistentManagerScript Instance { get; private set; } | |
public GameObject playerFX; | |
public float speed = 0.5f; | |
public int lives = 3; | |
private void Awake() | |
{ | |
if (Instance == null) | |
{ | |
Instance = this; | |
DontDestroyOnLoad(gameObject); | |
} else | |
{ | |
Destroy(gameObject); | |
} | |
} | |
public void levelUpSequence() | |
{ | |
SceneManager.LoadScene(sceneName: "LevelComplete"); | |
} | |
public void deathSequence() | |
{ | |
spawnSingleParticlePrefab fx = playerFX.GetComponent<spawnSingleParticlePrefab>(); | |
fx.launchPrefab(2); | |
SceneManager.LoadScene(sceneName: "MainMenu"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment