private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Teleporter")) { Teleporter teleInfo = collision.gameObject.GetComponent <Teleporter>(); TimeLoopController.Teleport(teleInfo.targetScene, teleInfo.spawnX); } }
void Awake() { if (instance != null) { Destroy(gameObject); return; } instance = this; DontDestroyOnLoad(gameObject); instance.player = GameObject.FindGameObjectWithTag("Player"); instance.CalculateZone(SceneManager.GetActiveScene().name); // manually add states to list of states instance.SMs.Add(instance.TreeSM); // make sure the starting states are set foreach (BaseSM SM in instance.SMs) { SM.Reset(); } }