if( transform.position.x > -15 && transform.rotation.y == 0 ) { //小鳥X軸反方向移動速度 transform.position += new Vector3(-0.1f,0,0); } else { //小鳥Y軸旋轉,相當於人的轉身 ...
if( transform.position.x > -15 && transform.rotation.y == 0 )
{
//小鳥X軸反方向移動速度
transform.position += new Vector3(-0.1f,0,0);
}
else
{
//小鳥Y軸旋轉,相當於人的轉身
transform.localEulerAngles = new Vector3(0,180,0);
}
if(transform.position.x < 15 && transform.rotation.y != 0)
{
//小鳥X軸正方向移動速度
transform.position += new Vector3(0.1f,0,0);
}
else
{
//小鳥Y軸恢復旋轉,
transform.localEulerAngles = new Vector3(0,0,0);
}