public void ThrowAllRubbishes() { foreach (RubbishController RubbishController in rubbishes) { Destroy(RubbishController.GetComponent <DistanceJoint2D>()); Physics2D.IgnoreCollision(realCollider, RubbishController.collider2D); Physics2D.IgnoreCollision(detectorCollider, RubbishController.collider2D); thrownRubbishes.Add(RubbishController); } rubbishes.Clear(); foreach (DistanceJoint2D distanceJoint in distanceJoints) { Destroy(distanceJoint); } distanceJoints.Clear(); }
public void Shoot() { Debug.Log(poraController.IsPreparation); Debug.Log(State); if (poraController.IsPreparation && State == GameplayState.Playing) { BubbleController.BubbleSize size = poraController.Shoot(); Vector2 bubblePosition = poraController.GetShootPosition(); InstansiateBubble(size, bubblePosition); if (size == BubbleController.BubbleSize.One || size == BubbleController.BubbleSize.Two) { soundSmall.Play(); } else if (size == BubbleController.BubbleSize.Three) { soundMiddle.Play(); } else { soundLarge.Play(); } } else { } ScreenShot Clue = new ScreenShot(); Clue.Pora = new ScreenShot.CluePora(Pora.GetComponent <RectTransform>().localPosition); Clue.Place = new ScreenShot.PlaceClue(dataStaticLevel.Place); for (int i = 0; i < ParentObject.Barrier.transform.childCount; i++) { BarrierController controller = ParentObject.Barrier.transform.GetChild(i).gameObject.GetComponent <BarrierController>(); ScreenShot.CluePenghalang CluePenghalang = new ScreenShot.CluePenghalang(); CluePenghalang.Packagename = controller.PackageName; CluePenghalang.Nama = controller.Name; CluePenghalang.Posisi = controller.GetComponent <RectTransform>().localPosition; CluePenghalang.KecepatanRotasi = controller.RotationSpeed; CluePenghalang.Rotasi = controller.Rotation; Clue.Barries.Add(CluePenghalang); } for (int i = 0; i < ParentObject.Bubble.transform.childCount; i++) { BubbleController controller = ParentObject.Bubble.transform.GetChild(i).gameObject.GetComponent <BubbleController>(); ScreenShot.ClueGelembung ClueGelembung = new ScreenShot.ClueGelembung(); ClueGelembung.Posisi = controller.GetComponent <RectTransform>().localPosition; ClueGelembung.Size = controller.SizeInInt; ClueGelembung.Type = controller.Type; Clue.Bubbles.Add(ClueGelembung); } for (int i = 0; i < ParentObject.Rubbish.transform.childCount; i++) { RubbishController controller = ParentObject.Rubbish.transform.GetChild(i).gameObject.GetComponent <RubbishController>(); ScreenShot.ClueSampah ClueSampah = new ScreenShot.ClueSampah(); ClueSampah.KecepatanRotasi = controller.RotationSpeed; ClueSampah.Rotasi = controller.Rotation; ClueSampah.Packagename = controller.PackageName; ClueSampah.Posisi = controller.GetComponent <RectTransform>().localPosition; ClueSampah.Size = controller.SizeInInt; Clue.Rubbish.Add(ClueSampah); } ListOfClue.Add(Clue); }