Le premier me permet de vérifier que l'image est bien sur la bonne case(et il est fonctionnel) :
Code : Tout sélectionner
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Validation1Objet : MonoBehaviour {
public string name;
public bool OnTriggerStay2D(Collider2D other)
{
if (other.name == name)
{
Debug.Log("objet détécté");
return(true);
}
else {
return(false);
}
}
}
Code : Tout sélectionner
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class VérificationValider : MonoBehaviour {
private int c;
public int nombreCase;
private Validation1Objet[] liste;
void Start() {
liste=FindObjectsOfType<Validation1Objet>();
}
public void LoadLevel(string LevelToLoad){
for(int i = 0; i < liste.Length; i++){
if (liste[i].OnTriggerStay2D()){
c++;
}
if (c==nombreCase){
SceneManager.LoadScene(LevelToLoad);
}
else{
SceneManager.LoadScene("FailScene");
}
}
}
}
J'aurais donc besoin de votre aide pour me débloquer parce que je ne vois pas comment me sortir de cette situation
Merci d'avance !