Exemplo n.º 1
0
    // grandParent-death-and-revive

    public void removeGrandParent()
    {
        if (depth < 2)
        {
            return;                    // has no grand parent
        }
        gm.baseFrac = parent;
        FractalBox grandp = parent.parent;

        grandp.removeWalls();
        for (int i = 0; i < Fractal.blockPos.Length; i++)
        {
            if (grandp.getChild(i).Equals(parent))              // find the childIndex
            {
                childIndex = i;
                continue;
            }
            // distroy uncles
            Destroy(grandp.getChild(i).gameObject);
        }
        // set the parent as the first child of the GameManager object
        parent.transform.parent        = gm.transform;
        parent.transform.localPosition = Vector3.zero;
        Destroy(grandp.gameObject);
    }
Exemplo n.º 2
0
    /* Check if the character is in a child of the current fractal
     * point-polygon intersection with all the child
     */
    public bool isDesceding()
    {
        float x = player.transform.localPosition.x;
        float y = player.transform.localPosition.z;

        for (int i = 0; i < Fractal.blockPos.Length; i++)
        {
            Vector2 t = Fractal.blockPos[i];
            if (x > t.x && x < t.x + Fractal.relaSize &&
                y > t.y && y < t.y + Fractal.relaSize)
            {
                changeFractal(fractal.getChild(i), true);
                fractal.removeGrandParent();
                zoomIn();
                return(true);
            }
        }
        return(false);
    }