Exemplo n.º 1
0
    /// <summary>
    /// 特殊泡泡的功能 消除同样颜色的泡泡
    /// </summary>
    public void ClearSameColorBubble(BubbleUnit bubble)
    {
        int typeID = Random.Range(1, 6);

        List <BubbleUnit> colorBubList = new List <BubbleUnit> ();

        for (int i = 0; i < this.bubbleList.Count; ++i)
        {
            BubbleUnit curBub    = bubbleList[i];
            int        curType   = IDTool.GetType(curBub.ID);
            int        curTypeID = IDTool.GetTypeID(curBub.ID);

            if (curType != 2 && curTypeID == typeID)
            {
                colorBubList.Add(curBub);
            }
        }

        colorBubList.Add(bubble);

        for (int j = 0; j < colorBubList.Count; ++j)
        {
            RecycleBubble(colorBubList[j]);
        }
    }
Exemplo n.º 2
0
    Transform GetBubbleTran(int ID)
    {
        if (pool == null)
        {
            pool = PoolManager.Pools["BubblePool"];
        }

        int type = IDTool.GetType(ID);

        if (type == 1)
        {
            return(pool.Spawn("BubbleUnit"));
        }
        if (type == 2)
        {
            return(pool.Spawn("SpecialBubbleUnit"));
        }
        if (type == 3)
        {
            return(pool.Spawn("FreezeBubbleUnit"));
        }
        if (type == 4)
        {
            return(pool.Spawn("StoneBubbleUnit"));
        }

        return(null);
    }
Exemplo n.º 3
0
    /// <summary>
    /// Raises the mouse down event.
    /// </summary>
    void OnMouseDown()
    {
        if (BubbleManager.Instance.isCanClick == false)
        {
            return;
        }

        Debug.Log("special monsedown");

        int type   = IDTool.GetType(ID);
        int typeID = IDTool.GetTypeID(ID);

        if (type != 2)
        {
            Debug.LogError("error type");
            return;
        }
        else
        {
            BubbleManager.Instance.scoreMulti = 2f;

            if (typeID == 1)
            {
                CleanRow();
            }
            else if (typeID == 2)
            {
                CleanCol();
            }
            else if (typeID == 3)
            {
                CleanRowCol();
            }
            else if (typeID == 4)
            {
                CleanRange();
            }
            else if (typeID == 5)
            {
                BubbleManager.Instance.ClearSameColorBubble(this);
                this.ReduceHitCount();
                BubbleManager.Instance.RecycleBubble(this);
            }
            else if (typeID == 6)
            {
                BubbleManager.Instance.CleanAllBubble();
                this.ReduceHitCount();
                BubbleManager.Instance.RecycleBubble(this);
            }

            GetComponent <Rigidbody2D>().isKinematic = true;
        }
    }