test commit
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class CollectGamemode : MonoBehaviour
|
||||
{
|
||||
public static CollectGamemode Instance;
|
||||
|
||||
public AudioSource CollectSound;
|
||||
|
||||
public List<Custard> Custards { get; private set; } = new();
|
||||
|
||||
public int CustardAmount { get; private set; }
|
||||
public int CollectedCustard { get; private set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
Custards = FindObjectsByType<Custard>().ToList();
|
||||
CustardAmount = Custards.Count;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
PopUps.Create($"COLLECT ALL 10\nTELETUBBY CUSTARDS");
|
||||
}
|
||||
|
||||
public void CollectCustard(Custard custard)
|
||||
{
|
||||
bool removed = Custards.Remove(custard);
|
||||
if (removed)
|
||||
{
|
||||
if (TinkyWinky.Instance)
|
||||
TinkyWinky.Instance.recentlyCollectedCustard = custard.transform.position;
|
||||
|
||||
Destroy(custard.gameObject);
|
||||
CollectedCustard++;
|
||||
|
||||
if (CollectSound)
|
||||
CollectSound.Play();
|
||||
|
||||
if (CollectedCustard >= CustardAmount)
|
||||
SceneManager.LoadScene("Orientation"); // PLACEHOLDER
|
||||
|
||||
PopUps.Create($"{CollectedCustard}/{CustardAmount}\nCUSTARDS COLLECTED");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user