Added marixil's work, v1.1

This commit is contained in:
2018-04-13 10:40:35 +10:00
parent 28c6f8cac2
commit 35617b5bf0
33 changed files with 1630 additions and 13 deletions
+33
View File
@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Arrows : MonoBehaviour {
SpriteRenderer spriteRenderer;
void Awake() {
spriteRenderer = GetComponent<SpriteRenderer> ();
StartCoroutine (FadeCoroutine (0.01f));
}
IEnumerator FadeCoroutine(float period) {
float absolute = 1.0f;
float degree = -0.01f;
while(true) {
//wait
yield return new WaitForSeconds (period);
//fade routine
absolute += degree;
//fade
spriteRenderer.color = new Color (1, 1, 1, absolute);
if (absolute == 0f) {
Destroy (gameObject);
}
}
}
}
+13
View File
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 8afcae652a543cc43b32dac1312803f4
timeCreated: 1523573797
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+1 -1
View File
@@ -20,7 +20,7 @@ public class GameController : MonoBehaviour {
Application.Quit ();
}
if (PersistentData.timer <= 0 || Input.GetKeyDown("space")) {
if (PersistentData.timer <= 0) {
SceneManager.LoadScene ("gameover");
}
+1 -1
View File
@@ -81,7 +81,7 @@ public class GameOverController : MonoBehaviour {
if (open == false) {
scoreText.text = "Player's Score: " + PersistentData.score + "\n";
scoreText.text += "Camera Clicks: " + PersistentData.clicks + "\n";
scoreText.text += "Monsters Captured: " + PersistentData.monsterNames.Count + "/4";
scoreText.text += "Monsters Captured: " + PersistentData.monsterNames.Count + "/8";
} else {
scoreText.enabled = false;
creditText.enabled = false;
+23 -1
View File
@@ -13,9 +13,11 @@ public class Monster : MonoBehaviour {
}
Rigidbody2D rigidBody;
SpriteRenderer spriteRenderer;
void Awake() {
rigidBody = GetComponent<Rigidbody2D> ();
spriteRenderer = GetComponent<SpriteRenderer> ();
}
void OnMouseOver() {
@@ -36,6 +38,26 @@ public class Monster : MonoBehaviour {
IEnumerator DestroySelfAfter(float seconds) {
//clean up lost objects
yield return new WaitForSeconds (seconds);
Destroy (gameObject);
StartCoroutine (FadeCoroutine(0.01f));
}
IEnumerator FadeCoroutine(float period) {
float absolute = 1.0f;
float degree = -0.02f;
while(true) {
//wait
yield return new WaitForSeconds (period);
//fade routine
absolute += degree;
//fade
spriteRenderer.color = new Color (1, 1, 1, absolute);
if (absolute <= 0f) {
Destroy (gameObject);
}
}
}
}