Exemple #1
0
    bool BackChecker(GameObject obj1, GameObject obj2)
    {
        Vector2 vtmp1 = obj1.GetComponent <Jewel>().PosMap;
        Vector2 vtmp2 = obj2.GetComponent <Jewel>().PosMap;
        int     type1 = obj1.GetComponent <Jewel>().type;

        List <Vector2> r = JewelController.RowChecker(type1, (int)vtmp2.y, (int)vtmp2.x);
        List <Vector2> c = JewelController.ColumnChecker(type1, (int)vtmp2.x, (int)vtmp2.y);

        r.Remove(vtmp2);
        c.Remove(vtmp2);
        r.Remove(vtmp1);
        c.Remove(vtmp1);
        if (r.Count == 2 && !d_cheker(r))
        {
            r.Clear();
        }
        if (c.Count == 2 && !d_cheker(c))
        {
            c.Clear();
        }

        if (r.Count >= 2 || c.Count >= 2)
        {
            return(true);
        }

        return(false);
    }
    IEnumerator JewelProcess()
    {
        isProcess = true;
        yield return(null);

        x = (int)PosMap.x;
        y = (int)PosMap.y;

        listX.Clear();
        listY.Clear();
        listX = JewelController.RowChecker(type, y, x);
        listY = JewelController.ColumnChecker(type, x, y);
        if (listX.Count + listY.Count == 3)
        {
            CallDestroy(new Vector2(-1, -1), 0);
        }
        else if (listX.Count + listY.Count == 4)
        {
            Vector2 tmp = Editor.powerUp1(listX, listY);
            if (x != (int)tmp.x || y != (int)tmp.y)
            {
                CallDestroy(tmp, 0);
            }
            else if (PowerUp == 0)
            {
                CallDestroy(tmp, 1);
                PowerUp = 1;
                Effect.SpawnEnchan(effect[0], gameObject);
            }
            else
            {
                CallDestroy(tmp, 0);
                Destroying();
            }
        }
        else if (listX.Count + listY.Count >= 5)
        {
            Vector2 tmp = Editor.PowerUpType(listX, listY);
            if (x != (int)tmp.x || y != (int)tmp.y)
            {
                Destroying();
            }
            else
            {
                CallDestroy(tmp, 0);
                mtransform.Find("Render").GetComponent <SpriteRenderer>().enabled = false;
                type    = 9;
                PowerUp = 9;
                Effect.SpawnType9(effect[1], gameObject);
                Editor.LightingRandomPoint();
            }
        }
        isProcess = false;
    }