Update CollectCoins

This commit is contained in:
xixu-me committed 2025-03-27 09:04:59 +08:00
1 parent 31f39cfa92
commit cbf94c4b2e
55 files changed
+271 -20

No files matched your search

@@ -30,7 +30,14 @@ ModelImporter:
4300004: target_support_1
4300006: target_support_2
4300008: target
7400008: Take 001
6400000: target
6400002: target_base
6400004: target_pivot
6400006: target_support_1
6400008: target_support_2
7400000: down
7400002: up
7400008: idle
7400010: idle
7400012: down
7400014: up
@@ -50,16 +57,130 @@ ModelImporter:
animationScaleError: .5
animationWrapMode: 0
extraExposedTransformPaths: []
clipAnimations: []
clipAnimations:
- serializedVersion: 16
name: idle
takeName: Take 001
firstFrame: 1
lastFrame: 2
wrapMode: 0
orientationOffsetY: 0
level: 0
cycleOffset: 0
loop: 0
loopTime: 0
loopBlend: 0
loopBlendOrientation: 0
loopBlendPositionY: 0
loopBlendPositionXZ: 0
keepOriginalOrientation: 0
keepOriginalPositionY: 1
keepOriginalPositionXZ: 0
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events: []
transformMask:
- path:
weight: 1
- path: target_base
weight: 1
- path: target_pivot
weight: 1
- path: target_pivot/target
weight: 1
- path: target_pivot/target_support_1
weight: 1
- path: target_pivot/target_support_2
weight: 1
maskType: 0
maskSource: {instanceID: 0}
- serializedVersion: 16
name: down
takeName: Take 001
firstFrame: 3
lastFrame: 13
wrapMode: 0
orientationOffsetY: 0
level: 0
cycleOffset: 0
loop: 0
loopTime: 0
loopBlend: 0
loopBlendOrientation: 0
loopBlendPositionY: 0
loopBlendPositionXZ: 0
keepOriginalOrientation: 0
keepOriginalPositionY: 1
keepOriginalPositionXZ: 0
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events: []
transformMask:
- path:
weight: 1
- path: target_base
weight: 1
- path: target_pivot
weight: 1
- path: target_pivot/target
weight: 1
- path: target_pivot/target_support_1
weight: 1
- path: target_pivot/target_support_2
weight: 1
maskType: 0
maskSource: {instanceID: 0}
- serializedVersion: 16
name: up
takeName: Take 001
firstFrame: 14
lastFrame: 35
wrapMode: 0
orientationOffsetY: 0
level: 0
cycleOffset: 0
loop: 0
loopTime: 0
loopBlend: 0
loopBlendOrientation: 0
loopBlendPositionY: 0
loopBlendPositionXZ: 0
keepOriginalOrientation: 0
keepOriginalPositionY: 1
keepOriginalPositionXZ: 0
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events: []
transformMask:
- path:
weight: 1
- path: target_base
weight: 1
- path: target_pivot
weight: 1
- path: target_pivot/target
weight: 1
- path: target_pivot/target_support_1
weight: 1
- path: target_pivot/target_support_2
weight: 1
maskType: 0
maskSource: {instanceID: 0}
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: .100000001
globalScale: 1
meshCompression: 0
addColliders: 0
addColliders: 1
importBlendShapes: 1
swapUVChannels: 0
generateSecondaryUV: 0
generateSecondaryUV: 1
useFileUnits: 1
optimizeMeshForGPU: 1
weldVertices: 1
@@ -3,9 +3,9 @@ guid: 7dfba132a836245348115b63f7f62cc8
AudioImporter:
serializedVersion: 4
format: -1
quality: -1
quality: .5
stream: 1
3D: 1
3D: 0
forceToMono: 0
useHardware: 0
loopable: 0
Binary file not shown.
@@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 59d4ed038bcc5d542825bb3af2938415
NativeFormatImporter:
userData:
+5
View File
@@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 882e422be7ae838448968b2716173d61
folderAsset: yes
DefaultImporter:
userData:
Binary file not shown.
@@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 7a457c78af84eb24a91fdb44e92eab07
NativeFormatImporter:
userData:
Binary file not shown.
@@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 302c9538237f1ef41aec5e01ca509096
NativeFormatImporter:
userData:
Binary file not shown.
@@ -0,0 +1,22 @@
using UnityEngine;
using System.Collections;
public class BulletScript : MonoBehaviour {
public float bulletLifeTime = 10.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
StartCoroutine("bulletDestory");
}
IEnumerator bulletDestory()
{
yield return new WaitForSeconds(bulletLifeTime);
Destroy(this.gameObject);
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3daa496789f758649bff1ddc7477054f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
+4 -9
View File
@@ -4,27 +4,22 @@ using System.Collections;
public class CoinScript : MonoBehaviour {
public float rotationSpeed = 100.0f;
public GUIText coinGUIText;
GameObject player;
void Start () {
player = GameObject.Find("First Person Controller");
}
// Update is called once per frame
void Update () {
transform.Rotate(0, 0, rotationSpeed * Time.deltaTime);
}
void OnTriggerEnter(Collider collider)
{
if (collider.gameObject.tag == "Player")
if (collider.gameObject.tag == "Player" || collider.gameObject.tag == "Bullet")
{
collider.SendMessage("pickup");
player.SendMessage("pickup");
Destroy(this.gameObject);
// 触发显示金币数量
coinGUIText.SendMessage("showTextHint", InventoryScript.coinCount.ToString());
// 显示左下角图片和数量
collider.SendMessage("showCoinCount");
}
}
}
@@ -8,7 +8,9 @@ public class InventoryScript : MonoBehaviour {
public static int coinCount = 0;
public GUIText coinCountText;
public GUITexture coinPic;
void Start () {
public GUIText coinGUIText;
void Start () {
}
@@ -21,7 +23,12 @@ public class InventoryScript : MonoBehaviour {
{
AudioSource.PlayClipAtPoint(pickupSound, transform.position);
coinCount++;
}
// 触发显示金币数量
coinGUIText.SendMessage("showTextHint", coinCount.ToString());
// 显示左下角图片和数量
showCoinCount();
}
void showCoinCount()
{
+25
View File
@@ -0,0 +1,25 @@
using UnityEngine;
using System.Collections;
public class ShotScript : MonoBehaviour {
public Rigidbody bullet;
public float force = 1000f;
public AudioClip fireSound;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
// 检测鼠标左键单击
if (Input.GetButtonDown("Fire1"))
{
Rigidbody b = Instantiate(bullet, transform.position, transform.rotation) as Rigidbody;
b.AddForce(transform.forward * force);
AudioSource.PlayClipAtPoint(fireSound, transform.position);
}
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ec7048a451bc8704a9a8361e70281af8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,40 @@
using UnityEngine;
using System.Collections;
public class TargetScript : MonoBehaviour {
bool beenDown = false;
Animation targetRoot;
public float recoveryTime = 5.0f;
GameObject player;
void Start () {
targetRoot = transform.parent.transform.parent.animation;
player = GameObject.Find("First Person Controller");
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter(Collision collision)
{
if (!beenDown && collision.gameObject.tag == "Bullet")
{
StartCoroutine("targetHit");
player.SendMessage("pickup");
}
}
IEnumerator targetHit()
{
targetRoot.Play("down");
beenDown = true;
yield return new WaitForSeconds(recoveryTime);
targetRoot.Play("up");
beenDown = false;
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 64cf3671ca23b5b418bce84e3690cfe0
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
+1 -1
View File
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cb6443244b408784c8b44a405040e801
guid: d6838a96f476abb48aa63cc7be70b903
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 87a6e6a1efb241b41b2f1ee9ee0d33dc
guid: 4ea3711fbc2e59540b9481579820840e
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.