Exemplo n.º 1
0
    private IEnumerator GameOverBlockAnimation(BlockScript b)
    {
      var block = b.gameObject;
      Destroy(b);
      var startScale = block.transform.localScale;
      var position = block.transform.position;
      var def = b.block.Definition;
      float time = 0f;
      float duration = Random.Range(0.2f, 0.35f);

      bool explo = false;
      while (time < duration)
      {
        time += DeltaTime;

        float p = Interpolators.BumpCurve.Evaluate(1f - (time / duration));

        // Shrink
        block.transform.localScale = MathfEx.LerpWithoutClamp(Vector3.zero, startScale, p);

        var shiftToCenter = (startScale - block.transform.localScale);
        shiftToCenter.x = shiftToCenter.x / 2f;
        shiftToCenter.y = 0;

        block.transform.position = position + shiftToCenter;

        if (p < 0.725f && !explo)
        {
          explo = true;
        }

        yield return new WaitForEndOfFrame();
      }

      yield return null;
    }
Exemplo n.º 2
0
 public bool CanMove(BlockScript b)
 {
   return (b != null) && CanMove(b.block.x, b.block.y);
 }