Example #1
0
    void RespawnItem(iVector3 pos)
    {
        ItemBlock itemBlock = Instantiate(Resources.Load <GameObject>("Prefabs/ItemBlock")).GetComponent <ItemBlock>();

        itemBlock.pos = pos;

        itemBlock.transform.SetParent(InGameManager.instance.positionList[BlockTools.iVector3ToIndex(pos)].transform);
        itemBlock.rTr.anchoredPosition3D = Vector3.zero;
        itemBlock.rTr.localScale         = Vector3.one;
        itemBlock.itemType = (ItemType)UnityEngine.Random.Range(0, 3);
        itemBlock.Initialize();
    }
Example #2
0
    IEnumerator FlyStar(int index, GameBlock gameBlock)
    {
        GameObject dummyStar = new GameObject("DummyStar");
        //GameObject star = Instantiate(Resources.Load<GameObject>("Prefabs/FX_LightBall_A"));
        GameObject star = PoolManager.Instance.GetPool(PoolType.FX_LightBall_A).gameObject;

        star.SetActive(true);
        RectTransform starRTr = dummyStar.AddComponent <RectTransform>();

        star.transform.SetParent(ParticleManager.Instance.particleCanvasF.transform);
        dummyStar.transform.SetParent(rocket.transform);
        starRTr.anchoredPosition3D = new Vector3(-450f, 300f, 0f);
        starRTr.localScale         = Vector3.one;
        FollowUI ui = star.AddComponent <FollowUI>();

        ui.bFollow   = true;
        ui.target    = positionList[index].gameObject.GetComponent <RectTransform>();
        ui.subTarget = starRTr;
        float    speed = 4f;
        iVector3 p     = new iVector3(gameBlock.pos.x, gameBlock.pos.y, gameBlock.pos.z);

        star.GetComponent <RectTransform>().anchoredPosition3D = Vector3.zero;
        star.transform.localScale = Vector3.one;
        FX_Electric.gameObject.SetActive(true);
        FX_Electric.Play();
        SoundManager.Instance.PlayEffect("eff_plasma");
        SoundManager.Instance.PlayEffect("eff_finale");
        dummyStar.transform.SetParent(gameBlock.transform);

        while ((starRTr.anchoredPosition3D).sqrMagnitude > 100f)
        {
            starRTr.anchoredPosition3D = Vector3.Lerp(starRTr.anchoredPosition3D, Vector3.zero, Time.deltaTime * speed);
            yield return(null);

            if (starRTr == null)
            {
                break;
            }
        }


        star.SetActive(false);
        dummyStar.SetActive(false);

        //ParticleManager.Instance.SetParticle(ParticleType.ParticleF, Particle.FX_SpreadStar, positionList[BlockTools.iVector3ToIndex(p)].GetComponent<RectTransform>());
        GameObject fx_SpreadStar = PoolManager.Instance.GetPool(PoolType.FX_SpreadStar).gameObject;

        ParticleManager.Instance.SetParticle(ParticleType.ParticleF, fx_SpreadStar, positionList[BlockTools.iVector3ToIndex(p)].GetComponent <RectTransform>());

        if (gameBlock != null)
        {
            ColorBlock colorBlock = gameBlock.GetComponent <ColorBlock>();
            if (colorBlock != null)
            {
                colorBlock.DestroyObject();
            }
            GrayBlock grayBlock = gameBlock.GetComponent <GrayBlock>();
            if (grayBlock != null)
            {
                grayBlock.DestroyObject();
            }
        }

        //이떄 생성되는 느낌의 파티클 한개더
        //ItemBlock itemBlock = Instantiate(Resources.Load<GameObject>("Prefabs/ItemBlock")).GetComponent<ItemBlock>();
        ItemBlock itemBlock = PoolManager.Instance.GetPool(PoolType.ItemBlock).GetComponent <ItemBlock>();

        itemBlock.gameObject.SetActive(true);
        itemBlock.pos      = p;
        itemBlock.itemType = (ItemType)UnityEngine.Random.Range(0, 2);
        itemBlock.transform.SetParent(positionList[index].transform);
        itemBlock.transform.localPosition = Vector3.zero;
        itemBlock.transform.localScale    = Vector3.one;
        itemBlock.bIsParentPos            = true;
        itemBlock.Initialize();
    }
Example #3
0
    public override void OnClickButton()
    {
        //Debug.Log("OnClickButton");
        if (MissionManager.Instance.bClear)
        {
            return;
        }
        if (InGameManager.Instance.IsGameOver())
        {
            return;
        }
        if (MissionManager.Instance.blockCount <= 0)
        {
            return;
        }


        if (colorCount >= 4)//아이템 만들기
        {
            MakeNumber(colorCount);
            MissionManager.Instance.UseBlock();
            for (int i = 0; i < colorCount; i++)
            {
                if (!connectedColorBlockList[i].pos.IsEquals(pos))
                {
                    connectedColorBlockList[i].Explosion(true);
                }
            }

            //ItemBlock itemBlock = Instantiate(Resources.Load<GameObject>("Prefabs/ItemBlock")).GetComponent<ItemBlock>();
            ItemBlock itemBlock = PoolManager.Instance.GetPool(PoolType.ItemBlock).gameObject.GetComponent <ItemBlock>();
            itemBlock.gameObject.SetActive(true);
            itemBlock.pos = pos;
            itemBlock.transform.SetParent(transform.parent);
            itemBlock.rTr.anchoredPosition3D = Vector3.zero;
            itemBlock.rTr.localScale         = Vector3.one;
            itemBlock.bIsParentPos           = true;

            switch (colorCount)
            {
            case 4:
                itemBlock.itemType = (ItemType)UnityEngine.Random.Range(0, 2);

                break;

            default:
                itemBlock.itemType = ItemType.Bomb;
                break;
            }
            MissionManager.Instance.AddBlock(colorType.ToString(), colorCount);
            MissionManager.Instance.AddBlock(itemBlock.itemType.ToString(), 1);

            itemBlock.Initialize();

            FindGrayBlock();

            DestroyObject();
        }
        else
        {
            if (colorCount.CompareTo(1) == 0)
            {
                //안터지고 애니메이션 실행
                Fail();
            }
            else
            {
                //MissionManager.Instance.AddBlock(colorType.ToString(), colorCount);
                MissionManager.Instance.UseBlock();
                for (int i = 0; i < colorCount; i++)
                {
                    connectedColorBlockList[i].Explosion(true);
                }
                MakeNumber(colorCount);
            }
        }
    }