// Use this for initialization void Start() { tableauDistance = new List <TupleDistance>(); joueur = GameObject.Find("Lonk"); colliderJoueur = joueur.GetComponent <CapsuleCollider2D>(); //CubeIntObject cube = GameObjectFactory.creerCubeInt(5,new Vector3(11.5F,-6.8F,-3.5F) ); CubeIntObject cube1 = GameObjectFactory.creerCubeInt(1, new Vector3(-13.9F, -1.47F, -3.5F)); CubeIntObject cube2 = GameObjectFactory.creerCubeInt(2, new Vector3(-13.9F, -3.35F, -3.5F)); CubeIntObject cube3 = GameObjectFactory.creerCubeInt(3, new Vector3(-13.9F, -5.5F, -3.5F)); CubeIntObject cube4 = GameObjectFactory.creerCubeInt(4, new Vector3(-13.9F, -7.5F, -3.5F)); //Enigme e = new Enigme(1); //CubeEnigmeObject cubeE = GameObjectFactory.creerCubeEnigme(e, );*/ //GameObject.FindObjectOfType<CubeIntObject>(); foreach (GameObject go in GameObject.FindGameObjectsWithTag("Objet")) { if (go.GetComponent <CubeIntObject>() != null) { tableauDistance.Add(new TupleDistance(go, Vector3.Distance(go.transform.position, joueur.transform.position))); } if (go.GetComponent <CubeEnigmeObject>() != null) { tableauDistance.Add(new TupleDistance(go, Vector3.Distance(go.transform.position, joueur.transform.position))); } if (go.name.Equals("CubeSalle")) { tableauDistance.Add(new TupleDistance(go, Vector3.Distance(go.transform.position, joueur.transform.position))); } } }
private void processGetDifficulty() { GameObject zoneStatic = this.transform.parent.gameObject.transform.Find("ZoneStatic").gameObject; Debug.Log(zoneStatic); try { GameObject enigmeObject = zoneStatic.GetComponent <Zone>().go; CubeEnigmeObject cubeEnigmeObject = enigmeObject.GetComponent <CubeEnigmeObject>(); int difficulty = cubeEnigmeObject.cubeEnigme.difficulty; int result = cubeEnigmeObject.cubeEnigme.enigme.getDifficulty(); CubeIntObject cubeEnigme = GameObjectFactory.creerCubeInt(result, spawnIntVect); } catch (System.Exception e) { Debug.Log(e); } }
private void processSetClef() { GameObject zoneP1 = this.transform.parent.gameObject.transform.Find("ZoneP1").gameObject; GameObject zoneStatic = this.transform.parent.gameObject.transform.Find("ZoneStatic").gameObject; try { GameObject staticObject = zoneStatic.GetComponent <Zone>().go; CubeEnigmeObject cubeStaticObject = staticObject.GetComponent <CubeEnigmeObject>(); GameObject intObject = zoneP1.GetComponent <Zone>().go; CubeIntObject cubeIntObject = intObject.GetComponent <CubeIntObject>(); int intKey = cubeIntObject.cubeInt.entier; cubeStaticObject.cubeEnigme.enigme.setClef(intKey); } catch (System.Exception e) { Debug.Log(e); } }