mirror of
https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
synced 2024-12-18 21:44:51 +01:00
28 lines
583 B
C#
28 lines
583 B
C#
using UnityEngine;
|
|
|
|
public class PipeMoveScript : MonoBehaviour
|
|
{
|
|
public float moveSpeed = 2;
|
|
public float deadZone = -45;
|
|
public BirdScript bird;
|
|
|
|
public void Start()
|
|
{
|
|
bird = GameObject.FindGameObjectWithTag("Player").GetComponent<BirdScript>();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
if (!bird.isAlive)
|
|
{
|
|
return;
|
|
}
|
|
transform.position = transform.position + (Time.deltaTime * moveSpeed * Vector3.left);
|
|
|
|
if (transform.position.x < deadZone)
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|