Skip to content

Instantly share code, notes, and snippets.

@fredknack
Created January 10, 2021 06:03
Show Gist options
  • Save fredknack/0c6690a068f811758a803f31d481e24c to your computer and use it in GitHub Desktop.
Save fredknack/0c6690a068f811758a803f31d481e24c to your computer and use it in GitHub Desktop.
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