You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
826 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Build : MonoBehaviour
{
// Start is called before the first frame update
public GameObject cube; // ½ÓÊÕÔ¤ÉèÌå
public GameObject bullet; //
public int speed = 1000;
void Start()
{
for(int x = 10; x < 20; x++)
{
for(int y=0; y<10; y++)
{
Instantiate(cube, new Vector3(x, y+0.5f, 15), new Quaternion()); // Ô¤ÉèÌå³õʼ»¯Óï¾ä
}
}
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
{
GameObject b = Instantiate(bullet, transform.position, new Quaternion());
b.GetComponent<Rigidbody>().AddForce(new Vector3(0, 0, 1) * speed);
}
}
}