unity3d C# 关于随机点产生随机物体问题.void Start () {p1 = new Vector3 (-2.5f,0.8f,-0.01f);p2 = new Vector3 (-2.5f,0.4f,-0.01f);p3 = new Vector3 (-2.5f,-0f,-0.01f);p4 = new Vector3 (-2.5f,-0.4f,-0.01f);p5 = new Vector3 (-2.5f,-0.8f,-0.01f

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 17:54:58
unity3dC#关于随机点产生随机物体问题.voidStart(){p1=newVector3(-2.5f,0.8f,-0.01f);p2=newVector3(-2.5f,0.4f,-0.01f)

unity3d C# 关于随机点产生随机物体问题.void Start () {p1 = new Vector3 (-2.5f,0.8f,-0.01f);p2 = new Vector3 (-2.5f,0.4f,-0.01f);p3 = new Vector3 (-2.5f,-0f,-0.01f);p4 = new Vector3 (-2.5f,-0.4f,-0.01f);p5 = new Vector3 (-2.5f,-0.8f,-0.01f
unity3d C# 关于随机点产生随机物体问题.
void Start () {
p1 = new Vector3 (-2.5f,0.8f,-0.01f);
p2 = new Vector3 (-2.5f,0.4f,-0.01f);
p3 = new Vector3 (-2.5f,-0f,-0.01f);
p4 = new Vector3 (-2.5f,-0.4f,-0.01f);
p5 = new Vector3 (-2.5f,-0.8f,-0.01f);
p6 = new Vector3 (2.5f,0.8f,-0.01f);
p7 = new Vector3 (2.5f,0.4f,-0.01f);
p8 = new Vector3 (2.5f,0f,-0.01f);
p9 = new Vector3 (2.5f,-0.4f,-0.01f);
p10 = new Vector3 (2.5f,-0.8f,-0.01f);
}
void Update () {
i = Random.Range(1,6);
AddDians();
CreateFish();
CreateFish2();
CreateFish3();
CreateFish4();
CreateFish5();
void CreateFish(){
if(i == 1){
GameObject yu = (GameObject) Instantiate(_yu[Random.Range(0,5)],_point[Random.Range(0,5)],Quaternion.identity);
GameObject yu2 = (GameObject)Instantiate(_yu[Random.Range(6,_yu.Count)],_point[Random.Range(6,_point.Count)],Quaternion.identity);
iTween.MoveTo(yu,iTween.Hash("x",2.5,"time",4,"EaseType","Linear"));
iTween.MoveTo(yu2,iTween.Hash("x",-2.5,"time",4,"EaseType","Linear"));
}
}
void CreateFish2(){
if(i == 2){
GameObject yu = (GameObject)Instantiate(_yu[Random.Range(0,5)],_point[Random.Range(0,5)],Quaternion.identity);
GameObject yu2 = (GameObject)Instantiate(_yu[Random.Range(6,_yu.Count)],_point[Random.Range(6,_point.Count)],Quaternion.identity);
iTween.MoveTo(yu,iTween.Hash("x",2.5,"time",4,"EaseType","Linear"));
iTween.MoveTo(yu2,iTween.Hash("x",-2.5,"time",4,"EaseType","Linear"));
}
}
void CreateFish3(){
if(i == 3){
GameObject yu = (GameObject)Instantiate(_yu[Random.Range(0,5)],_point[Random.Range(0,5)],Quaternion.identity);
GameObject yu2 = (GameObject)Instantiate(_yu[Random.Range(6,_yu.Count)],_point[Random.Range(6,_point.Count)],Quaternion.identity);
iTween.MoveTo(yu,iTween.Hash("x",2.5,"time",4,"EaseType","Linear"));
iTween.MoveTo(yu2,iTween.Hash("x",-2.5,"time",4,"EaseType","Linear"));
curTime = 0;
}
}
void CreateFish4(){
if(i == 4){
GameObject yu = (GameObject)Instantiate(_yu[Random.Range(0,5)],_point[Random.Range(0,5)],Quaternion.identity);
GameObject yu2 = (GameObject)Instantiate(_yu[Random.Range(6,_yu.Count)],_point[Random.Range(6,_point.Count)],Quaternion.identity);
iTween.MoveTo(yu,iTween.Hash("x",2.5,"time",4,"EaseType","Linear"));
iTween.MoveTo(yu2,iTween.Hash("x",-2.5,"time",4,"EaseType","Linear"));
}
}
void CreateFish5(){
if(i == 5){
GameObject yu = (GameObject)Instantiate(_yu[Random.Range(0,5)],_point[Random.Range(0,5)],Quaternion.identity);
GameObject yu2 = (GameObject)Instantiate(_yu[Random.Range(6,_yu.Count)],_point[Random.Range(6,_point.Count)],Quaternion.identity);
iTween.MoveTo(yu,iTween.Hash("x",2.5,"time",4,"EaseType","Linear"));
iTween.MoveTo(yu2,iTween.Hash("x",-2.5,"time",4,"EaseType","Linear"));
}
}
关于创建yu和yu2,是因为物体需要从两个方向过来,所以左面的物体从左面产生,右面的物体从右面产生.
现在的问题是,有一部分的物体从(0,0,0)产生.
而且物体是翻转的.

unity3d C# 关于随机点产生随机物体问题.void Start () {p1 = new Vector3 (-2.5f,0.8f,-0.01f);p2 = new Vector3 (-2.5f,0.4f,-0.01f);p3 = new Vector3 (-2.5f,-0f,-0.01f);p4 = new Vector3 (-2.5f,-0.4f,-0.01f);p5 = new Vector3 (-2.5f,-0.8f,-0.01f
为什么你提问了两个同样的问题...难道是为了再采纳我一次?- -!

unity3d C# 关于随机点产生随机物体问题.void Start () {p1 = new Vector3 (-2.5f,0.8f,-0.01f);p2 = new Vector3 (-2.5f,0.4f,-0.01f);p3 = new Vector3 (-2.5f,-0f,-0.01f);p4 = new Vector3 (-2.5f,-0.4f,-0.01f);p5 = new Vector3 (-2.5f,-0.8f,-0.01f C#中怎么随机产生5个整数 c#怎样生成 随机字母 C#里rand.Next(35)是什么意思呢?产生的是什么?我知道C#里random是产生随机函数,CreateRandomCode(4);是产生四位随机码 unity3d关于随机点产生物体的问题.public List_yu;public List_point;void Start () {p1 = new Vector3 (-2.5f,0.8f,-0.01f);p2 = new Vector3 (-2.5f,0.4f,-0.01f);p3 = new Vector3 (-2.5f,-0f,-0.01f);p4 = new Vector3 (-2.5f,-0.4f,-0.01f);p5 = new V C#如何产生在一定范围内的一组不同的随机整数?急…… 有关于随机事件 用matlab产生随机向量 c#怎么取随机数?比如我想从1-6中随机取一个数 最好简单点的 c#语言 生成0.1到0.9之间的随机数字 Unity3D 在地形上的物体怎么才能做到随机移动. unity3d中随机出现移动的物体类似于打飞机的敌机 unity3d 在一定范围内随机生成实例的demo最好是js demo C#语言怎样实现:随机产生50个数(1-1000),要求每行输出10个数,每数占6个字符并且左对齐显示. c#随机产生1~20之间的整数,总共生成1000次,统计其中生成的整数0,1,2,3,...…,20的个数分别是多少 随机产生序列是点的集合还是一个点的概率呢 matlab中怎么产生一个随机矩阵 matlab怎么产生随机复高斯数?如题