Exemple #1
0
    private void setStart()
    {
        //only one collisionManager should be in progress at the same time for the whole scene
        isStarted = true;

        blobs = new ArrayList ();

        if (blobName1 == "main blob")
            blobName1 = worldManager.getMainBlobName ();
        blob1 = (BlobManager)worldManager.blobs [blobName1];
        blob2 = (BlobManager)worldManager.blobs [blobName2];

        blob1.setName (true);
        blob2.setName (true);
        if (newBlobManager != null)
            newBlobManager.setName (true);

        blobs.Add (blob2);

        if (isBlob2InsideBlob1) {
            //case: when blob2 collided with blob1, it was completely within blob1 bounds
            //Debug.Log ("inside collision");
            newBlobManager = blob1;

            iterPrism = blob2.genPrism ();
            combinedPrism = blob1.getPrism ();

            iterOffset = new IntVector3 (iterPrism.x - combinedPrism.x, iterPrism.y - combinedPrism.y, iterPrism.z - combinedPrism.z);

            //ZTools.show ("combinedPrism ", combinedPrism);
            newMapData = blob1.mapData;
            newVoxelGrid = blob1.voxels;
            newContagiousList = blob1.getContagiousList ();
        } else {
            //case: blob2 hit the outside of blob1. newblob bounds must become larger
            //Debug.Log ("outside collision");
            blobs.Add (blob1);
            iterPrism = getPrismFromBlobs (blob1, blob2);
            iterOffset = new IntVector3 (0, 0, 0);

            combinedPrism = iterPrism;
            newMapData = new int[iterPrism.width, iterPrism.height, iterPrism.depth];
            newVoxelGrid = new GameObject[iterPrism.width, iterPrism.height, iterPrism.depth];
            newContagiousList = new ArrayList ();
            newBlobManager.gameObject.transform.position = new Vector3 (iterPrism.x, iterPrism.y, iterPrism.z);
        }
        //ZTools.show("combined prism",combinedPrism);
    }