所以我的角色/玩家变得很大但几秒钟之后似乎没有恢复到原来的大小。
cross_val_predict
答案 0 :(得分:1)
您需要在持续时间用完后重置大小。
我在这里添加了两行,一行将旧的localScale存储到origScale
,第二行将localScale重置为origScale
private IEnumerator Pickup(Collider2D player)
{
var origScale = this.transform.localScale;
flag = true;
GameObject ps = (GameObject )Instantiate(pickupEffect, transform.position, transform.rotation);
Destroy(ps,0.2f);
player.transform.localScale *= multiplier;
GetComponent<SpriteRenderer>().enabled = false;
GetComponent<Collider2D>().enabled = false;
yield return new WaitForSeconds(duration);
this.transform.localScale = origScale;
}