2024-02-08 03:30:36 -06:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
2024-02-08 19:15:28 -06:00
|
|
|
using UnityEngine.SceneManagement;
|
2024-02-08 03:30:36 -06:00
|
|
|
|
|
|
|
public class Apple : MonoBehaviour
|
|
|
|
{
|
|
|
|
[Header("Set in Inspector")]
|
|
|
|
public static float bottomY = -20f;
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
if (transform.position.y < bottomY) {
|
|
|
|
Destroy(this.gameObject);
|
2024-02-08 19:15:28 -06:00
|
|
|
if (SceneManager.GetActiveScene().name == "_Scene_2") { return; }
|
2024-02-08 03:30:36 -06:00
|
|
|
// Get a reference to the ApplePicker component of Main Camera
|
|
|
|
ApplePicker apScript = Camera.main.GetComponent<ApplePicker>();
|
|
|
|
// Call the public AppleDestroyed() method of apScript
|
|
|
|
apScript.AppleDestroyed();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|