public void Display(Action <AbstractGoTween> callback = null) { titleLabel.text = "Day " + (God.instance.currentDifficultyLevel + 1).ToString(); PopulateEndOfDayScreen(God.instance.score); endOfDayPanelTween.playForward(); endOfDayPanelTween.setOnCompleteHandler(callback); God.instance.fader.GetComponent <UIPlayAnimation>().Play(true); AudioManager.instance.PlayAudioForEndOfDay(); }
public void Grow() { if (tween != null) { tween.destroy(); } var scaleProperty = new ScaleTweenProperty(new Vector3(maxSize, maxSize, maxSize)); var config = new GoTweenConfig(); config.addTweenProperty(scaleProperty); tween = new GoTween(transform, growingSpeed, config); tween.setOnCompleteHandler(c => { StartExplosionEffect(); Invoke("Explode", timeToExplode); }); Go.addTween(tween); Go.to(transform, 5f, new GoTweenConfig() .eulerAngles(new Vector3(0, 0, 360)) .setEaseType(GoEaseType.Linear) .setIterations(-1, GoLoopType.RestartFromBeginning) ); }
public static GoTween ScaleOut(this GameObject self, float duration = 0.5f, ScaleOutEndAction action = ScaleOutEndAction.Destroy, float scale = 0, bool isRelative = false, GoEaseType ease = GoEaseType.Linear) { if (duration == 0) { Debug.LogWarning("Invalid parameter duration on ScaleOut call"); } GoTween tween = self.transform.scaleTo(duration, scale, isRelative); if (tween != null) { switch (action) { case ScaleOutEndAction.DoNothing: break; case ScaleOutEndAction.Inactive: tween.setOnCompleteHandler(c => self.SetActive(false)); break; case ScaleOutEndAction.Destroy: tween.setOnCompleteHandler(c => self.DestroySelf()); break; } tween.eases(ease); } else { switch (action) { case ScaleOutEndAction.DoNothing: break; case ScaleOutEndAction.Inactive: self.SetActive(false); break; case ScaleOutEndAction.Destroy: self.DestroySelf(); break; } } return(tween); }
private void OnScoreChanged(int newScore) { if (GameController.I.GameMode == GameController.GameModeType.Endless) { if (newScore > PlayerData.HighScore) { PlayerData.SetHighscore(newScore); HeaderController.I.UpdateHighScore(newScore); } var milestoneProgress = GameController.I.MilestoneProgress(newScore); if (milestoneChangeTween != null && milestoneChangeTween.state == GoTweenState.Running) { milestoneChangeTween.destroy(); } milestoneChangeTween = Go.to(milestoneScoreSlider, scoreChangeDuration, new GoTweenConfig().floatProp("value", milestoneProgress) .setEaseType(scoreChangeEaseType) .setDelay(scoreChangeDelay) ); milestoneChangeTween.setOnCompleteHandler(t => { if (newScore >= GameController.I.MilestonePoint) { GameController.I.NextMilestone(); } }); } if (!GameController.I.HasTargetScore) { return; } var progress = (float)newScore / GameController.I.TargetScore; if (GameController.I.IsPlaying) { if (scoreChangeTween != null && scoreChangeTween.state == GoTweenState.Running) { scoreChangeTween.destroy(); } scoreChangeTween = Go.to(targetScoreSlider, scoreChangeDuration, new GoTweenConfig().floatProp("value", progress) .setEaseType(scoreChangeEaseType) .setDelay(scoreChangeDelay) ); } else { // instant change targetScoreSlider.value = progress; } }
public void playSwapAnimation(SpriteRenderer render2) { SFXManager.instance.PlaySFX(Clip.Swap); Transform firstSpriteTransform = transform; Transform secondSpriteTransform = render2.GetComponent <Tile>().transform; GoTween firstTransformTween = transform.positionTo(0.3f, secondSpriteTransform.position); GoTween SecondTransformTween = secondSpriteTransform.positionTo(0.3f, firstSpriteTransform.position); firstTransformTween.setOnCompleteHandler(OnFirstCompleteHandler); SecondTransformTween.setOnCompleteHandler(OnSecondCompleteHandler); }
public void TweenPosition(Vector3 position) { if (currentTween != null) { StopTween(); } currentTween = Go.to(transform, GM.options.tweenTime, new GoTweenConfig() .position(position) .setEaseType(GoEaseType.ExpoOut)); currentTween.setOnCompleteHandler(c => { onMoveComplete(); }); }
public void move(Vector3 pos, Vector3 scale) { if (gameLabelManager.moving) { currentTween.destroy(); } currentTween = Go.to(transform, tweenTime, new GoTweenConfig() .position(pos) .scale(scale) .setEaseType(GoEaseType.ExpoOut)); currentTween.setOnCompleteHandler(c => { onMoveComplete(); }); }
public void Tween(Vector3 position, Vector3 scale, float time) { if (currentTween != null) { StopTween(); } currentTween = Go.to(transform, time, new GoTweenConfig() .localPosition(position) .scale(scale) .setEaseType(GoEaseType.ExpoOut)); currentTween.setOnCompleteHandler(c => { onMoveComplete(); }); }
public void move(Vector3 pos, Vector3 scale, float tweenTime) { if (playlistNavigationManager.moving && currentTween != null) { currentTween.destroy(); } currentTween = Go.to(transform, tweenTime, new GoTweenConfig() .position(pos) .scale(scale) .setEaseType(GoEaseType.ExpoOut)); currentTween.setOnCompleteHandler(c => { onMoveComplete(); }); }
public void TweenLocalPosition(Vector3 position, float tweenTime, bool destroyOnEnd) { if (currentTween != null) { StopTween(); } currentTween = Go.to(transform, tweenTime, new GoTweenConfig() .localPosition(position) .setEaseType(GoEaseType.ExpoOut)); currentTween.setOnCompleteHandler(c => { onMoveComplete(); }); destroyOnTweenEnd = destroyOnEnd; }
private void Move(int index) { SetIndex(index); var target = (Vector2) pads.Pads[index].transform.position; jumpTween = Go.to(transform, manager.jumpDuration, new GoTweenConfig().position(target).setEaseType(manager.jumpEaseType)); jumpTween.setOnBeginHandler(tween => { frogAnimator.speed = 1f; canClick = false; }); jumpTween.setOnCompleteHandler(tween => { frogAnimator.speed = 0f; canClick = true; }); }
private void OnMovePlayerAvatar() { if (origin != null) { GlobalState.Instance.Services.Get <Service.BlockadeService>().Add(this); var effectsInstance = Instantiate(unlockEffects); effectsInstance.transform.SetParent(destination, false); Sound.PlaySoundEvent.Dispatch(Sound.SoundType.UnlockLevel); GoTween tween = transform.positionFrom(travelTime, origin.position); tween.easeCurve = easeCurve; tween.easeType = GoEaseType.AnimationCurve; tween.setOnCompleteHandler(OnAvatarMoveComplete); } }
private void Move(int index) { SetIndex(index); var target = (Vector2)pads.Pads[index].transform.position; jumpTween = Go.to(transform, manager.jumpDuration, new GoTweenConfig().position(target).setEaseType(manager.jumpEaseType)); jumpTween.setOnBeginHandler(tween => { frogAnimator.speed = 1f; canClick = false; }); jumpTween.setOnCompleteHandler(tween => { frogAnimator.speed = 0f; canClick = true; }); }
void RunAnimation() { // Check if we need to clean up the animation if (itemAnimation != null) { // Clean up this item animation from the animation queue Go.removeTween(itemAnimation); itemAnimation = null; } // Create and play a new animation affectedTransform.transform.parent = transform; itemAnimation = Go.to(affectedTransform.transform, animationDuration, itemAnimationConfiguration); itemAnimation.setOnCompleteHandler(UpdatePlatform); itemAnimation.play(); // Play audio audioScript.Play(); }
public void AnimatePositioningItem(Transform parentTo, System.Action <ItemPickup> endAnimationEvent, AudioType playSound = AudioType.None) { // Setup variables onAnimationEnd = endAnimationEvent; transform.parent = parentTo; // Setup animation configuration itemAnimationConfiguration.clearEvents(); itemAnimationConfiguration.clearProperties(); // Setup scale and rotation itemAnimationConfiguration.localRotation(Quaternion.identity); itemAnimationConfiguration.scale(Vector3.one); // Setup path itemTweenPath[0] = transform.localPosition; itemTweenPath[1] = new Vector3((transform.localPosition.x / 2f), midTweenOffset, 0); itemAnimationConfiguration.localPositionPath(new GoSpline(itemTweenPath)); // Check if we need to clean up the animation if (itemAnimation != null) { // Clean up this item animation from the animation queue Go.removeTween(itemAnimation); itemAnimation = null; } // Create and play a new animation itemAnimation = Go.to(transform, animationDuration, itemAnimationConfiguration); itemAnimation.setOnCompleteHandler(OnAnimationEnds); itemAnimation.play(); // Play a sound effect if (playSound == AudioType.Place) { PlayClip(dropSound); } else if (playSound == AudioType.PickUp) { PlayClip(pickupSound); } }
public void move(Vector3 pos, Vector3 scale, float tweenTime) { if (playlistNavManager.moving && currentTween != null) { currentTween.destroy(); } currentTween = Go.to(this, tweenTime, new GoTweenConfig() .vector3Prop("positionProp", pos) .vector3Prop("scaleProp", scale) .floatProp("alphaProp", fadeOutAlpha) .setEaseType(GoEaseType.ExpoOut)); currentTween.setOnCompleteHandler(c => { onMoveComplete(); }); }
public static GoTween destroyOnEnd(this GoTween self) { self.setOnCompleteHandler(c => GameObject.Destroy(self.target as Object)); return(self); }
public void startDay(AbstractGoTween agt = null) { orbitTween = Go.to(transform, m_maxDayDuration, new GoTweenConfig().rotation(new Vector3(0, 0, 360), true)); orbitTween.setOnCompleteHandler(startDay); }