Example #1
0
    private IEnumerator DestroyCoroutine()
    {
        yield return(CoroutineAnimation.Animate(
                         transform.localScale,
                         Vector3.zero,
                         .3f,
                         (s) => transform.localScale = s));

        Destroy(gameObject);
    }
Example #2
0
    public void Move(int toX, int toY, float time)
    {
        if (_moveCoroutine != null)
        {
            StopCoroutine(_moveCoroutine);
        }

        _piece.ChangeCoordinates(toX, toY);

        _moveCoroutine = StartCoroutine(CoroutineAnimation.Animate(
                                            transform.localPosition,
                                            _piece.Grid.GetCoordinatesWorldPosition(toX, toY),
                                            time,
                                            (p) => transform.localPosition = p));
    }