void AddOnPostion() { _position.onFinished.Clear(); _position = TweenPosition_2.Begin(gameObject, 1, EndPos.localPosition); _position.from = StartPos.localPosition; _position.AddOnFinished(ChangueSpriteToNormal); _position.AddOnFinished(EndAlpha); }
/// <summary> /// Start the tweening operation. /// </summary> static public TweenPosition_2 Begin(GameObject go, float duration, Vector3 pos) { TweenPosition_2 comp = UITweener.Begin <TweenPosition_2> (go, duration); comp.from = comp.value; comp.to = pos; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } return(comp); }
public override void OnInspectorGUI() { GUILayout.Space(6f); NGUIEditorTools.SetLabelWidth(120f); TweenPosition_2 tw = target as TweenPosition_2; GUI.changed = false; Vector3 from = EditorGUILayout.Vector3Field("From", tw.from); Vector3 to = EditorGUILayout.Vector3Field("To", tw.to); if (GUI.changed) { NGUIEditorTools.RegisterUndo("Tween Change", tw); tw.from = from; tw.to = to; NGUITools.SetDirty(tw); } DrawCommonProperties(); }
// Update is called once per frame void Update() { if (isCounting) { if (!sumTime) { sum += (int)(countSecond * Time.deltaTime); ++sum; if (sum > ManagerScore.Instance.CurrentScore) { //isCounting = false; sum = ManagerScore.Instance.CurrentScore; CheckCoins(); SetTextNum(); //enabled = false; sumTime = true; currentTime = ManagerTime.Instance.getCurrentTimeOfGame; //Showtime clock.transform.parent = transform; scalesT = TweenScale.Begin(clock.gameObject, 0.3f, new Vector3(1.3f, 1.3f, 1.3f)); scalesT.style = UITweener.Style.PingPong; clock.PlayFinalClock(currentTime / countSecondTime); texteffect.alpha = 1; tweenPos = TweenPosition_2.Begin <TweenPosition_2> (texteffect.gameObject, 0.1f); tweenPos.from = clockWid.transform.localPosition; tweenPos.to = textNum.transform.localPosition; tweenPos.style = UITweener.Style.Loop; } else { if (changued) { } else { CheckCoins(); SetTextNum(); changued = true; StartCoroutine("ChangueText", (secondToChangue)); } // } } else { float aux = (countSecondTime * Time.deltaTime); currentTime -= aux; if (currentTime <= 0) { currentTime += aux; sum += (int)(currentTime * ManagerScore.Instance.TimeBySecondScore); CheckCoins(); SetTextNum(); tweenPos.enabled = false; texteffect.alpha = 0; scalesT.enabled = false; clockWid.alpha = 0; timer.alpha = 0; scalesT = TweenScale.Begin(textNum.gameObject, 0.3f, new Vector3(1.3f, 1.3f, 1.3f)); scalesT.style = UITweener.Style.Once; currentTime = 0; isCounting = false; audioSum.Stop(); audioSum.clip = score03; audioSum.loop = false; audioSum.Play(); Invoke("DisableAudio", score03.length); enabled = false; } else { sum += (int)(aux * ManagerScore.Instance.TimeBySecondScore); CheckCoins(); SetTextNum(); } } } }