using UnityEngine;
using System.Collections;
public class LouTi : MonoBehaviour {
public GameObject cube;
private float angle = 15;
// Use this for initialization
void Start () {
for (int i = 0; i < 30; i++)
{
float hudu = (angle / 180) * Mathf.PI;
GameObject ccc = (GameObject)Instantiate(cube);
if (i<10)
{
ccc.transform.position = new Vector3(-10 + i, (-10 + i)*Mathf.Tan(hudu), 0);
}
else if (i>=10&&i<=21)
{
ccc.transform.position = new Vector3(-10 + i, -(-10 + i) * Mathf.Tan(hudu), 0);
}
else
{
ccc.transform.position = new Vector3(-10 + i, -(-10 + 21) * Mathf.Tan(hudu), 0);
}
}
}
// Update is called once per frame
void Update () {
}
}
unity C#生成楼梯
猜你喜欢
转载自blog.csdn.net/hemiaoyuan1989/article/details/52712933
今日推荐
周排行