-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLvl9script.cs
68 lines (54 loc) · 1.78 KB
/
Lvl9script.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Lvl9script : MonoBehaviour
{
// Start is called before the first frame update
public GameObject jugador, sex, sex2, target;
bool activado = false;
GameObject pisa1, pisa2;
bool activado2 = false;
public AudioClip sfx;
public void Start() {
pisa1 = GameObject.FindGameObjectWithTag("pizza1");
pisa2 = GameObject.FindGameObjectWithTag("pizza2");
}
public void OnTriggerEnter(Collider other)
{
if(other.CompareTag("pizza1"))
{
sex.gameObject.SetActive(false);
other.gameObject.SetActive(false);
AudioSource.PlayClipAtPoint(sfx, this.gameObject.transform.position);
activado = true;
}
if(other.CompareTag("pizza2"))
{
sex2.gameObject.SetActive(false);
other.gameObject.SetActive(false);
AudioSource.PlayClipAtPoint(sfx, this.gameObject.transform.position);
activado2 = true;
}
if(other.CompareTag("Action"))
{
if(activado ==true && activado2 == true)
{
//CharacterController cc = jugador.GetComponent<CharacterController>();
//cc.enabled = false;
jugador.transform.position = target.transform.position;
//cc.enabled = true;
}
else
{
activado = false;
activado2 = false;
jugador.transform.position = target.transform.position;
sex2.gameObject.SetActive(true);
sex.gameObject.SetActive(true);
pisa1.gameObject.SetActive(true);
pisa2.gameObject.SetActive(true);
}
}
}
}