Add win condition and related assets

Introduced new animations, prefabs, scripts, and textures to implement a win condition in the game. Updated InventoryScript to trigger the win state when the required coin count is reached. Added supporting assets such as win animations, GUI elements, and sound effects.
This commit is contained in:
xixu-me committed 2025-04-18 20:43:43 +08:00
1 parent d8731c1c23
commit e22c5cbada
68 files changed
+246 -8

No files matched your search

@@ -0,0 +1,22 @@
using UnityEngine;
using System.Collections;
public class FaderScript : MonoBehaviour {
public GUITexture loadingGUI;
void Start () {
Rect rect = new Rect (-Screen.width * 0.5f, -Screen.height * 0.5f, Screen.width, Screen.height);
guiTexture.pixelInset = rect;
}
// Update is called once per frame
void Update () {
}
void showLoading()
{
Instantiate(loadingGUI);
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 841fd8951c5763843aa606c0c59d2858
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -10,6 +10,8 @@ public class InventoryScript : MonoBehaviour {
public GUITexture coinPic;
public GUIText coinGUIText;
public int winCoinCount = 20;
public GameObject winObj;
void Start () {
}
@@ -28,6 +30,13 @@ public class InventoryScript : MonoBehaviour {
coinGUIText.SendMessage("showTextHint", coinCount.ToString());
// 显示左下角图片和数量
showCoinCount();
if (coinCount == winCoinCount)
{
this.gameObject.GetComponent<CharacterController>().enabled = false;
this.gameObject.GetComponentInChildren<ShotScript>().enabled = false;
winObj.SendMessage("gameOver");
}
}
void showCoinCount()
@@ -0,0 +1,21 @@
using UnityEngine;
using System.Collections;
public class ReloadScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void loadMenu()
{
Application.LoadLevel("menu");
InventoryScript.coinCount = 0;
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f3f77b8ab57b664448223c1889af8c8d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
+27
View File
@@ -0,0 +1,27 @@
using UnityEngine;
using System.Collections;
public class WinScript : MonoBehaviour {
public GUITexture winGUI;
public AudioClip winSound;
public GUITexture fader;
void Start () {
}
// Update is called once per frame
void Update () {
}
IEnumerator gameOver()
{
AudioSource.PlayClipAtPoint(winSound, transform.position, 0.1f);
Instantiate(winGUI);
yield return new WaitForSeconds(5.0f);
Instantiate(fader);
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0f163043d74be374e9a297bb4917dcad
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: