Backup: two polaroids showing

This commit is contained in:
2018-04-12 00:20:25 +10:00
parent a13da880b1
commit c4b17b9e3b
59 changed files with 2111 additions and 396 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ public class GameController : MonoBehaviour {
Application.Quit ();
}
if (PersistentData.timer <= 0) {
if (PersistentData.timer <= 0 || Input.GetKeyDown("space")) {
SceneManager.LoadScene ("gameover");
}
+36
View File
@@ -6,6 +6,42 @@ using UnityEngine.SceneManagement;
public class GameOverController : MonoBehaviour {
public Text scoreText;
Dictionary<string, Sprite> spriteSet;
GameObject leftPage;
GameObject rightPage;
void Awake() {
spriteSet = new Dictionary<string, Sprite> ();
//prune "(clone)" from each monster name
HashSet<string> hs = new HashSet<string> ();
foreach(string str in PersistentData.monsterNames) {
hs.Add (str.Split ('(') [0]);
}
PersistentData.monsterNames = hs;
//load each image
foreach(string str in PersistentData.monsterNames) {
Sprite spr = Resources.Load ("photos/" + str, typeof(Sprite)) as Sprite;
spriteSet.Add (str, spr);
}
//configure the page objects
leftPage = new GameObject ();
rightPage = new GameObject ();
leftPage.AddComponent<SpriteRenderer> ();
rightPage.AddComponent<SpriteRenderer> ();
leftPage.transform.localScale = new Vector3 (0.5f, 0.5f, 1f);
leftPage.transform.position = new Vector3 (-5f, 0, 0);
rightPage.transform.localScale = new Vector3 (0.5f, 0.5f, 1f);
rightPage.transform.position = new Vector3 (5f, 0, 0);
//test
leftPage.GetComponent<SpriteRenderer> ().sprite = spriteSet["Nessie"] as Sprite;
rightPage.GetComponent<SpriteRenderer> ().sprite = spriteSet["Nessie"] as Sprite;
}
void Update() {
if (Input.GetButtonDown ("Quit")) {
+1
View File
@@ -19,6 +19,7 @@ public class Monster : MonoBehaviour {
GameObject.Find ("SoundController").GetComponent<SoundController> ().PlaySnapShot ();
GameObject.Find ("Flash").GetComponent<Flash> ().StartFlash ();
PersistentData.score += value;
PersistentData.monsterNames.Add (gameObject.name);
Destroy (gameObject);
}
}
+5 -1
View File
@@ -1,4 +1,8 @@
public static class PersistentData {
using System.Collections.Generic;
public static class PersistentData {
public static int timer;
public static int score;
public static HashSet<string> monsterNames = new HashSet<string>();
}