public void SetupWorldData() { CheckpointSystem.SetSpawnPosition(Vector2.zero); CollectableDisplay.savedScore = 0; GameplayData.currentWorld = worldID; PlayerHealth.ResetSavedHealth(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { Debug.Log("checkpoint caught at " + collision.transform.position); Collider2D collider2D = GetComponent <Collider2D>(); if (collider2D) { collider2D.enabled = false; } CheckpointSystem.SetSpawnPosition(transform.position + spawnOffset); CollectableDisplay.instance.SaveScore(); BonusCollectableManager.SaveCollectedStates(); } }
void Start() { playerPhaseManager = PlayerPhaseManager.instance; if (playerPhaseManager) { playerPhaseManager.gameManager = this; Vector2 spawnPosition = CheckpointSystem.GetSpawnPosition(); if (spawnPosition == Vector2.zero) { CheckpointSystem.SetSpawnPosition(playerPhaseManager.transform.position); } else { playerPhaseManager.transform.position = spawnPosition; } playerPhaseManager.StartCoroutine(playerPhaseManager.Spawn()); } }