//=============== SCALE =================== /** Add a tween on scale and start it. Time is in seconds */ public TweenTransform ScaleTo(Transform _target, Vector3 _destination, float _time) { TweenTransform tween = new TweenTransform(TweenTransform.Type.SCALE, _time, _target, _destination); m_tweens.Add(tween); return(tween); }
// Use this for initialization void Start() { // the notification is a panel with a tween transform CounterResetNotificationAnimation = this.gameObject.GetComponent <TweenTransform>(); if (CounterResetNotificationAnimation == null) { Debug.LogError("Counter Reset Notification, this GO has no TweenTransform"); hasanimation = false; return; } CounterResetNotificationUIPanel = this.gameObject.GetComponent <UIPanel>(); if (CounterResetNotificationUIPanel == null) { Debug.LogError("Counter Reset Notification, this GO has no UI Panel"); hasUIPanel = false; return; } hasanimation = true; hasUIPanel = true; // we can use it! }
bool Init() { _tweenScale = gameObject.GetComponent <TweenScale>(); if (IconLocTarget != null) { _tweenTransform = IconLocTarget.GetComponent <TweenTransform>(); isFullyInit = false; return(isFullyInit); } if (_tweenScale != null) { _haveTweenScale = true; } if (_tweenTransform != null) { _haveTweenTrans = true; // // set the to and from for the tween transform // _tweenTransform.Reset(); // _tweenTransform.Play(true); } isFullyInit = true; return(isFullyInit); }
/** Add a tween on position and start it. Time is in seconds */ public TweenTransform PositionTo(Transform _target, Vector3 _destination, float _time) { TweenTransform tween = new TweenTransform(TweenTransform.Type.POSITION, _time, _target, _destination); m_tweens.Add(tween); return(tween); }
private static Sequence TweenMove(Transform transform, TweenTransform transformTo, float duration) => DOTween .Sequence() .Append(transform.DOMove(transformTo.Position, duration)) .Insert(0, transform.DORotate(transformTo.Rotation, duration)) .Insert(0, transform.DOScale(transformTo.Scale, duration)) ;
private void Awake() { Transform transform = UnityEngine.Object.Instantiate <Transform>(this._optionMenuPrefab); transform.parent = base.transform; transform.localPosition = Vector3.zero; transform.localScale = Vector3.one; OptionMenuTweens component = transform.GetComponent <OptionMenuTweens>(); for (int i = 0; i < component._backwardTweener.Length; i++) { if (component._backwardTweener[i] != null) { component._backwardTweener[i].tweenTarget = base.gameObject; } } for (int j = 0; j < component._forwardTweener.Length; j++) { if (component._forwardTweener[j] != null) { component._forwardTweener[j].tweenTarget = this._mainMenuGO; } } if (component._centerOnScreen) { UIRoot componentInParent = base.GetComponentInParent <UIRoot>(); component.transform.position = componentInParent.transform.position; TweenTransform component2 = base.GetComponent <TweenTransform>(); if (component2) { component.transform.position -= component2.to.position - component2.from.position; } } }
void StopMoveCamera() { if (IsMovePlayer || IsInitChangeScreenOverlay) { return; } if (GetComponent <iTween>() != null) { iTween.Stop(gameObject); } TweenTransform TweenTranscript = GmObj.GetComponent <TweenTransform>(); if (TweenTranscript != null && TweenTranscript.enabled) { TweenTranscript.enabled = false; } /*if (GameCtrlXK.AudioHitBt != null && !IsPlayAudioBt) { * IsPlayAudioBt = true; * Invoke("ResetIsPlayAudioBt", 0.8f); * AudioManager.Instance.PlaySFX(GameCtrlXK.AudioHitBt); * }*/ NoiseScript.enabled = false; InitChangeScreenOverlay(); }
/** Add a tween on scale and start it. Time is in seconds * Callback receive an object as parameter * Callback object by default is the transform _target. Set custom with TweenEngine.Tween.CallbackObject */ public TweenTransform ScaleTo(Transform _target, Vector3 _destination, float _time, string _callbackName) { TweenTransform tween = ScaleTo(_target, _destination, _time); tween.CallbackName = _callbackName; return(tween); }
public static TweenTransform Begin(GameObject go, float duration, Transform from, Transform to) { TweenTransform tweenTransform = UITweener.Begin <TweenTransform>(go, duration); tweenTransform.@from = from; tweenTransform.to = to; return(tweenTransform); }
/// <summary> /// Start the tweening operation. /// </summary> static public TweenTransform Begin(GameObject go, float duration, Transform from, Transform to) { TweenTransform comp = UITweener.Begin <TweenTransform>(go, duration); comp.from = from; comp.to = to; return(comp); }
void Start() { if (Tw == null) { Tw = gameObject.AddComponent <TweenTransform>(); } Tw.onFinished.Add(new EventDelegate(this, "Go")); //Go (); }
static public TweenTransform SetTransform(GameObject go, Transform transform, float duration = 1f) { TweenTransform twt = Tweener.InitGO <TweenTransform>(go, duration); twt.beginTransform = twt.CachedTransform; twt.endTransform = transform; twt.Play(true); return(twt); }
void Awake() { ObjectToTween = GameObject.Find("CameraBase"); myTween = ObjectToTween.GetComponent<TweenTransform>(); if (ObjectToTween == null) Debug.LogError("CameraBase could not be located!"); manager = GameObject.Find("BusinessManager").GetComponent<BusinessManager>(); }
/** Add a tween on rotation around Z and start it. Time is in seconds * Callback receive an object as parameter * Callback object by default is the transform _target. Set custom with TweenEngine.Tween.CallbackObject */ public TweenTransform RotateAroundZTo(Transform _target, float _destination, float _time) { Vector3 dest = _target.localEulerAngles; dest.z = _destination; TweenTransform tween = new TweenTransform(TweenTransform.Type.ROTATION, _time, _target, dest); m_tweens.Add(tween); return(tween); }
/** Add a tween on position and start it. Time is in seconds * Callback receive an object as parameter (the target GameObject) * Callback object by default is the transform _target. Set custom with TweenEngine.Tween.CallbackObject */ public TweenTransform PositionTo(Transform _target, Vector3 _destination, float _time, bool _yoyo, int _repeat, string _callbackName) { TweenTransform tween = new TweenTransform(TweenTransform.Type.POSITION, _time, _target, _destination); tween.Yoyo = _yoyo; tween.Repeat = _repeat; tween.CallbackName = _callbackName; m_tweens.Add(tween); return(tween); }
// 我的车库 private void GarageScene() { if (currentState == GUIManager.GameState.UpgradeScene) { TweenTransform.Begin(_UpgradeScene, 0.5f, PositionA, PositionB); TweenTransform.Begin(_GarageScene, 0.5f, PositionB, PositionA); } TweenTransform.Begin(_GarageScene, 0.5f, PositionB, PositionA); TweenTransform.Begin(_MainMenuScene, 0.5f, PositionA, PositionB); currentState = GUIManager.GameState.GarageScene; }
private Task partTask(GameObject obj, Transform transform, float duration) { TweenTask tt = new TweenTask(delegate() { Debug.Log(transform.name); Tween tween = TweenTransform.Begin(obj, duration, transform); tween.method = _method; return(tween); }); return(tt); }
protected override UITweener startCloseEffectInternal(GameObject widget) { if (widget == trRoot) { TweenTransform tt = TweenTransform.Begin(widget, duration, toTr, fromTr); tt.style = UITweener.Style.Once; return(tt as UITweener); } return(null); }
void Awake() { ExplorerBusiness eb = GetComponent<ExplorerBusiness>(); ObjectToTween = GameObject.Find("Main Camera"); myTween = ObjectToTween.GetComponent<TweenTransform>(); if (ObjectToTween == null) Debug.LogError("CameraBase could not be located!"); manager = GameObject.Find("BusinessManager").GetComponent<BusinessManager>(); myPos = new Vector2(transform.localPosition.x, transform.localPosition.z); gameObject.SetActive( manager.busByCoord.ContainsKey(eb.Coordinates)); }
static int _s_set_to(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { TweenTransform __cl_gen_to_be_invoked = (TweenTransform)translator.FastGetCSObj(L, 1); __cl_gen_to_be_invoked.to = (UnityEngine.Transform)translator.GetObject(L, 2, typeof(UnityEngine.Transform)); } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(0); }
static public int get_to(IntPtr l) { try { TweenTransform self = (TweenTransform)checkSelf(l); pushValue(l, true); pushValue(l, self.to); return(2); } catch (Exception e) { return(error(l, e)); } }
void OnSettingBtnClick(GameObject _settingBtn) //单击设置按钮 { AudioManager.Instance.SoundPlay(Global.GetInstance().audioName_BtnClick); m_settingMusicSlider[0].value = GameManager.Instance.GetVolume(0); m_settingMusicSlider[1].value = GameManager.Instance.GetVolume(1); m_mainPanel.SetActive(false); //关闭主界面面板 m_settingScenePanel.SetActive(true); //开启设置界面面板 m_transAni = m_settingScenePanel.AddComponent <TweenTransform> (); //给设置面板开启移动组件 m_transAni.from = m_panelTransPos [0]; //移动的初始位置 m_transAni.to = m_panelTransPos [1]; //移动的终止位置 m_transAni.duration = 0.5f; //移动时长 }
static int _g_get_to(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { TweenTransform __cl_gen_to_be_invoked = (TweenTransform)translator.FastGetCSObj(L, 1); translator.Push(L, __cl_gen_to_be_invoked.to); } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(1); }
static int _s_set_parentWhenFinished(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { TweenTransform __cl_gen_to_be_invoked = (TweenTransform)translator.FastGetCSObj(L, 1); __cl_gen_to_be_invoked.parentWhenFinished = LuaAPI.lua_toboolean(L, 2); } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(0); }
public void Start() { PAWS = this; windowTransform = myWindow.GetComponent <TweenTransform>(); band = Band.transform; ActivityManager.Instance.pause = this; // //Enable the curtains // CurtainLeft.gameObject.SetActive(true); // CurtainRight.gameObject.SetActive(true); }
// Token: 0x060002B0 RID: 688 RVA: 0x00021830 File Offset: 0x0001FA30 public static TweenTransform Begin(GameObject go, float duration, Transform from, Transform to) { TweenTransform tweenTransform = UITweener.Begin <TweenTransform>(go, duration); tweenTransform.from = from; tweenTransform.to = to; if (duration <= 0f) { tweenTransform.Sample(1f, true); tweenTransform.enabled = false; } return(tweenTransform); }
public IEnumerator PageToLeftPageAnimation() { TweenTransform tween = Background.GetComponent <TweenTransform>(); tween.to = FrameWork.FindChild("Frame_Right"); tween.from = FrameWork.FindChild("Frame_Left"); tween.ResetToBeginning(); tween.PlayForward(); BackButtonTarget.SetActive(true); yield return(new WaitForSeconds(tween.duration)); gameObject.SetActive(false); }
/** Add a tween on rotation around Z and start it. Time is in seconds * Callback receive an object as parameter * Callback object by default is the transform _target. Set custom with TweenEngine.Tween.CallbackObject */ public TweenTransform RotateAroundZTo(Transform _target, float _destination, float _time, bool _yoyo, int _repeat, string _callbackName) { Vector3 dest = _target.localEulerAngles; dest.z = _destination; TweenTransform tween = new TweenTransform(TweenTransform.Type.ROTATION, _time, _target, dest); tween.Yoyo = _yoyo; tween.Repeat = _repeat; tween.CallbackName = _callbackName; m_tweens.Add(tween); return(tween); }
static public int constructor(IntPtr l) { try { TweenTransform o; o = new TweenTransform(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// Start the tweening operation. /// </summary> static public TweenTransform Begin(GameObject go, float duration, Transform from, Transform to) { TweenTransform comp = UITweener.Begin <TweenTransform>(go, duration); comp.from = from; comp.to = to; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } return(comp); }
static public int set_from(IntPtr l) { try { TweenTransform self = (TweenTransform)checkSelf(l); UnityEngine.Transform v; checkType(l, 2, out v); self.from = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_parentWhenFinished(IntPtr l) { try { TweenTransform self = (TweenTransform)checkSelf(l); System.Boolean v; checkType(l, 2, out v); self.parentWhenFinished = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
// Use this for initialization void Start () { GameManager gm = GameManager.Instanace; pos = gm.baymax.transform; transform.parent = this.transform; treeTT = GetComponent<TweenTransform> (); treeTT.from = start; treeTT.to = end; treeTT.duration = duration; treeTT.enabled = true; ta = GetComponent<TweenAlpha> (); gm.tweenscript.Add (treeTT); GetComponent<UI2DSprite> ().enabled = true; }
// Use this for initialization void Start() { _view = this.GetComponent<CoherentUIView>(); _view.OnViewCreated += new UnityViewListener.CoherentUI_OnViewCreated(this.OnViewReady); myTween = gameObject.GetComponent<TweenTransform>(); _view.Listener.ReadyForBindings += (frameId, path, isMainFrame) => { _view.View.BindCall("LoadAdPlayer", (System.Action<string>)LoadAdPlayer); _view.View.BindCall("OnBusinessWasSelected", (System.Action)OnBusinessWasSelected); _view.View.BindCall("AddBusinesses", (System.Action)AddBusinesses); _view.View.BindCall("CloseBusinessList", (System.Action)CloseBusinessList); _view.View.BindCall("LoadAdData", (System.Action)LoadAdData); _view.View.BindCall("MenuClosed", (System.Action)MenuClosed); }; if (Application.platform == RuntimePlatform.IPhonePlayer) _view.InputState = CoherentUIView.CoherentViewInputState.TakeNone; gameObject.GetComponent<CoherentUIView>().FlipY = true; }
void Awake() { ObjectToTween = GameObject.Find("Main Camera"); myTween = ObjectToTween.GetComponent<TweenTransform>(); }
/** Change position, rotation and scale. */ public IEnumerator TweenToCoroutine(TweenTransform tweenTransform, TweenDefinition definition) { int movingId = tweenTransform.ChangePosition && tweenTransform.Position != transform.position ? ++_movingId : -1; int rotatingId = tweenTransform.ChangeRotation && tweenTransform.Rotation != transform.rotation ? ++_rotatingId : -1; int scalingId = tweenTransform.ChangeScale && !IsLocalScaleMulti(tweenTransform.LocalScaleMulti) ? ++_scalingId : -1; if (movingId == -1 && rotatingId == -1 && scalingId == -1) yield break; Debug.Log("TweenTo " + tweenTransform.Position + " gameObject " + gameObject); // position nosmooth Vector3 deltaPos = (tweenTransform.Position - transform.position); Vector3 deltaNormalized = deltaPos; deltaNormalized.Normalize(); Vector3 velocity; float factor; // starting values Vector3 startScale = transform.localScale; Vector3 newScale = _startingScale * tweenTransform.LocalScaleMulti; Quaternion startRot = transform.rotation; Vector3 startPos = transform.position; // precompute duration float duration = 1; if (movingId != -1) duration = GetMoveTime(transform.position, tweenTransform.Position, definition.StartSpeed, definition.Acceleration); else if (scalingId != -1) duration = (newScale - startScale).sqrMagnitude; else duration = Quaternion.Angle(tweenTransform.Rotation, startRot); // smoothdamp float smoothSpeed = 0; float timeFactor = 1 / duration; float t = 0; float smoothT = 0; // for time // float timeEnd = Time.time + definition.ForTime; float timeStart = Time.time; _transformingCnt++; while (true) { /* debug if (_movingId != -1) transform.position = tweenTransform.Position; if (_rotatingId != -1) transform.rotation = tweenTransform.Rotation; if (_scalingId != -1) transform.localScale = newScale; break; */ // if (definition.ForTime != 0 && Time.time >= timeEnd) // break; t = t + Time.deltaTime * timeFactor; if (definition.Type == TweenDefinition.TransformType.NoSmooth) { if (movingId == _movingId) { // TODO: some bug here (from minion on table to opponent hero it takes longer time than from opponent hero to minion on table) velocity = Vector3.Lerp(Vector3.zero, deltaNormalized, Time.deltaTime); factor = definition.StartSpeed; if (definition.Acceleration != 0) factor = factor + definition.Acceleration * (Time.time - timeStart); // Debug.Log("MOVE base velocity " + velocity + " factor " + factor + " timeDelta " + Time.deltaTime); velocity = velocity * factor; transform.position += velocity; if (t >= 1) { transform.position = tweenTransform.Position; // Debug.Log("MOVE END from " + transform.position + " to " + tweenTransform.Position); movingId = -1; } } if (rotatingId == _rotatingId) transform.rotation = Quaternion.Slerp(startRot, tweenTransform.Rotation, t); if (scalingId == _scalingId) transform.localScale = Vector3.Lerp(startScale, newScale, t); if (t >= 1) break; } else if (definition.Type == TweenDefinition.TransformType.SmoothOut) { smoothT = Mathf.SmoothDamp(smoothT, 1f, ref smoothSpeed, duration); if (smoothT > 0.999f) smoothT = 1; if (movingId == _movingId) transform.position = Vector3.Lerp(startPos, tweenTransform.Position, smoothT); if (rotatingId == _rotatingId) transform.rotation = Quaternion.Slerp(startRot, tweenTransform.Rotation, smoothT); if (scalingId == _scalingId) transform.localScale = Vector3.Lerp(startScale, newScale, smoothT); if (smoothT >= 1) break; } // TODO: GS opposite to smooth out else if (definition.Type == TweenDefinition.TransformType.SmoothIn) { smoothT = Mathf.SmoothDamp(smoothT, 1f, ref smoothSpeed, duration); if (smoothT > 0.999f) smoothT = 1; if (movingId == _movingId) transform.position = Vector3.Lerp(startPos, tweenTransform.Position, smoothT); if (rotatingId == _rotatingId) transform.rotation = Quaternion.Slerp(startRot, tweenTransform.Rotation, smoothT); if (scalingId == _scalingId) transform.localScale = Vector3.Lerp(startScale, newScale, smoothT); if (smoothT >= 1) break; } else if (definition.Type == TweenDefinition.TransformType.SmoothInOut) { smoothT = Mathf.SmoothStep(0f, 1f, t); if (movingId == _movingId) transform.position = Vector3.Lerp(startPos, tweenTransform.Position, smoothT); if (rotatingId == _rotatingId) transform.rotation = Quaternion.Slerp(startRot, tweenTransform.Rotation, smoothT); if (scalingId == _scalingId) transform.localScale = Vector3.Lerp(startScale, newScale, smoothT); if (smoothT >= 1) break; } yield return null; } _transformingCnt--; Debug.Log("TweenTo ENDED " + tweenTransform == null ? "null" : tweenTransform.Position + " gameObject " + gameObject); }
// Use this for initialization void Start() { menuLabel = (TweenTransform) (GetComponent("TweenTransform")); }
void SetTransformAnimation() { tran = this.GetComponent<TweenTransform>(); }
private void launchDialogCamera() { GameObject CameraPrefab = Resources.Load( "UI Prefabs/Prefabs/SystemUICamera" ) as GameObject; //Debug.Log (">>>>>> launch Camera1111111111(" + CameraPrefab + ")"); mNGUI2DCamera = Utility.Instantiate( CameraPrefab ) as GameObject; //Debug.Log (">>>>>> launch Camera2222222222"); mNGUI2DCamera.name = CameraPrefab.name; Transform cameraTr = mNGUI2DCamera.transform.FindChild("Camera"); m_uiCamera = cameraTr.GetComponent<Camera>(); mNGUI2DDialogCameraTr = cameraTr.transform.FindChild("Link"); mNGUI2DDialogCameraTr.localPosition = Vector3.zero; mNGUI2DDialogCameraTr.localRotation = Quaternion.identity; mNGUI2DDialogCameraTr.localScale = Utility.GetScreenRatio(); m_baffle = mNGUI2DDialogCameraTr.FindChild("Baffle").GetComponent<BoxCollider>(); m_baffle.enabled = false; m_baffle.transform.localScale = new Vector3( Screen.width, Screen.height, 0.0f ); m_CLRCam = mNGUI2DCamera.transform.FindChild("CLRCam").GetComponent<Camera>(); m_CLRCam.enabled = false; //m_LoadingPgCam = mNGUI2DCamera.transform.FindChild("LoadingCam").GetComponent<Camera>(); m_LoadingProgressBar = mNGUI2DCamera.transform.FindChild("LoadingCam/LoadingIndicator Panel/LoadingProgressBar").GetComponent<UISlider>(); m_LoadingProgressBar.gameObject.SetActiveRecursively(false); m_LoadingPgSprite = mNGUI2DCamera.transform.FindChild("LoadingCam/LoadingIndicator Panel/MovingObj/LoadingIndicator").GetComponent<UISprite>(); m_LoadingPgSprite.enabled = false; m_LoadingSprite = mNGUI2DCamera.transform.FindChild("LoadingCam/LoadingIndicator Panel/MovingObj/LoadSprite").GetComponent<UISprite>(); m_LoadingSprite.enabled = false; m_LoadingPgRotator = mNGUI2DCamera.transform.FindChild("LoadingCam/LoadingIndicator Panel/MovingObj/LoadingIndicator").GetComponent<TweenTransform>(); m_LoadingPgRotator.enabled = false; m_LoadingCollider = mNGUI2DCamera.transform.FindChild("LoadingCam").GetComponent<BoxCollider>(); m_LoadingCollider.enabled = false; m_Tips = mNGUI2DCamera.transform.FindChild("LoadingCam/LoadingIndicator Panel/Tips").GetComponent<UILabel>(); m_Tips.enabled = false; m_LoadingCam = mNGUI2DCamera.transform.FindChild("IndicateCam").GetComponent<Camera>(); m_loadingIndicatorRotator = mNGUI2DCamera.transform.FindChild("IndicateCam/LoadingIndicator Panel/LoadingIndicator").GetComponent<TweenTransform>(); m_loadingIndicatorRotator.enabled = false; m_loadingIndicatorSprite = mNGUI2DCamera.transform.FindChild("IndicateCam/LoadingIndicator Panel/LoadingIndicator").GetComponent<UISprite>(); m_loadingIndicatorSprite.enabled = false; //Debug.Log (">>>>>> launch Camera"); DontDestroyOnLoad(mNGUI2DCamera); DontDestroyOnLoad(mNGUI2DDialogCameraTr); }