Buenas, aquí yo otra vez.
Esta vez he tenido un pequeño problema, la script que adjuntaré a continuación según yo no tiene errores pero al presionar el botón "F" no sucede nada... he puesto un Print para comprobar si las instrucciones llegan a ese punto y nop, no detecta cuando presiono el botón, la verdad me he estado comiendo la cabeza por media hora y no entiendo por que no funciona, probablemente sea una tontería pero no lo veo...
Aparte si tienen consejos para no usar tantos "if" lo agradecería ya que no tengo idea de si hay otra forma.
Gracias de antemano
Esta vez he tenido un pequeño problema, la script que adjuntaré a continuación según yo no tiene errores pero al presionar el botón "F" no sucede nada... he puesto un Print para comprobar si las instrucciones llegan a ese punto y nop, no detecta cuando presiono el botón, la verdad me he estado comiendo la cabeza por media hora y no entiendo por que no funciona, probablemente sea una tontería pero no lo veo...
Aparte si tienen consejos para no usar tantos "if" lo agradecería ya que no tengo idea de si hay otra forma.
Gracias de antemano
public GameObject Text;
public GameObject Player;
public GameObject Illumination;
private bool ON = false;
private AudioSource Tuturu;
private GameObject Kill;
public GameObject Tuturu2;
// Start is called before the first frame update
void Start()
{
Illumination = GameObject.FindGameObjectWithTag("Lights");
Text = GameObject.FindGameObjectWithTag("Action");
Player = GameObject.FindGameObjectWithTag("Player");
Tuturu = GameObject.FindGameObjectWithTag("Sound").GetComponent<AudioSource>();
Kill = GameObject.FindGameObjectWithTag("MarkedForDelete");
Illumination.SetActive(false);
Text.SetActive(false);
}
void OnTriggerEnter(Collider Col)
{
if (ON == false)
{
if (Input.GetKeyDown(KeyCode.F))
{
print("Activated");
Tuturu.Play();
Illumination.SetActive(true);
ON = true;
Kill.SetActive(false);
Tuturu2.SetActive(false);
Destroy(this);
}
Text.SetActive(true);
}
}
void OnTriggerExit(Collider Col)
{
if (ON == false)
{
Text.SetActive(false);
}
}
}