Update CollectCoins

This commit is contained in:
xixu-me committed 2025-03-21 10:33:21 +08:00
1 parent d6fc1f2857
commit aef8e2238b
51 files changed
+146 -11

No files matched your search

Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
fileFormatVersion: 2
guid: c20ecbe605d9f3749b6ecbf811cb2d80
guid: b48fc750d71b8134397184c342c2bcc3
DefaultImporter:
userData:
@@ -4,6 +4,8 @@ using System.Collections;
public class CoinScript : MonoBehaviour {
public float rotationSpeed = 100.0f;
public GUIText coinGUIText;
void Start () {
}
@@ -19,6 +21,10 @@ public class CoinScript : MonoBehaviour {
{
collider.SendMessage("pickup");
Destroy(this.gameObject);
// 触发显示金币数量
coinGUIText.SendMessage("showTextHint", InventoryScript.coinCount.ToString());
// 显示左下角图片和数量
collider.SendMessage("showCoinCount");
}
}
}
@@ -5,6 +5,9 @@ public class InventoryScript : MonoBehaviour {
// Use this for initialization
public AudioClip pickupSound;
public static int coinCount = 0;
public GUIText coinCountText;
public GUITexture coinPic;
void Start () {
}
@@ -17,5 +20,16 @@ public class InventoryScript : MonoBehaviour {
void pickup()
{
AudioSource.PlayClipAtPoint(pickupSound, transform.position);
coinCount++;
}
void showCoinCount()
{
if (!coinPic.enabled)
{
coinPic.enabled = true;
coinCountText.enabled = true;
}
coinCountText.text = coinCount.ToString();
}
}
@@ -0,0 +1,43 @@
using UnityEngine;
using System.Collections;
public class TextHintScript : MonoBehaviour {
// Use this for initialization
public int fontSizeAddSpeed = 1;
public float maxShowTime = 3.0f;
float timer = 0.0f;
public int maxfontSize = 100;
void Start () {
}
// Update is called once per frame
void Update () {
if (guiText.enabled)
{
timer += Time.deltaTime;
if (guiText.fontSize < maxfontSize)
{
guiText.fontSize += fontSizeAddSpeed;
}
if (timer > maxShowTime)
{
guiText.enabled = false;
timer = 0.0f;
}
}
}
void showTextHint (string text)
{
if (!guiText.enabled)
{
guiText.enabled = true;
}
guiText.text = text;
timer = 0.0f;
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6016e4bf32bdd7b4b825e06965ff6377
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
+5
View File
@@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: a1286d80d540b4b4fa5d938e3ffa0b9a
folderAsset: yes
DefaultImporter:
userData:
Binary file not shown.
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 647fbd98c5dd8cf449638baf77c5e6a6
AudioImporter:
serializedVersion: 4
format: 0
quality: .5
stream: 1
3D: 0
forceToMono: 0
useHardware: 0
loopable: 0
userData:
+1 -1
View File
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 55adb4081c6b94041b66dc5e93a86e86
guid: eee839e72b48e45438c2082ae812dffa
folderAsset: yes
DefaultImporter:
userData:
+8 -8
View File
@@ -1,12 +1,12 @@
fileFormatVersion: 2
guid: 8abe8fe8c5ddaa74d8ee10ec2e8dbcd2
guid: 7b2341efd84de524f8d8b9e39fdb56f4
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
@@ -25,10 +25,10 @@ TextureImporter:
maxTextureSize: 1024
textureSettings:
filterMode: -1
aniso: -1
aniso: 1
mipBias: -1
wrapMode: -1
nPOTScale: 1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
@@ -38,8 +38,8 @@ TextureImporter:
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
alphaIsTransparency: 1
textureType: 2
buildTargetSettings: []
spriteSheet:
sprites: []
Binary file not shown.

After

Width:  |  Height:  |  Size: 700 KiB

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 19960adcad453c44ca2f85b09aed3c48
guid: cb6443244b408784c8b44a405040e801
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

@@ -0,0 +1,47 @@
fileFormatVersion: 2
guid: 87a6e6a1efb241b41b2f1ee9ee0d33dc
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 1024
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData: