private void ChangeAnimation(string name, bool play = true) { if (SpriteRenderer.Animation.Name != name) { if (play) { SpriteRenderer.Play(name); } else { SpriteRenderer.SetAnimation(name); SpriteRenderer.Stop(); } } }