コード例 #1
0
    public void InstansiateBubble(BubbleController.BubbleSize size, Vector2 position)
    {
        GameObject itemPreview = ParentObject.BubblePreview.transform.GetChild(0).gameObject;
        ItemGelembungController itemGelembungController = itemPreview.GetComponent <ItemGelembungController>();

        for (int i = 0; i < Bubbles.Length; i++)
        {
            if (itemGelembungController.PackageName == Bubbles[i].PackageName)
            {
                if (itemGelembungController.Type == BubbleType.White)
                {
                    GameObject objek = (GameObject)Instantiate(Bubbles[i].White);
                    objek.transform.position = position;
                    objek.GetComponent <BubbleController>().Size = size;
                    objek.transform.SetParent(ParentObject.Bubble.transform);
                    Destroy(itemPreview);
                }
                else if (itemGelembungController.Type == BubbleType.Red)
                {
                    GameObject objek = (GameObject)Instantiate(Bubbles[i].Red);
                    objek.transform.position = position;
                    objek.GetComponent <BubbleController>().Size = size;
                    objek.transform.SetParent(ParentObject.Bubble.transform);
                    Destroy(itemPreview);
                }
                else if (itemGelembungController.Type == BubbleType.Orange)
                {
                    GameObject objek = (GameObject)Instantiate(Bubbles[i].Orange);
                    objek.transform.position = position;
                    objek.GetComponent <BubbleController>().Size = size;
                    objek.transform.SetParent(ParentObject.Bubble.transform);
                    Destroy(itemPreview);
                }
            }
        }
    }
コード例 #2
0
 public bool PrepareShooting()
 {
     if (!isPreparation)
     {
         isPreparation = true;
         Size          = BubbleController.BubbleSize.One;
         ItemGelembungController itemGelembungController = BubbleStock.transform.GetChild(0).gameObject.GetComponent <ItemGelembungController>();
         if (itemGelembungController.Type == BubbleType.White)
         {
             BubblePreviewWhite.transform.localScale = Scale.One;
         }
         else if (itemGelembungController.Type == BubbleType.Red)
         {
             BubblePreviewRed.transform.localScale = Scale.One;
         }
         else if (itemGelembungController.Type == BubbleType.Orange)
         {
             BubblePreviewOrange.transform.localScale = Scale.One;
         }
         Invoke("NextBubble", transisionTime);
         return(true);
     }
     return(false);
 }
コード例 #3
0
    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);
    }