added game end screen

also! the new singleton system doesn't work! returning to the main menu creates a second instance of everything, @nick can you fix this please
This commit is contained in:
Sam
2023-05-04 21:17:36 -07:00
parent 06ae0ab9c2
commit a164f3130f
6 changed files with 1077 additions and 14 deletions

View File

@@ -17,6 +17,9 @@ public class DialogBoxes : MonoBehaviour
[SerializeField] Image backgroundImageObject;
[SerializeField] Sprite[] images;
[Header("Buttons:")]
[SerializeField] GameObject backToMenuButton;
// Start is called before the first frame update
void Start()
@@ -37,7 +40,11 @@ public class DialogBoxes : MonoBehaviour
}
else
{ // no more dialog messages, advance the scene
SceneController.Instance.NextScene();
if (backToMenuButton != null) {
backToMenuButton.SetActive(true);
} else {
SceneController.Instance.NextScene();
}
}
}

View File

@@ -33,6 +33,15 @@ public class SceneController : MonoBehaviour
{ // if this is the menu
GameObject.Find("NewGameButton").GetComponent<Button>().onClick.AddListener(NextScene);
}
// if this is the last scene
if (scene.buildIndex == (SceneManager.sceneCountInBuildSettings - 1)) {
GameObject backToMenuButton = GameObject.Find("BackToMenuButton");
if (backToMenuButton != null) {
backToMenuButton.GetComponent<Button>().onClick.AddListener(delegate{LoadChosenScene(0);});
backToMenuButton.SetActive(false);
}
}
}
public void NextScene()