private IEnumerator DestroyCoroutine() { yield return(CoroutineAnimation.Animate( transform.localScale, Vector3.zero, .3f, (s) => transform.localScale = s)); Destroy(gameObject); }
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)); }