IEnumerator Play() { GoTween tween = Go.to(obj.transform, 1f, new GoTweenConfig().vector3Prop("position", new Vector3(50, 50, 0), true)); yield return(StartCoroutine(tween.waitForCompletion())); tween = Go.to(obj.transform, 0.5f, new GoTweenConfig().eulerAngles(new Vector3(0, 0, 135), true)); yield return(StartCoroutine(tween.waitForCompletion())); obj.GetComponent <SpriteRenderer>().color = Color.red; yield return(new WaitForSeconds(0.5f)); tween = Go.to(obj.transform, 1.5f, new GoTweenConfig() .shake(new Vector3(25, 25, 0), GoShakeType.Position) .shake(new Vector3(0, 0, 90), GoShakeType.Eulers) .shake(new Vector3(0.5f, 5, 0), GoShakeType.Scale, 2)); yield return(StartCoroutine(tween.waitForCompletion())); Debug.Log("done!"); }
private IEnumerator Flip() { Debug.Log("CardController (" + Id + ") Flip"); Flipping = true; var config = new GoTweenConfig().eulerAngles(new Vector3(0, 180), true); config.easeType = GoEaseType.CubicOut; var tween = new GoTween(transform, 0.5f, config); Go.addTween(tween); var y = transform.rotation.eulerAngles.y; var changed = false; while (tween.totalElapsedTime < tween.totalDuration) { if (!changed && transform.rotation.eulerAngles.y - y > 90) { Debug.Log("CardController (" + Id + ") Flip: Change sprite to " + (FaceUp ? "Back" : "Face")); var sprite = GetComponent <UISprite>(); if (FaceUp) { sprite.atlas = _defaultCardAtlas; sprite.spriteName = sprite.atlas.GetListOfSprites()[0]; } else { sprite.atlas = GameController.CardSetAtlas; sprite.spriteName = sprite.atlas.GetListOfSprites()[Answer]; sprite.flip = UISprite.Flip.Horizontally; } changed = true; } yield return(tween.waitForCompletion()); } FaceUp = !FaceUp; Flipping = false; _flipQueue--; Debug.Log("CardController (" + Id + ") Done Flipping: Face " + (FaceUp ? "Up" : "Down")); }