我正在开发 Unity2 游戏,我想让 Boom 在iTween
动画结束时消失。
这是部分代码
void OnMouseDown() {
if (ChosePosition == false)
ChosePosition = true;
// make Star stop
else if (ChosePosition == true && ChoseForce == false) {
ChoseForce = true;
//Compute Force power
PowerDegree = Mathf.Abs (Star.transform.position.y - StarPosition)/ Mathf.Abs(StarendPosition - StarPosition) * 100;
//print (PowerDegree);
Vector3 NewBoomPostion = new Vector3 (Luncher.transform.position.x, BoomPosition, 85);
GameObject newBoom = Instantiate(Boom, NewBoomPostion , Quaternion.identity) as GameObject;
iTween.MoveTo (newBoom, iTween.Hash
("y",BoomPosition+((BoomendPosition-BoomPosition)/100*PowerDegree),
"speed",Boomspeed,
"EaseType",BoomeaseType,
"LoopType",BoomloopType,
"oncomplete","BoomComplete"
));
CarrierReset = true;
ChosePosition = false;
ChoseForce = false;
//After Shot, Luncher will move
iTween.Resume(Luncher);
//After Shot, Luncher Carrier will display
displayCarrierOrNot = true;
}
}
void BoomComplete(){
print("complete");
}
但我在控制台中看不到“完成”。