mirror of
https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
synced 2024-12-18 21:44:51 +01:00
29 lines
570 B
C#
29 lines
570 B
C#
|
using UnityEngine;
|
||
|
|
||
|
public class BirdScript : MonoBehaviour
|
||
|
{
|
||
|
public float flapStrength = 7;
|
||
|
public bool isAlive = true;
|
||
|
public Rigidbody2D rigidBody;
|
||
|
public LogicManagerScript logicManager;
|
||
|
|
||
|
public void Update()
|
||
|
{
|
||
|
if (!isAlive)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (Input.GetKeyDown(KeyCode.Space))
|
||
|
{
|
||
|
rigidBody.linearVelocity = Vector2.up * flapStrength;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void OnCollisionEnter2D(Collision2D collision)
|
||
|
{
|
||
|
logicManager.GameOver();
|
||
|
isAlive = false;
|
||
|
}
|
||
|
}
|