unity3D问题
主要看最后一段varspeed1:float=3;varspeed2:float=3;varprojectileLeft:Rigidbody;varprojectileR...
主要看最后一段
var speed1:float=3;
var speed2:float=3;
var projectileLeft:Rigidbody;
var projectileRight:Rigidbody;
var pos:Transform;
var shipSound:AudioClip;
private var ToRotate1:float=0;
private var ToRotate2:float=0;
static var isMoving=true;
private var myProjectile:Rigidbody;
static var isPlaying=true;
private var rotation=true;
function Start()
{
ToRotate1=speed1;
ToRotate2=speed2;
}
function UpDate()
{
if(name=="turret" && isMoving)
{
var aniPlay=GetComponent("aniSprite");
if(isPlaying)
{
isPlaying=aniPlay.aniSprite(10,7,0,4,26,10,2.6,true);
}
else
{
isPlaying=aniPlay.aniSprite(10,7,0,4,26,10,2.6,false);
}
}
if(name=="Cube" && isMoving)
{
if(rotation||isPlaying)
transform.localEulerAngles.z+=ToRotate1;
else
transform.localEulerAngles.z+=ToRotate2;
if(transform.localEulerAngles.z>=160)
rotation=false;
if(transform.localEulerAngles.z<=20)
rotation=false;
}
}
这段代码的最后我想实现Cube的旋转的。。。可是不行,求高手 展开
var speed1:float=3;
var speed2:float=3;
var projectileLeft:Rigidbody;
var projectileRight:Rigidbody;
var pos:Transform;
var shipSound:AudioClip;
private var ToRotate1:float=0;
private var ToRotate2:float=0;
static var isMoving=true;
private var myProjectile:Rigidbody;
static var isPlaying=true;
private var rotation=true;
function Start()
{
ToRotate1=speed1;
ToRotate2=speed2;
}
function UpDate()
{
if(name=="turret" && isMoving)
{
var aniPlay=GetComponent("aniSprite");
if(isPlaying)
{
isPlaying=aniPlay.aniSprite(10,7,0,4,26,10,2.6,true);
}
else
{
isPlaying=aniPlay.aniSprite(10,7,0,4,26,10,2.6,false);
}
}
if(name=="Cube" && isMoving)
{
if(rotation||isPlaying)
transform.localEulerAngles.z+=ToRotate1;
else
transform.localEulerAngles.z+=ToRotate2;
if(transform.localEulerAngles.z>=160)
rotation=false;
if(transform.localEulerAngles.z<=20)
rotation=false;
}
}
这段代码的最后我想实现Cube的旋转的。。。可是不行,求高手 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询