// Use this for initialization void Start() { s1 = GameObject.Find("S1"); s2 = GameObject.Find("S2"); Debug.Log(s1.transform.position); Debug.Log(s2.transform.position); //Test star1 = s1.GetComponent<Test>(); so = s1.GetComponent <StarOne>(); st = s2.GetComponent <StarTwo>(); so.speed = Vector3.zero; st.speed = Vector3.back * 0.12f; //nouveau = Instantiate(Resources.Load(path: "Prefabs/star"), new Vector3(5, 5, 5), Quaternion.identity) as GameObject; GameObject go; //go = Instantiate(Resources.Load(path: "Prefabs/star"), Random.insideUnitSphere * 10.0f, Quaternion.identity) as GameObject; Vector3 minV = new Vector3(-10.0f, -10.0f, -10.0f); Vector3 maxV = new Vector3(10.0f, 10.0f, 10.0f); go = Instantiate(Resources.Load(path: "Prefabs/star"), new Vector3(0, 0, 0), Quaternion.identity) as GameObject; Star s = new Star(minV, maxV, 0.0f); Tree <Star> arbre = new Tree <Star>(s); Debug.Log("cadran : " + s.cadran); go = Instantiate(Resources.Load(path: "Prefabs/star"), new Vector3(8, 8, 5), Quaternion.identity) as GameObject; s = new Star(go, minV, maxV, 23.0f); Debug.Log("cadran : " + s.cadran); arbre.addNodeToTree(2, s.cadran, 1, s); go = Instantiate(Resources.Load(path: "Prefabs/star"), new Vector3(4, 4, 5), Quaternion.identity) as GameObject; s = new Star(go, minV, maxV, 17.0f); Debug.Log("cadran : " + s.cadran); arbre.addNodeToTree(2, s.cadran, 1, s); /*arbre.addNodeToTree(1, 2, 1, s); * arbre.addNodeToTree(1, 3, 1, s); * arbre.addNodeToTree(1, 4, 1, s);*/ // Create a Tree of 'Strings' /*Tree<string> myTreeString = new Tree<string>("Stepa"); /* A Sample Tree with 'String' Nodes */ /*myTreeString.addNodeToTree(2, 1, 1, "Tatiana"); * myTreeString.addNodeToTree(2, 2, 1, "Diana"); * myTreeString.addNodeToTree(2, 3, 1, "Ardalion");*/ }
private void OnMouseLeaveStarOne(object sender, MouseEventArgs e) { if (!StarOne.IsChecked.HasValue || !StarOne.IsChecked.Value) { var star = StarOne.FindChild <Rectangle>("star"); var brush = star.OpacityMask as VisualBrush; var visual = brush.Visual as Canvas; var path = visual.Children[0] as Path; path.Fill = Brushes.White; path.Opacity = 1.0; } }
void OnCollisionEnter2D(Collision2D col) //col ==> trou ;;//gameobject --> object qui est en collision avec les trous, on attache ce script à grain et nn trou { if (gameObject.CompareTag("arrosoir") && col.gameObject.CompareTag("trou1") && PelleToTrou.pelle1Done == true && GrainToTrou.grain1Done == true) { myAnim = Instantiate(prefabAnim, col.transform.position, transform.rotation); // initiate dans la pos du trou Destroy(myAnim, 2.0f); RegenererGameObject(); Destroy(this.gameObject); //l'ordre compte, il faut regenerer tout d'abord, après destroy if (col.gameObject.CompareTag("trou1")) { action3 = true; ScoreCounter.score += 2; InstantiatePlusTwoAnim(); } } if (GrainLevel2.action2Tr3 == true && gameObject.CompareTag("arrosoir") && col.gameObject.CompareTag("trou3")) { myAnim = Instantiate(prefabAnim, col.transform.position, transform.rotation); // initiate dans la pos du trou Destroy(myAnim, 2.0f); RegenererGameObject(); Destroy(this.gameObject); //l'ordre compte, il faut regenerer tout d'abord, après destroy if (col.gameObject.CompareTag("trou3")) { action3Tr3 = true; ScoreCounter.score += 2; InstantiatePlusTwoAnim(); //on montre la 1ere etoile StarOne.showStarOne(); star1L2 = true; } } if (GrainLevel2.action2Tr4 == true && gameObject.CompareTag("arrosoir") && col.gameObject.CompareTag("trou4")) { myAnim = Instantiate(prefabAnim, col.transform.position, transform.rotation); // initiate dans la pos du trou Destroy(myAnim, 2.0f); RegenererGameObject(); Destroy(this.gameObject); //l'ordre compte, il faut regenerer tout d'abord, après destroy if (col.gameObject.CompareTag("trou4")) { action3Tr4 = true; ScoreCounter.score += 2; InstantiatePlusTwoAnim(); Star2.showStar2(); star2L2 = true; } } if (gameObject.CompareTag("arrosoir") && col.gameObject.CompareTag("trou5") && Trou4Level2.grainTrou5 == true) { myAnim = Instantiate(prefabAnim, col.transform.position, transform.rotation); // initiate dans la pos du trou Destroy(myAnim, 2.0f); RegenererGameObject(); Destroy(this.gameObject); //l'ordre compte, il faut regenerer tout d'abord, après destroy if (col.gameObject.CompareTag("trou5")) { action3Tr5 = true; ScoreCounter.score += 2; InstantiatePlusTwoAnim(); star3.showStar3(); star3L2 = true; } } }
void OnCollisionEnter2D(Collision2D col) //col ==> trou ;;//gameobject --> object qui est en collision avec les trous, on attache ce script à grain et nn trou { if (DDCreuser.action1 == true && DDGrain.action2 == true && gameObject.CompareTag("arrosoir")) { InstantiatePrefab(col.transform.position); RegenererGameObject(); Destroy(this.gameObject); //l'ordre compte, il faut regenerer tout d'abord, après destroy if (col.gameObject.CompareTag("trou1")) { action3 = true; ScoreCounter.score += 1; InstantiatePlusOneAnim(); } } if (DDCreuser.action1Tr2 == true && DDGrain.action2Tr2 == true && gameObject.CompareTag("arrosoir")) { if (ScoreCounter.score > 5) { isColliding = true; return; } InstantiatePrefab(col.transform.position); RegenererGameObject(); Destroy(this.gameObject); //l'ordre compte, il faut regenerer tout d'abord, après destroy if (col.gameObject.CompareTag("trou2")) { action3Tr2 = true; ScoreCounter.score += 1; InstantiatePlusOneAnim(); } } if (DDCreuser.action1Tr3 == true && DDGrain.action2Tr3 == true && gameObject.CompareTag("arrosoir")) { if (ScoreCounter.score > 8) { isColliding = true; return; } InstantiatePrefab(col.transform.position); RegenererGameObject(); Destroy(this.gameObject); //l'ordre compte, il faut regenerer tout d'abord, après destroy if (col.gameObject.CompareTag("trou3")) { action3Tr3 = true; ScoreCounter.score += 1; InstantiatePlusOneAnim(); //on montre la 1ere etoile StarOne.showStarOne(); star1L1 = true; } } if (DDCreuser.action1Tr4 == true && DDGrain.action2Tr4 == true && gameObject.CompareTag("arrosoir")) { if (ScoreCounter.score > 11) { isColliding = true; return; } InstantiatePrefab(col.transform.position); RegenererGameObject(); Destroy(this.gameObject); //l'ordre compte, il faut regenerer tout d'abord, après destroy if (col.gameObject.CompareTag("trou4")) { action3Tr4 = true; ScoreCounter.score += 1; InstantiatePlusOneAnim(); } } if (DDCreuser.action1Tr5 == true && DDGrain.action2Tr5 == true && gameObject.CompareTag("arrosoir")) { if (ScoreCounter.score > 14) { isColliding = true; return; } InstantiatePrefab(col.transform.position); RegenererGameObject(); Destroy(this.gameObject); //l'ordre compte, il faut regenerer tout d'abord, après destroy if (col.gameObject.CompareTag("trou5")) { action3Tr5 = true; ScoreCounter.score += 1; InstantiatePlusOneAnim(); } } if (DDCreuser.action1Tr6 == true && DDGrain.action2Tr6 == true && gameObject.CompareTag("arrosoir")) { if (ScoreCounter.score > 17) { isColliding = true; return; } InstantiatePrefab(col.transform.position); RegenererGameObject(); Destroy(this.gameObject); //l'ordre compte, il faut regenerer tout d'abord, après destroy if (col.gameObject.CompareTag("trou6")) { action3Tr6 = true; ScoreCounter.score += 1; InstantiatePlusOneAnim(); //la plante6 pousse on le donne une 2 eme etoile Star2.showStar2(); star2L1 = true; youWin.SetActive(true); Debug.Log(star2L1); } } else { isColliding = true; } }