我正在 Unity 中制作 2D 横向滚动游戏,当玩家射击障碍物时,我希望播放障碍物动画然后自行摧毁。我让它自毁,但动画不会播放。有什么建议么?
protected Animation obsanim;
// Use this for initialization
void Start () {
obsanim = GetComponent<Animation> ();
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter2D(Collision2D col)
{
if (col.gameObject.tag == "circle")
{
obsanim.Play ("circobs");
Destroy (gameObject, 1.0f);
}
}
}
感谢您的任何帮助!