private IEnumerator InstantiateBlock(int iterator)
    {
        List <GameObject> pointList = voxelGenerator.GetPointList();

        voxelGenerator.setConstructionEstimation(pointList.Count);
        for (int point = 0; point < pointList.Count - iterator; ++point)
        {
            while (!VoxelTransitionManager.voxelCanTransit() && !coroutineLimiter.calculeAutorisation())
            {
                yield return(new WaitForFixedUpdate());
            }
            Voxel _voxel = Instantiate(voxel);
            if (changeVoxelSpeed)
            {
                voxel.SetTransitionTime(voxelSpeed);
                voxel.SetTransitionTimeMin(voxelSpeedMin);
                voxel.SetTransitionTimeMax(voxelSpeedMax);
            }
            voxel.gameObject.transform.position = gameObject.transform.position;
            _voxel.StartTransition(pointList[point + iterator], voxelGenerator.gameObject, gameObject);
            if (fadding)
            {
                _voxel.startFading(false, 2.0f, voxelGenerator);
            }
            //yield return new WaitForFixedUpdate();
        }
    }
示例#2
0
 private IEnumerator DislockMesh(int iterator)
 {
     if (voxelGenerator != null)
     {
         List <GameObject> destinatationPointList = voxelGenerator.GetPointList();
         voxelGenerator.setConstructionEstimation(iterator + pointList.Count);
         if (useInstantiator)
         {
             voxelInstantiator.StartInstantiateBlock(voxelGenerator);
             voxelGenerator.setConstructionEstimation(destinatationPointList.Count);
         }
         for (int point = 0; point < pointList.Count; ++point)
         {
             while (!coroutineLimiter.calculeAutorisation())
             {
                 yield return(new WaitForFixedUpdate());
             }
             if (pointList[point].GetComponent <AnchorPoint>().AnchoredVoxel != null)
             {
                 while (!VoxelTransitionManager.voxelCanTransit())
                 {
                     yield return(new WaitForFixedUpdate());
                 }
                 if (point < destinatationPointList.Count - iterator)
                 {
                     pointList[point].GetComponent <AnchorPoint>().Disanchoring(destinatationPointList[point + iterator], gameObject);
                 }
                 else if (voxelGenerator.GetDeadEnd() != null)
                 {
                     pointList[point].GetComponent <AnchorPoint>().Disanchoring(voxelGenerator.GetDeadEnd(), gameObject);
                 }
                 else
                 {
                     pointList[point].GetComponent <AnchorPoint>().DeleteVoxel();
                 }
                 //yield return new WaitForFixedUpdate();
             }
         }
     }
     else
     {
         for (int point = 0; point < pointList.Count; ++point)
         {
             pointList[point].GetComponent <AnchorPoint>().DeleteVoxel();
         }
     }
     attachedVertex = 0;
     voxelConstructionEstimation = 0;
     anchoredVoxelNBR            = 0;
     if (fading)
     {
         startFading(false, 2.0f);
     }
     yield return(0);
 }