Example #1
0
    public void applyActions(BlobManager blobManager)
    {
        /*
        when a blob is in the process of moving its voxels to another blob, it keeps track
        of actions made to it like setCorrupt and setBroken, so it can apply them to the new blob
        as well once it finishes building.
        */
        IntVector3 blobPosition = blobManager.getRealPosition ();
        IntVector3 offset = new IntVector3 (blobPosition.x - getRealPosition ().x,
            blobPosition.y - getRealPosition ().y,
            blobPosition.z - getRealPosition ().z);
        /*
        Debug.Log ("applyActions blobPosition: "+ZTools.toString(blobPosition));
        Debug.Log ("applyActions position: "+ZTools.toString(position));
        Debug.Log ("applyActions getRealPosition: "+ZTools.toString(getRealPosition()));
        */
        foreach (BlobAction action in blobManager.blobActions) {
            IntVector3 point = new IntVector3 (action.point.x + offset.x,
            action.point.y + offset.y,
            action.point.z + offset.z);

            if (action.action == "setBroken") {
                //Debug.Log("zz setBroken "+iOffset+" joff "+jOffset+" koff "+kOffset);
                setBroken (point);
                continue;
            }
            if (action.action == "setCorrupt") {
                //Debug.Log("ioff "+iOffset+" joff "+jOffset+" koff "+kOffset);
                setCorrupt (point);
                continue;
            }
        }

        blobManager.blobActions = new ArrayList ();
    }