Exemplo n.º 1
0
    public void Start()
    {
        onSliceMesh.AddListener((o, upper) => {
            o.GetComponent <MDSmelt>().value = 0;
            Destroy(o.GetComponent <MDSmelt>());
            if (upper)
            {
                MDDrop mdDrop  = o.GetComponent <MDDrop>();
                mdDrop.enabled = true;
                StartCoroutine(CoroutineUtils.Chain(
                                   CoroutineUtils.LinearAction(mdDrop.dropTime, (w) => {
                    mdDrop.value = w;
                }),
                                   CoroutineUtils.Do(() => {
                    o.GetComponent <Rigidbody>().useGravity = true;
                })
                                   ));
            }
            else
            {
                MeshDeformation[] md        = o.GetComponents <MeshDeformation>();
                MeshDeformationExtent[] mde = o.GetComponents <MeshDeformationExtent>();

                for (int i = 0; i < md.Length; i++)
                {
                    Destroy(md[i]);
                }

                for (int i = 0; i < mde.Length; i++)
                {
                    Destroy(mde[i]);
                }
            }
        });
    }
Exemplo n.º 2
0
 /**
  * Waits 1 frame if initialSpawnDelay=0
  */
 public void DoSpawnOneShot()
 {
     StartCoroutine(
         CoroutineUtils.Chain(this,
                              CoroutineUtils.WaitForSeconds(initialSpawnDelay),
                              CoroutineUtils.Do(Spawn)
                              ));
 }