Update Unity project scene and library files

This commit is contained in:
xixu-me committed 2025-02-21 11:01:15 +08:00
1 parent 93037de7af
commit 69627cbb57
22 files changed
+81

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
using UnityEngine;
using System.Collections;
public class Bullet : MonoBehaviour {
// Use this for initialization
void Start () {
Debug.Log ("Bullet: Start");
Destroy (this.gameObject, 3f);
}
// Update is called once per frame
void Update () {
}
}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bca87aeabdbd60d4d9f4d94238dae49d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
+30
View File
@@ -0,0 +1,30 @@
using UnityEngine;
using System.Collections;
public class Shooter : MonoBehaviour {
public Rigidbody bullet;
public float power = 1500f;
public float moveSpeed = 2f;
// Use this for initialization
void Start () {
Debug.Log ("Shooter: Start");
}
// Update is called once per frame
void Update () {
float h = Input.GetAxis ("Horizontal") * Time.deltaTime * moveSpeed;
float v = Input.GetAxis ("Vertical") * Time.deltaTime * moveSpeed;
this.transform.Translate (h, v, 0);
if (Input.GetButtonUp ("Fire1")) {
Rigidbody instance = Instantiate (bullet,
this.transform.position,
this.transform.rotation) as Rigidbody;
Vector3 forward = this.transform.TransformDirection(
Vector3.forward);
instance.AddForce (forward * power);
}
}
}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c6933e64aef5b994aab3afe2800dd5d4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: