init
This commit is contained in:
commit
3b4c6e0ec6
506 changed files with 434142 additions and 0 deletions
30
Assets/Scripts/CoinController.cs
Normal file
30
Assets/Scripts/CoinController.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CoinController : MonoBehaviour{
|
||||
|
||||
GameController gameController;
|
||||
[SerializeField] GameObject child = default;
|
||||
|
||||
void Awake(){
|
||||
gameController = FindObjectOfType<GameController>();
|
||||
}
|
||||
|
||||
void OnTriggerEnter(Collider col){
|
||||
if (col.CompareTag("Player") || col.CompareTag("Explosion")){
|
||||
GetComponent<SphereCollider>().enabled = false;
|
||||
gameController.PlayButtonScale();
|
||||
gameController.numberOfCoins--;
|
||||
child.SetActive(true);
|
||||
GameOverCanvas.instance.tilesEnabled++;
|
||||
ObjectPooler.instance.SpawnFromPool("Light", new Vector3(transform.position.x, 0, transform.position.z), Quaternion.identity);
|
||||
}
|
||||
}
|
||||
|
||||
public void Disable(){
|
||||
if(GetComponent<SphereCollider>().enabled == true){
|
||||
child.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue