private void prepend(TweenFlowItem item) { // early out for invalid items if (item.tween != null && !item.tween.isValid()) { return; } if (float.IsInfinity(item.duration)) { Debug.Log("adding a Tween with infinite iterations to a TweenChain is not permitted"); return; } // ensure the tween isnt already live if (item.tween != null) { Go.removeTween(item.tween); } // fix all the start times on our previous chains foreach (var ci in _tweenFlows) { ci.startTime += item.duration; } _tweenFlows.Add(item); // update the duration and total duration duration += item.duration; totalDuration = duration * iterations; }
/// <summary> /// the item being added already has a start time so no extra parameter is needed /// </summary> private void insert(TweenFlowItem item) { // early out for invalid items if (item.tween != null && !item.tween.isValid()) { return; } if (float.IsInfinity(item.duration)) { Debug.Log("adding a Tween with infinite iterations to a TweenFlow is not permitted"); return; } // ensure the tween isnt already live if (item.tween != null) { Go.removeTween(item.tween); } // add the item then sort based on startTimes _tweenFlows.Add(item); _tweenFlows.Sort((x, y) => { return(x.startTime.CompareTo(y.startTime)); }); duration = Mathf.Max(item.startTime + item.duration, duration); totalDuration = duration * iterations; }
private void append(TweenFlowItem item) { if (item.tween != null && !item.tween.isValid()) { return; } if (float.IsInfinity(item.duration)) { UnityEngine.Debug.LogError("adding a Tween with infinite iterations to a TweenChain is not permitted"); return; } if (item.tween != null) { if (item.tween.isReversed != base.isReversed) { UnityEngine.Debug.LogError("adding a Tween that doesn't match the isReversed property of the TweenChain is not permitted."); return; } Go.removeTween(item.tween); item.tween.play(); } _tweenFlows.Add(item); base.duration += item.duration; if (base.iterations < 0) { base.totalDuration = float.PositiveInfinity; } else { base.totalDuration = base.duration * (float)base.iterations; } }
private void append(TweenFlowItem item) { // early out for invalid items if (item.tween != null && !item.tween.isValid()) { return; } if (float.IsInfinity(item.duration)) { Debug.Log("adding a Tween with infinite iterations to a TweenChain is not permitted"); return; } // ensure the tween isnt already live if (item.tween != null) { Go.removeTween(item.tween); } _tweenFlows.Add(item); // update the duration and total duration duration += item.duration; if (iterations > 0) { totalDuration = duration * iterations; } else { totalDuration = float.PositiveInfinity; } }
private void insert(TweenFlowItem item) { if (item.tween != null && !item.tween.isValid()) { return; } if (float.IsInfinity(item.duration)) { UnityEngine.Debug.LogError("adding a Tween with infinite iterations to a TweenFlow is not permitted"); return; } if (item.tween != null) { if (item.tween.isReversed != base.isReversed) { UnityEngine.Debug.LogError("adding a Tween that doesn't match the isReversed property of the TweenFlow is not permitted."); return; } Go.removeTween(item.tween); item.tween.play(); } _tweenFlows.Add(item); _tweenFlows.Sort((TweenFlowItem x, TweenFlowItem y) => x.startTime.CompareTo(y.startTime)); base.duration = Mathf.Max(item.startTime + item.duration, base.duration); if (base.iterations < 0) { base.totalDuration = float.PositiveInfinity; } else { base.totalDuration = base.duration * (float)base.iterations; } }
static public int removeTween_s(IntPtr l) { try { AbstractGoTween a1; checkType(l, 1, out a1); var ret = Go.removeTween(a1); pushValue(l, ret); return(1); } catch (Exception e) { return(error(l, e)); } }
private void prepend(TweenFlowItem item) { // early out for invalid items if (item.tween != null && !item.tween.isValid()) { return; } if (float.IsInfinity(item.duration)) { Debug.LogError("adding a Tween with infinite iterations to a TweenChain is not permitted"); return; } if (item.tween != null) { if (item.tween.isReversed != isReversed) { Debug.LogError("adding a Tween that doesn't match the isReversed property of the TweenChain is not permitted."); return; } // ensure the tween isnt already live Go.removeTween(item.tween); // ensure that the item is marked to play. item.tween.play(); } // fix all the start times on our previous chains for (int k = 0; k < _tweenFlows.Count; ++k) { TweenFlowItem flowItem = _tweenFlows[k]; flowItem.startTime += item.duration; } _tweenFlows.Insert(0, item); // update the duration and total duration duration += item.duration; if (iterations < 0) { totalDuration = float.PositiveInfinity; } else { totalDuration = duration * iterations; } }
public void ModeChange(SelectMode mode) { if (mode == SelectMode.Enemy && TurnManager.Instance.CurrentCharacter.Team != Me.Team) { selectable = true; gt = Go.to(GetComponent <SpriteRenderer>(), 0.5f, flashing); } else { Go.removeTween(gt); GetComponent <SpriteRenderer>().color = Color.white; selectable = false; } }
/// <summary> /// the item being added already has a start time so no extra parameter is needed /// </summary> private void insert(TweenFlowItem item) { // early out for invalid items if (item.tween != null && !item.tween.isValid()) { return; } if (float.IsInfinity(item.duration)) { Debug.LogError("adding a Tween with infinite iterations to a TweenFlow is not permitted"); return; } if (item.tween != null) { if (item.tween.isReversed != isReversed) { Debug.LogError("adding a Tween that doesn't match the isReversed property of the TweenFlow is not permitted."); return; } // ensure the tween isnt already live Go.removeTween(item.tween); // ensure that the item is marked to play. item.tween.play(); } // add the item then sort based on startTimes _tweenFlows.Add(item); _tweenFlows.Sort((x, y) => { return(x.startTime.CompareTo(y.startTime)); }); duration = Mathf.Max(item.startTime + item.duration, duration); if (iterations < 0) { totalDuration = float.PositiveInfinity; } else { totalDuration = duration * iterations; } }
private void append(TweenFlowItem item) { // early out for invalid items if (item.tween != null && !item.tween.isValid()) { return; } if (float.IsInfinity(item.duration)) { Debug.LogError("adding a Tween with infinite iterations to a TweenChain is not permitted"); return; } if (item.tween != null) { if (item.tween.isReversed != isReversed) { Debug.LogError("adding a Tween that doesn't match the isReversed property of the TweenChain is not permitted."); return; } // ensure the tween isnt already live Go.removeTween(item.tween); // ensure that the item is marked to play. item.tween.play(); } _tweenFlows.Add(item); // update the duration and total duration duration += item.duration; if (iterations < 0) { totalDuration = float.PositiveInfinity; } else { totalDuration = duration * iterations; } }
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(); }
/// <summary> /// the item being added already has a start time so no extra parameter is needed /// </summary> private void insert(TweenFlowItem item) { // early out for invalid items if (item.tween != null && !item.tween.isValid()) { return; } if (float.IsInfinity(item.duration)) { Debug.Log("adding a Tween with infinite iterations to a TweenFlow is not permitted"); return; } // ensure the tween isnt already live if (item.tween != null) { Go.removeTween(item.tween); } // add the item then sort based on startTimes // _tweenFlows.Add( item ); // _tweenFlows.Sort( ( x, y ) => // { // return x.startTime.CompareTo( y.startTime ); // } ); int insertionIndex = _tweenFlows.Count; while (insertionIndex > 0) { if (item.startTime >= _tweenFlows[insertionIndex - 1].startTime) { break; } insertionIndex--; } _tweenFlows.Insert(insertionIndex, item); duration = Mathf.Max(item.startTime + item.duration, duration); totalDuration = duration * iterations; }
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); } }
/// <summary> /// removes the Tween from action and cleans up its state /// </summary> public virtual void destroy() { state = TweenState.Destroyed; Go.removeTween(this); }
public void EndGame() { FlyOutUIElements(); scoreLabel.text = string.Format("{0:#,###0}", score); for (int i = hearts.Count - 1; i >= 0; i--) { FSprite heart = hearts[i]; foreach (AbstractTween tween in Go.tweensWithTarget(heart)) { Go.removeTween(tween); } heart.RemoveFromContainer(); hearts.Remove(heart); } if (score >= 1000000) { StartHeartShower(); FSoundManager.StopMusic(); FSoundManager.PlaySound("happyPiano"); gameIsOver = true; FLabel label = new FLabel("SoftSugar", "I love you times a million!"); label.color = new Color(0.12f, 0.12f, 0.12f, 1.0f); label.x = Futile.screen.halfWidth; label.y = Futile.screen.halfHeight; label.scale = 0; AddChild(label); TweenConfig config = new TweenConfig() .floatProp("scale", 1.0f) .setEaseType(EaseType.SineInOut) .onComplete(OnWinLabelDoneAppearing); Go.to(label, 0.5f, config); } if (numHeartsMissed >= 5) { gameIsOver = true; FSoundManager.StopMusic(); FSoundManager.PlaySound("sadPiano"); FLabel topLabel = new FLabel("SoftSugar", "Are you kidding me?!"); FLabel bottomLabel = new FLabel("SoftSugar", string.Format("I love you way more than x{0:#,###0}!", score)); topLabel.color = new Color(0.75f, 0.12f, 0.12f, 1.0f); bottomLabel.color = new Color(0.12f, 0.12f, 0.12f, 1.0f); bottomLabel.x = topLabel.x = Futile.screen.halfWidth; float bottomBeginning = 300f; float segmentHeight = (Futile.screen.height - bottomBeginning * 2f) / 3f; bottomLabel.y = segmentHeight - bottomLabel.textRect.height / 2f + bottomBeginning; topLabel.y = segmentHeight * 3f - topLabel.textRect.height / 2f + bottomBeginning; bottomLabel.scale = topLabel.scale = 0; AddChild(topLabel); AddChild(bottomLabel); TweenConfig config1 = new TweenConfig() .floatProp("scale", 1.0f) .setEaseType(EaseType.SineInOut); TweenConfig config2 = new TweenConfig() .floatProp("scale", 0.75f) .setEaseType(EaseType.SineInOut); float duration = 0.5f; TweenChain chain = new TweenChain(); chain.append(new Tween(topLabel, duration, config1)); chain.append(new Tween(bottomLabel, duration, config2)); chain.setOnCompleteHandler(OnGameShouldBeFullyOver); Go.addTween(chain); chain.play(); } }