-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathignorar este script.cs
52 lines (46 loc) · 1.45 KB
/
ignorar este script.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System.Collections;
using System.Collections.Generic;
using UnityEngine.SceneManagement;
using UnityEngine;
public class Coincls : MonoBehaviour
{
public static int coinsCount = 0;
public AudioClip coin;
private int niveles;
// Start is called before the first frame update
void Start()
{
//se cuentan las monedas
Coincls.coinsCount ++;
niveles = SceneManager.GetActiveScene().buildIndex + 1;
}
// Update is called once per frame
void Update()
{
}
//si se recolecta la moneda
public void OnDestroy()
{
// aScorce.PlayOneShot(coin);
Coincls.coinsCount --;
if (Coincls.coinsCount <= 0)
{
Debug.Log("el juego ha terminado, el andraca esta feliz");
GameObject timer = GameObject.Find("GameTimer");
Destroy(timer);
// GameObject[] fuegos = GameObject.FindGameObjectsWithTag("Fuego");
// foreach(GameObject fuego in fuegos) {
// fuego.GetComponent<ParticleSystem>().Play();
// }
SceneManager.LoadScene(niveles);
}
}
//metodo tocar moneda
void OnTriggerEnter(Collider playercollider){
Debug.Log("haz sido tocado por el andraca");
AudioSource.PlayClipAtPoint(coin, this.gameObject.transform.position);
if(playercollider.CompareTag("Player")) {
Destroy(gameObject);
}
}
}