Bird Cs
Bird Cs
void Start()
{
crashed = false;
gameAudio.Play();
body = GetComponent<Rigidbody2D>();
body.velocity = Vector2.right * speed;
GetAudioPreferences();
}
void Update()
{
GetPlayerInput();
RotateBird();
gameAudio.volume = appVolume;
hitAudio.volume = appVolume;
}
}
private void GetPlayerInput()
{
if (Input.touchCount > 0)
{
Touch touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Began)
{
ImpulseBird();
}
}
else if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0))
{
ImpulseBird();
}
}