Add CollectCoins

This commit is contained in:
xixu-me committed 2025-04-11 12:42:37 +08:00
1 parent 15fe1e4ce1
commit d8731c1c23
91 files changed
+241 -38

No files matched your search

@@ -3,9 +3,9 @@ guid: 5ef113ab4bf224549ac9ba830450588d
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.
Binary file not shown.
@@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: bcc445ac71ae47b40833dde313b86586
DefaultImporter:
userData:
+11
View File
@@ -5,13 +5,24 @@ public class CoinScript : MonoBehaviour {
public float rotationSpeed = 100.0f;
GameObject player;
public float rotationCenterSpeed = 50f;
public Vector3 centerPosition;
private Color startColor;
public float colorChangeSpeed = 0.1f;
void Start () {
player = GameObject.Find("First Person Controller");
startColor = renderer.material.color;
}
void Update () {
transform.Rotate(0, 0, rotationSpeed * Time.deltaTime);
transform.RotateAround(centerPosition, Vector3.up, Time.deltaTime * rotationCenterSpeed);
float change = Mathf.PingPong(colorChangeSpeed * Time.time, 1f);
Color newColor = Color.Lerp(startColor, Color.red, change);
renderer.material.color = newColor;
}
void OnTriggerEnter(Collider collider)
@@ -0,0 +1,40 @@
using UnityEngine;
using System.Collections;
public class CoinSpawnerScript : MonoBehaviour {
public int maxCoinCount = 8;
public int minCoinCount = 4;
public GameObject coinPrefab;
public float radius = 3f;
public GameObject floor;
float floorLength;
float floorWidth;
// Use this for initialization
void Start () {
floorLength = floor.transform.localScale.x;
floorWidth = floor.transform.localScale.z;
}
// Update is called once per frame
void Update () {
if (!GameObject.FindGameObjectWithTag("Coin"))
{
int count = Random.Range(minCoinCount, maxCoinCount);
float x = Random.Range(-floorLength / 2, floorLength / 2);
float z = Random.Range(-floorWidth / 2, floorWidth / 2);
for (int i = 0;i < count; i++)
{
float angle = 2 * Mathf.PI / count * i;
Vector3 pos = new Vector3(Mathf.Cos(angle), 0, Mathf.Sin(angle)) * radius;
Vector3 center = new Vector3(x, 0, z) + transform.position;
GameObject coin = Instantiate(coinPrefab, center + pos, Quaternion.Euler(90, 0, 0)) as GameObject;
coin.transform.SetParent(transform);
coin.GetComponent<CoinScript>().centerPosition = center;
}
}
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8733077bd5267d04fb5b9a81d3c3ecf4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,47 @@
using UnityEngine;
using System.Collections;
[RequireComponent (typeof(AudioSource))]
public class MainMenuButtonScript : MonoBehaviour {
public string levelToLoad;
public Texture2D startTexture;
public Texture2D rollOverTexture;
public bool isPlayButton = false;
public bool isQuitButton = false;
public AudioClip beep;
void OnMouseEnter()
{
guiTexture.texture = rollOverTexture;
}
void OnMouseExit()
{
guiTexture.texture = startTexture;
}
IEnumerator OnMouseUp()
{
audio.PlayOneShot(beep);
yield return new WaitForSeconds(0.35f);
if (isQuitButton )
{
Application.Quit();
} else if (isPlayButton )
{
Application.LoadLevel(levelToLoad);
}
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4a5121dca6ee2a64ca0e83e04f06b702
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -27,6 +27,10 @@ public class TargetScript : MonoBehaviour {
}
}
/// <summary>
/// 击中靶子
/// </summary>
/// <returns></returns>
IEnumerator targetHit()
{
targetRoot.Play("down");
@@ -8,6 +8,7 @@ public class TextHintScript : MonoBehaviour {
public float maxShowTime = 3.0f;
float timer = 0.0f;
public int maxfontSize = 100;
public int startFontSize = 25;
void Start () {
@@ -26,6 +27,7 @@ public class TextHintScript : MonoBehaviour {
{
guiText.enabled = false;
timer = 0.0f;
guiText.fontSize = startFontSize;
}
}
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.
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 85cba2d465ac9ab4d8064e0b99aaa7dd
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e4ccbd406b9ee9a4dbf41adad9400abe
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -44,7 +44,6 @@ public class DoorManager : MonoBehaviour
audio.PlayOneShot(aClip);
doorIsOpen = openCheck;
transform.parent.animation.Play(animName);
}
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 80af9609c13cf5648aa46809aaec8e8c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 41ee0d51a80bc614cbc4c2fc637cb996
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 782d7955bf27e2244acf3aa18fa8d58e
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3ff7e1803b15b4f4c8c16b28071afc58
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e4996adab0d5ae548ae6ef51830da0f2
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e564b3f50537083478ebea99a84920c0
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 81348036fe326a44aabe9dd92dad9412
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ce0e2ee8905a73d4ca6006d8924194e6
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3ef851c593da8cd4d8fbf46996e72817
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 59dcc2d1f955c094fbee06fc38a0f423
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 749d278a94f759c4bb676c433e07044e
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
+5
View File
@@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 3c14468497622d842bad56bd53232ee0
folderAsset: yes
DefaultImporter:
userData:
+5
View File
@@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 2d39bf1702aad3d47a412c1166c2d8a4
folderAsset: yes
DefaultImporter:
userData:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -35
View File
@@ -1,37 +1,3 @@
Base path: D:/Unity/Editor/Data
Pipe name: \\.\pipe\UnityShaderCompiler-1-17116
Pipe name: \\.\pipe\UnityShaderCompiler-1-7160
Cmd: getPlatforms
Cmd: preprocess
insize=5140 outsize=2085 ok=1
Cmd: compileSnippet
api=4 type=0 insize=3359 outsize=2087 kw=WATER_REFRACTIVE ok=1
Cmd: compileSnippet
api=4 type=1 insize=3359 outsize=2875 kw=WATER_REFRACTIVE ok=1
Cmd: preprocess
insize=12913 outsize=2602 ok=1
Cmd: compileSnippet
api=4 type=0 insize=10220 outsize=5369 kw=WATER_VERTEX_DISPLACEMENT_ON WATER_EDGEBLEND_ON WATER_REFLECTIVE ok=1
Cmd: compileSnippet
api=4 type=1 insize=10220 outsize=5897 kw=WATER_VERTEX_DISPLACEMENT_ON WATER_EDGEBLEND_ON WATER_REFLECTIVE ok=1
Cmd: compileSnippet
api=4 type=0 insize=10224 outsize=4979 kw=WATER_VERTEX_DISPLACEMENT_ON WATER_EDGEBLEND_ON WATER_REFLECTIVE ok=1
Cmd: compileSnippet
api=4 type=1 insize=10224 outsize=4483 kw=WATER_VERTEX_DISPLACEMENT_ON WATER_EDGEBLEND_ON WATER_REFLECTIVE ok=1
Cmd: compileSnippet
api=4 type=0 insize=9966 outsize=1875 kw= ok=1
Cmd: compileSnippet
api=4 type=1 insize=9966 outsize=3070 kw= ok=1
Cmd: preprocess
insize=12080 outsize=2481 ok=1
Cmd: compileSnippet
api=4 type=0 insize=9506 outsize=5020 kw=WATER_VERTEX_DISPLACEMENT_ON WATER_EDGEBLEND_ON WATER_REFLECTIVE ok=1
Cmd: compileSnippet
api=4 type=1 insize=9506 outsize=5003 kw=WATER_VERTEX_DISPLACEMENT_ON WATER_EDGEBLEND_ON WATER_REFLECTIVE ok=1
Cmd: compileSnippet
api=4 type=0 insize=9510 outsize=4727 kw=WATER_VERTEX_DISPLACEMENT_ON WATER_EDGEBLEND_ON WATER_REFLECTIVE ok=1
Cmd: compileSnippet
api=4 type=1 insize=9510 outsize=4215 kw=WATER_VERTEX_DISPLACEMENT_ON WATER_EDGEBLEND_ON WATER_REFLECTIVE ok=1
Cmd: compileSnippet
api=4 type=0 insize=9252 outsize=1835 kw= ok=1
Cmd: compileSnippet
api=4 type=1 insize=9252 outsize=3070 kw= ok=1