using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BuildWall : Interactable {
GameObject Cube;//点击到的物体
public Transform ParentCube;//所有生成的物体的父级
GameObject[] SonCube;//子物体
public GameObject WAll;//实例化的模型
private float Speed = 5.0f;
Vector3 Lateposition;
Vector3 nowposition;
float y;
// Use this for initialization
void Start()
{
//SonCube = new GameObject[] { };
}
void Update()
{
if (Input.GetMouseButtonDown(0))//如何实例化一个Cube
{
GameObject wall = Instantiate(WAll , new Vector3(transform.position.x-5.0f, transform.position.y + 0.5f, transform.position.z), transform.rotation);
wall.transform.SetParent(ParentCube);
}
if (Input.GetMouseButton(1))//当鼠标按下右键的时候,如果点击到物体,那么改变点击到的该物体在Y轴上的值
{
Ray ray &#
using System.Collections.Generic;
using UnityEngine;
public class BuildWall : Interactable {
GameObject Cube;//点击到的物体
public Transform ParentCube;//所有生成的物体的父级
GameObject[] SonCube;//子物体
public GameObject WAll;//实例化的模型
private float Speed = 5.0f;
Vector3 Lateposition;
Vector3 nowposition;
float y;
// Use this for initialization
void Start()
{
//SonCube = new GameObject[] { };
}
void Update()
{
if (Input.GetMouseButtonDown(0))//如何实例化一个Cube
{
GameObject wall = Instantiate(WAll , new Vector3(transform.position.x-5.0f, transform.position.y + 0.5f, transform.position.z), transform.rotation);
wall.transform.SetParent(ParentCube);
}
if (Input.GetMouseButton(1))//当鼠标按下右键的时候,如果点击到物体,那么改变点击到的该物体在Y轴上的值
{
Ray ray &#