using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraMove : MonoBehaviour
{
public GameObject bullet;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
private Rigidbody rd;
void Update()
{
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
this.transform.position += new Vector3(h, v, 0);
if (Input.GetMouseButtonDown(0))
{
GameObject bulletPrefabs = GameObject.Instantiate(bullet, transform.position, transform.rotation);
rd = bulletPrefabs.GetComponent<Rigidbody>();
//rd.AddForce(Vector3.forward*10000);
rd.velocity = Vector3.forward * 10;
}
}
}
CameraMove类 (控制相机移动及发射子弹)using System.Collections;using System.Collections.Generic;using UnityEngine;public class CameraMove : MonoBehaviour{ public GameObject bullet; // Start is called before the first frame update void Start() {