0
我可以翻轉游戲對象,但我的問題是它在攻擊動畫開始之前翻轉。我不知道如何整理這個。希望有人能幫助。unity 5:按特定順序翻轉一個遊戲對象
// Update is called once per frame
void Update() {
if(Input.GetKeyDown(KeyCode.Space))
{
GetComponent<Rigidbody2D>().velocity = new Vector2(4f, 0);
StartCoroutine(enemyReturn());
}
}
IEnumerator enemyReturn()
{
yield return new WaitForSeconds(1.1f);
GetComponent<Animator>().SetTrigger("slimeMelee"); //attack animation
GetComponent<Rigidbody2D>().velocity = new Vector2(0, 0);
Vector3 theScale = transform.localScale; theScale.x *= -1;
transform.localScale = theScale;
}
感謝您的幫助 –