void Start() { Application.targetFrameRate = 60; Go.defaultEaseType = GoEaseType.Linear; Go.duplicatePropertyRule = GoDuplicatePropertyRuleType.None; Go.validateTargetObjectsEachTick = true; var sharedTweenConfig = new GoTweenConfig(); for (i = 0; i < cubes.Length; i++) { var cube = GameObject.CreatePrimitive(PrimitiveType.Cube); Destroy(cube.GetComponent <BoxCollider>()); cube.transform.position = new Vector3(i * 0.1f - 10, cube.transform.position.y, i % 10); cubes[i] = cube; origPos[i] = cube.transform.position; props[i] = new PositionTweenProperty(Vector3.zero); tweens[i] = new GoTween(cubes[i].transform, 1.0f, sharedTweenConfig); tweens[i].autoRemoveOnComplete = false; tweens[i].addTweenProperty(props[i]); tweens[i].pause(); Go.addTween(tweens[i]); } StartCoroutine(runTest()); }
static public int scale(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (matchType(l, argc, 2, typeof(UnityEngine.Vector3), typeof(bool))) { GoTweenConfig self = (GoTweenConfig)checkSelf(l); UnityEngine.Vector3 a1; checkType(l, 2, out a1); System.Boolean a2; checkType(l, 3, out a2); var ret = self.scale(a1, a2); pushValue(l, ret); return(1); } else if (matchType(l, argc, 2, typeof(float), typeof(bool))) { GoTweenConfig self = (GoTweenConfig)checkSelf(l); System.Single a1; checkType(l, 2, out a1); System.Boolean a2; checkType(l, 3, out a2); var ret = self.scale(a1, a2); pushValue(l, ret); return(1); } return(error(l, "No matched override function to call")); } catch (Exception e) { return(error(l, e)); } }
void Start() { // create a TweenConfig that we will use on all 4 cubes var config = new GoTweenConfig() .setEaseType( GoEaseType.QuadIn ) // set the ease type for the tweens .materialColor( Color.magenta ) // tween the material color to magenta .eulerAngles( new Vector3( 0, 360, 0 ) ) // do a 360 rotation .position( new Vector3( 2, 8, 0 ), true ) // relative position tween so it will be start from the current location .setIterations( 2, GoLoopType.PingPong ); // 2 iterations with a PingPong loop so we go out and back // create the chain and set it to have 2 iterations var chain = new GoTweenChain(new GoTweenCollectionConfig().setIterations( 2 )); // add a completion handler for the chain chain.setOnCompleteHandler( c => Debug.Log( "chain complete" ) ); // create a Tween for each cube and it to the chain foreach( var cube in cubes ) { var tween = new GoTween( cube, 0.5f, config ); chain.append( tween ); } _tween = chain; }
public static void TransitionFadeOut(FNode node,float delay) { GoTweenConfig config=new GoTweenConfig().floatProp("alpha",0f).onComplete(FSpeechBubbleManager.Instance.RemoveFromContainer); config.easeType=GoEaseType.ExpoOut; config.delay=delay; Go.to (node,0.5f,config); }
public void TurnOff(float time = 0.1f, Action <AbstractGoTween> onComplete = null) { if (!isOn && time != 0) { Debug.LogWarning("trying to lower shield while already lowered"); } Go.killAllTweensWithTarget(sprite); Action <AbstractGoTween> internalOnComplete = (tween) => { shieldCollider.enabled = false; isOn = false; if (onComplete != null) { onComplete(tween); } }; Color newColor = sprite.color; if (time == 0) { newColor.a = 0; sprite.color = newColor; internalOnComplete(null); } else { newColor.a = 0; GoTweenConfig config = new GoTweenConfig().colorProp("color", newColor).onComplete(internalOnComplete); Go.to(sprite, time, config); } }
public static GoTween MakeTween( Transform TheTransform, Vector3 Position, Quaternion Rotation, float MoveTime = 0.5f, bool IsLocal = false, GoEaseType Ease = GoEaseType.Linear, VoidDelegate OnCompleteFunction = null ) { GoTweenConfig Config = new GoTweenConfig(); Config.addTweenProperty(new PositionTweenProperty(Position, false, IsLocal)); //Config.addTweenProperty(new EulerAnglesTweenProperty(Rotation, false, IsLocal)); Config.addTweenProperty(new RotationQuaternionTweenProperty(Rotation, false, IsLocal)); Config.setEaseType(Ease); if(OnCompleteFunction != null){ Config.onComplete(c => { OnCompleteFunction(); }); } GoTween NewTween = new GoTween(TheTransform, MoveTime, Config); Go.addTween(NewTween); return NewTween; }
private void keyDownDetector() { if (Input.GetKey (KeyCode.W)) { transform.Translate(new Vector3(0,0,Speed)); }else if(Input.GetKey (KeyCode.S)){ transform.Translate(new Vector3(0,0,-Speed)); }else if(Input.GetKey (KeyCode.A)){ transform.Translate(new Vector3(-Speed,0,0)); }else if(Input.GetKey (KeyCode.D)){ transform.Translate(new Vector3(Speed,0,0)); }else if(Input.GetKey (KeyCode.K)){ myShip.transform.Rotate(new Vector3(0,0,Speed)); }else if(Input.GetKey (KeyCode.L)){ myShip.transform.Rotate(new Vector3(0,0,-Speed)); } if (Input.GetKeyUp (KeyCode.K)) { GoTweenConfig config = new GoTweenConfig(); config.setIterations(1); config.localRotation(new Vector3(0,0,360)); config.easeType = GoEaseType.ExpoOut; Go.to(myShip.transform,0.5f,config); } else if (Input.GetKeyUp (KeyCode.L)) { GoTweenConfig config = new GoTweenConfig(); config.setIterations(1); config.localRotation(new Vector3(0,0,-360)); config.easeType = GoEaseType.ExpoOut; Go.to(myShip.transform,0.5f,config); } }
void Start() { // create a TweenConfig that we will use on all 4 cubes var config = new GoTweenConfig() .setEaseType(GoEaseType.QuadIn) // set the ease type for the tweens .materialColor(Color.magenta) // tween the material color to magenta .eulerAngles(new Vector3(0, 360, 0)) // do a 360 rotation .position(new Vector3(2, 8, 0), true) // relative position tween so it will be start from the current location .setIterations(2, GoLoopType.PingPong); // 2 iterations with a PingPong loop so we go out and back // create the chain and set it to have 2 iterations var chain = new GoTweenChain(new GoTweenCollectionConfig().setIterations(2)); // add a completion handler for the chain chain.setOnCompleteHandler(c => Debug.Log("chain complete")); // create a Tween for each cube and it to the chain foreach (var cube in cubes) { var tween = new GoTween(cube, 0.5f, config); chain.append(tween); } _tween = chain; }
private void PushPlayerBackRepositionGuards(Player player) { pushingPlayer += 3; var playerPos2D = player.transform.position.ToXZ(); var myPos2D = this.transform.position.ToXZ(); var pushVector = 2 * (playerPos2D - myPos2D).ToX0Z().normalized; var midpoint = ((playerPos2D - myPos2D) * 0.5f + myPos2D).ToX0Z(); var perp = (playerPos2D - myPos2D).Perpendicular().normalized.ToX0Z(); var newGuardForward = (playerPos2D - myPos2D).normalized.ToX0Z(); float alternatingSign = 1f; foreach (var guard in guards) { guard.collider.enabled = false; guard.transform.forward = newGuardForward; guard.transform.positionTo(0.65f, midpoint + (perp * 1f * alternatingSign)).setOnCompleteHandler(OnPushPlayerTweenActionComplete); alternatingSign *= -1f; } var playerTweenConfig = new GoTweenConfig() .position(player.transform.position + pushVector) .vector3Prop("forward", -newGuardForward) .onComplete(OnPushPlayerTweenActionComplete); Go.to(player.transform, 0.65f, playerTweenConfig); }
void Start() { Application.targetFrameRate = 60; Go.defaultEaseType = GoEaseType.Linear; Go.duplicatePropertyRule = GoDuplicatePropertyRuleType.None; Go.validateTargetObjectsEachTick = true; var sharedTweenConfig = new GoTweenConfig(); for( i = 0; i < cubes.Length; i++ ) { var cube = GameObject.CreatePrimitive( PrimitiveType.Cube ); //int r = Random.Range(0, Buildings.Count); //var cube = (GameObject)Instantiate(Buildings[r]); Destroy( cube.GetComponent<BoxCollider>() ); cube.transform.position = new Vector3( i * 0.1f - 10, cube.transform.position.y, i % 100 ); cubes[i] = cube; origPos[i] = cube.transform.position; props[i] = new PositionTweenProperty( Vector3.zero ); tweens[i] = new GoTween( cubes[i].transform, 1.0f, sharedTweenConfig ); tweens[i].autoRemoveOnComplete = false; tweens[i].addTweenProperty( props[i] ); tweens[i].pause(); Go.addTween( tweens[i] ); } StartCoroutine( runTest() ); }
public void Event() { if(firstRun) { firstRun = false; spline = new GoSpline(eventPath); var pathProperty = new PositionPathTweenProperty(spline); var config = new GoTweenConfig(); config.addTweenProperty(pathProperty); var tween = new GoTween(PoPCamera.instance.transform, pathLength, config); Go.addTween(tween); if(multipleTargets) { focusTimer = focusPoints[0].time; } } if(multipleTargets) { if(focusTimer >= focusPoints[focusIndex].time && focusIndex != focusPoints.Count - 1) { focusIndex++; } Quaternion rotation = Quaternion.LookRotation(focusPoints[focusIndex].focus - PoPCamera.instance.transform.position); PoPCamera.instance.transform.rotation = Quaternion.Slerp(PoPCamera.instance.transform.rotation, rotation, 0.4f); } else { Quaternion rotation = Quaternion.LookRotation(singleTargetPos - PoPCamera.instance.transform.position); PoPCamera.instance.transform.rotation = Quaternion.Slerp(PoPCamera.instance.transform.rotation, rotation, 0.4f); } if(pathLength < 0) { PoPCamera.State = Camera_2.CameraState.Normal; Destroy(this.gameObject); } else pathLength -= Time.deltaTime; }
private IEnumerator Spawn(bool initial) { if (!initial) { inputEnabled = false; HideShip(); Vector3 messagePoint = StartPosition() + new Vector3(-0.25f, 0.25f, 0.0f); MessageManager.ShowMessage("3", messagePoint); yield return(new WaitForSeconds(1.2f)); MessageManager.ShowMessage("2", messagePoint); yield return(new WaitForSeconds(1.2f)); MessageManager.ShowMessage("1", messagePoint); yield return(new WaitForSeconds(1.2f)); } inputEnabled = true; ResetShip(); var tween = new GoTweenConfig(); tween.easeType = GoEaseType.BounceOut; tween.onComplete(SpawnComplete); Go.to(transform, 1.0f, tween.scale(1.0f)); StartCoroutine(ApplyInvincibility()); }
void Start() { // create a TweenConfig that we will use on all 4 cubes var config = new GoTweenConfig() .setEaseType( GoEaseType.QuadIn ) // set the ease type for the tweens .materialColor( Color.magenta ) // tween the material color to magenta .eulerAngles( new Vector3( 0, 360, 0 ) ) // do a 360 rotation .position( new Vector3( 2, 8, 0 ), true ) // relative position tween so it will be start from the current location .setIterations( 2, GoLoopType.PingPong ); // 2 iterations with a PingPong loop so we go out and back; // create the flow and set it to have 2 iterations var flow = new GoTweenFlow(new GoTweenCollectionConfig().setIterations( 2 )); // add a completion handler for the chain flow.setOnCompleteHandler( c => Debug.Log( "flow complete" ) ); // create a Tween for each cube and it to the flow var startTime = 0f; foreach( var cube in cubes ) { var tween = new GoTween( cube, 0.5f, config ); flow.insert( startTime, tween ); // increment our startTime so that the next tween starts when this one is halfway done startTime += 0.25f; } _tween = flow; }
static public int setIterations(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { GoTweenConfig self = (GoTweenConfig)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); var ret = self.setIterations(a1); pushValue(l, ret); return(1); } else if (argc == 3) { GoTweenConfig self = (GoTweenConfig)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); GoLoopType a2; checkEnum(l, 3, out a2); var ret = self.setIterations(a1, a2); pushValue(l, ret); return(1); } return(error(l, "No matched override function to call")); } catch (Exception e) { return(error(l, e)); } }
private void HideMainPanelPage() { bgColorConfig.setIterations(1); bgColorConfig.colorProp("color", Color.black); bgColorConfig.easeType = GoEaseType.ExpoOut; Image bgImg = bg.GetComponent <Image> (); Go.to(bgImg, 1f, bgColorConfig); for (int i = 0; i < btnsTrans.Count; i++) { GoTweenConfig config = new GoTweenConfig(); config.localPosition(new Vector3(800, 110 * (1 - i), 0), false); config.delay = 0.05f * i; config.setIterations(1); config.easeType = GoEaseType.ExpoOut; Go.to(btnsTrans [i].transform, 1f, config); } GoTweenConfig topBarConfig = new GoTweenConfig(); topBarConfig.setIterations(1); topBarConfig.localPosition(new Vector3(0, 250, 0)); topBarConfig.delay = 0.5f; topBarConfig.easeType = GoEaseType.ExpoOut; Go.to(GameObject.Find("TopBar").transform, 0.5f, topBarConfig); shipConfig = new GoTweenConfig(); shipConfig.localPosition(new Vector3(-1200, -40, -162)); shipConfig.easeType = GoEaseType.ExpoOut; Go.to(GameObject.Find("ShipModel").transform, 1f, shipConfig); }
void Start() { // create a TweenConfig that we will use on all 4 cubes var config = new GoTweenConfig() .setEaseType(GoEaseType.QuadIn) // set the ease type for the tweens .materialColor(Color.magenta) // tween the material color to magenta .eulerAngles(new Vector3(0, 360, 0)) // do a 360 rotation .position(new Vector3(2, 8, 0), true) // relative position tween so it will be start from the current location .setIterations(2, GoLoopType.PingPong); // 2 iterations with a PingPong loop so we go out and back; // create the flow and set it to have 2 iterations var flow = new GoTweenFlow(new GoTweenCollectionConfig().setIterations(2)); // add a completion handler for the chain flow.setOnCompleteHandler(c => Debug.Log("flow complete")); // create a Tween for each cube and it to the flow var startTime = 0f; foreach (var cube in cubes) { var tween = new GoTween(cube, 0.5f, config); flow.insert(startTime, tween); // increment our startTime so that the next tween starts when this one is halfway done startTime += 0.25f; } _tween = flow; }
public void GoTo(Coord c) { if (_clickAnimationing) { return; } _clickAnimationing = true; Vector3 prePos = MapCamera.transform.localPosition; Vector3 lookPos = prePos + (Layout.HexCenter(c) - Layout.ScreenPos2WorldPos(MapCamera, MapInfoHighlightPos)); GoTweenConfig config = new GoTweenConfig(); FloatCallbackTweenProterty ftpy = new FloatCallbackTweenProterty(0, 1, delegate(float obj) { MoveCamera(Vector3.Lerp(prePos, lookPos, obj)); }); config.addTweenProperty(ftpy); config.onCompleteHandler = delegate(AbstractGoTween go) { _clickAnimationing = false; //App.ProxyMgr.MapProxy.GetBlockDataFromServer(); }; Go.to(MapCamera.transform, 1f, config); }
public void DoClickOnTile(Coord c) { MapTileVO mt = GameFacade.GetProxy <MapProxy>().GetTile(c); _clickAnimationing = true; Vector3 prePos = MapCamera.transform.localPosition; Vector3 lookPos = prePos + (Layout.HexCenter(c) - Layout.ScreenPos2WorldPos(MapCamera, MapInfoHighlightPos)); GoTweenConfig config = new GoTweenConfig(); FloatCallbackTweenProterty ftpy = new FloatCallbackTweenProterty(0, 1, delegate(float obj) { MoveCamera(Vector3.Lerp(prePos, lookPos, obj)); }); config.addTweenProperty(ftpy); config.onCompleteHandler = delegate(AbstractGoTween go) { _clickAnimationing = false; }; ShowHighLight(Layout.HexCenter(c)); Go.to(MapCamera.transform, 0.5f, config); if (onClickHandler != null) { onClickHandler(c); } }
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 from(object target, float duration, GoTweenConfig config) { config.setIsFrom(); GoTween goTween = new GoTween(target, duration, config); addTween(goTween); return(goTween); }
void Fade() { float targetAlpha = fadeDirection == FadeDirection.fade_out ? 0 : 1; GoTweenConfig config = new GoTweenConfig().floatProp("alpha", targetAlpha).setEaseType(GoEaseType.CubicIn).onUpdate(UpdateAlpha); Go.addTween(new GoTween(this, fadeDuration, config)); }
public void Start() { SelectionController.Instance.OnSelectModeChange.AddListener(ModeChange); flashing = new GoTweenConfig(); flashing.addTweenProperty(new ColorTweenProperty("color", Color.red)); flashing.loopType = GoLoopType.PingPong; flashing.iterations = -1; }
public override void Initialize() { _showConfig = new GoTweenConfig().localPosition(Vector3.one).setEaseType(Type); _hideConfig = new GoTweenConfig().localPosition(_hideFinishVector3).setEaseType(Type); _showPanelConfig = new GoTweenConfig().floatProp("Alpha", 1f).setEaseType(Type); _hidePanelConfig = new GoTweenConfig().floatProp("Alpha", 0f).setEaseType(Type); }
protected void Click(Vector2 touch) { GoTweenConfig config; //config=new TweenConfig().colorProp("bottomColor",RandomUtils.RandomColor()).colorProp("topColor",RandomUtils.RandomColor()); //Go.to (_bicolorSprite0,0.25f,config); config=new GoTweenConfig().colorProp("bottomColor",RandomUtils.RandomColor()).colorProp("topColor",RandomUtils.RandomColor()); Go.to (_bicolorSprite1,0.25f,config); }
public override void Initialize() { _showConfig = new GoTweenConfig().scale(Vector3.one).setEaseType(Type).setUpdateType(GoUpdateType.TimeScaleIndependentUpdate); _showPanelConfig = new GoTweenConfig().floatProp("Alpha", 1f).setEaseType(Type).setUpdateType(GoUpdateType.TimeScaleIndependentUpdate); _hideConfig = new GoTweenConfig().scale(_upscaled).setEaseType(Type).setUpdateType(GoUpdateType.TimeScaleIndependentUpdate); _hidePanelConfig = new GoTweenConfig().floatProp("Alpha", 0f).setEaseType(Type).setUpdateType(GoUpdateType.TimeScaleIndependentUpdate); }
/// <summary> /// Anchored position tween /// </summary> public static GoTweenConfig anchoredPosition(this GoTweenConfig goTweenConfig, Vector2 endValue, bool isRelative = false) { var prop = new AnchoredPositionTweenProperty(endValue, isRelative); goTweenConfig.tweenProperties.Add(prop); return(goTweenConfig); }
/// <summary> /// helper function that creates a "to" Tween and adds it to the pool /// </summary> public static GoTween to(object target, float duration, GoTweenConfig config) { var tween = new GoTween(target, duration, config); addTween(tween); return(tween); }
private void MovePanel() { GoTweenConfig config = new GoTweenConfig (); config.easeType = GoEaseType.BackOut; config.setIterations (1); config.localPosition (Vector3.zero,false); Go.to (GameObject.Find ("ScorePanel").transform, 0.5f, config); }
/// <summary> /// initializes a new instance and sets up the details according to the config parameter /// </summary> public GoTween(object target, float duration, GoTweenConfig config, Action <AbstractGoTween> onComplete = null) { // default to removing on complete autoRemoveOnComplete = true; this.target = target; this.targetName = target.ToString(); this.duration = duration; // copy the TweenConfig info over id = config.id; delay = config.delay; loopType = config.loopType; iterations = config.iterations; _easeType = config.easeType; updateType = config.propertyUpdateType; isFrom = config.isFrom; timeScale = config.timeScale; _onComplete = config.onCompleteHandler; _onStart = config.onStartHandler; _onIterate = config.onIterateHandler; if (config.isPaused) { state = GoTweenState.Paused; } // if onComplete is passed to the constructor it wins. it is left as the final param to allow an inline Action to be // set and maintain clean code (Actions always try to be the last param of a method) if (onComplete != null) { _onComplete = onComplete; } // add all our properties for (var i = 0; i < config.tweenProperties.Count; i++) { var tweenProp = config.tweenProperties[i]; // if the tween property is initialized already it means it is being reused so we need to clone it if (tweenProp.isInitialized) { tweenProp = tweenProp.clone(); } addTweenProperty(tweenProp); } // calculate total duration if (iterations < 0) { totalDuration = float.PositiveInfinity; } else { totalDuration = iterations * duration; } }
private void HideTopBar() { GoTweenConfig topBarConfig = new GoTweenConfig(); topBarConfig.setIterations(1); topBarConfig.localPosition(new Vector3(0, 375, 0)); topBarConfig.easeType = GoEaseType.ExpoOut; Go.to(GameObject.Find("TopBar").transform, 0.5f, topBarConfig); }
private void MovePanel() { GoTweenConfig config = new GoTweenConfig(); config.easeType = GoEaseType.BackOut; config.setIterations(1); config.localPosition(Vector3.zero, false); Go.to(GameObject.Find("ScorePanel").transform, 0.5f, config); }
public GoTween(object target, float duration, GoTweenConfig config, Action <AbstractGoTween> onComplete = null) { if (duration <= 0f) { duration = float.Epsilon; UnityEngine.Debug.LogError("tween duration must be greater than 0. coerced to float.Epsilon."); } base.autoRemoveOnComplete = true; base.allowEvents = true; _didInit = false; _didBegin = false; _fireIterationStart = true; this.target = target; targetType = target.GetType(); base.duration = duration; base.id = config.id; delay = config.delay; base.loopType = config.loopType; base.iterations = config.iterations; _easeType = config.easeType; easeCurve = config.easeCurve; base.updateType = config.propertyUpdateType; isFrom = config.isFrom; base.timeScale = config.timeScale; _onInit = config.onInitHandler; _onBegin = config.onBeginHandler; _onIterationStart = config.onIterationStartHandler; _onUpdate = config.onUpdateHandler; _onIterationEnd = config.onIterationEndHandler; _onComplete = config.onCompleteHandler; if (config.isPaused) { base.state = GoTweenState.Paused; } if (onComplete != null) { _onComplete = onComplete; } for (int i = 0; i < config.tweenProperties.Count; i++) { AbstractTweenProperty abstractTweenProperty = config.tweenProperties[i]; if (abstractTweenProperty.isInitialized) { abstractTweenProperty = abstractTweenProperty.clone(); } addTweenProperty(abstractTweenProperty); } if (base.iterations < 0) { base.totalDuration = float.PositiveInfinity; } else { base.totalDuration = (float)base.iterations * duration; } }
public static GoTween from(object target, GoSpline path, float speed, GoTweenConfig config) { config.setIsFrom(); path.buildPath(); float duration = path.pathLength / speed; GoTween goTween = new GoTween(target, duration, config); addTween(goTween); return(goTween); }
static public int clear(IntPtr l) { try { GoTweenConfig self = (GoTweenConfig)checkSelf(l); self.clear(); return(0); } catch (Exception e) { return(error(l, e)); } }
public static void Start(Transform[] ts, Vector3[] to) { GoTweenConfig goConfig = new GoTweenConfig().setEaseType(GoEaseType.QuadInOut).setIterations(-1, GoLoopType.PingPong); for (int i = 0; i < ts.Length; ++i) { goConfig.clearProperties(); goConfig.addTweenProperty(new PositionTweenProperty(to[i])); Go.to(ts[i], 1, goConfig); } }
private void OnTriggerExit(Collider other) { var doorMove = new Vector3[] { new Vector3( 0, 0, 0 ), new Vector3( 0, 0, -0.25f), new Vector3( 0, 0, -0.5f)}; var path = new GoSpline( doorMove ); path.closePath(); GoTweenConfig doorConfig = new GoTweenConfig().positionPath(path,true).onComplete(DoorCleanup); doorConfig.setEaseType(GoEaseType.QuadInOut); Go.to( transform, openTime, doorConfig); }
public override void DoClickToAct() { var doorMove = new Vector3[] { new Vector3( 0, 0, 0 ), new Vector3( 0, 0, 0.25f), new Vector3( 0, 0, 0.5f)}; var path = new GoSpline( doorMove ); path.closePath(); GoTweenConfig doorConfig = new GoTweenConfig().positionPath(path,true).onComplete(DoorCleanup); doorConfig.setEaseType(GoEaseType.QuadInOut); Go.to( transform, openTime, doorConfig); }
public void SpinElevator() { RotationTweenProperty rotationProperty = new RotationTweenProperty (new Vector3 (0, -180, 0), true, true); GoTweenConfig rotConfig = new GoTweenConfig ().addTweenProperty (rotationProperty); rotConfig.setEaseType(GoEaseType.QuadInOut); //Go.to( player.transform, rideTime, rotConfig); Go.to( transform.parent.gameObject.transform, spinTime, rotConfig); }
static public int get_propertyUpdateType(IntPtr l) { try { GoTweenConfig self = (GoTweenConfig)checkSelf(l); pushEnum(l, (int)self.propertyUpdateType); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int get_autoClear(IntPtr l) { try { GoTweenConfig self = (GoTweenConfig)checkSelf(l); pushValue(l, self.autoClear); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int get_tweenProperties(IntPtr l) { try { GoTweenConfig self = (GoTweenConfig)checkSelf(l); pushValue(l, self.tweenProperties); return(1); } catch (Exception e) { return(error(l, e)); } }
public GoTween to(object target, GoSpline path, float speed, GoTweenConfig config) { config.setIsTo(); path.buildPath(); float duration = path.pathLength / speed; var tween = new GoTween(target, duration, config); addTween(tween); return(tween); }
void Start() { var config = new GoTweenConfig().localRotation(new Vector3(-30, 0, 0)).setEaseType(GoEaseType.CubicInOut); config.loopType = GoLoopType.PingPong; config.setIterations(-1); float duration = 2; var tween = new GoTween(transform, duration, config); Go.addTween(tween); }
public static void Start(SampleClass[] cs, float[] to) { GoTweenConfig goConfig = new GoTweenConfig().setEaseType(GoEaseType.QuadInOut).setIterations(-1, GoLoopType.PingPong); for (int i = 0; i < cs.Length; ++i) { goConfig.clearProperties(); goConfig.floatProp("floatVal", to[i]); Go.to(cs[i], 1, goConfig); } }
public override void DoClickToAct() { RotationTweenProperty rotationProperty = new RotationTweenProperty (new Vector3 (0, -90, 0), true, true); GoTweenConfig config = new GoTweenConfig(); config.addTweenProperty( rotationProperty ); var tween = new GoTween( transform, openingTime, config, OnOpenComplete ); Go.addTween (tween); GetComponent<AudioSource>().PlayOneShot (doorOpenSound, doorOpenSoundVolume); }
// set up the tweens used in health behavior protected void InitializeTweens() { // Tween configuration MaterialColorTweenProperty red = new MaterialColorTweenProperty(Color.red); GoTweenConfig rConfig = new GoTweenConfig(); rConfig.addTweenProperty(red); rConfig.setIterations(6); rConfig.loopType = GoLoopType.PingPong; // Make a tween to turn the gameObject red turnRed = new GoTween(this.gameObject, .5f, rConfig); }
public override void DoClickToAct() { var jumpPath = new Vector3[] { new Vector3( 0, 0, 0 ), new Vector3( -jumpLength/2, jumpHeight, 0), new Vector3( -jumpLength, 0, 0 )}; var path = new GoSpline( jumpPath ); path.closePath(); //GoTweenConfig stepConfig = new GoTweenConfig().positionPath(path,true).onComplete(OnJumpComplete); GoTweenConfig jumpConfig = new GoTweenConfig().positionPath(path,true).onComplete(JumpGapCleanup); jumpConfig.setEaseType(GoEaseType.QuadInOut); Go.to( player.transform, jumpGapTime, jumpConfig); Invoke ("PlayLandAudio", timeTillPlayLand); }
public override void DoClickToAct() { //ScaleTweenProperty DoorScale = new blabla buttonPush.Push (); var elevatorPath = new Vector3[] { new Vector3( 0, 0, 0 ), new Vector3( 0, 2.4f, 0 )}; var path = new GoSpline( elevatorPath ); //path.closePath(); GoTweenConfig stepConfig = new GoTweenConfig().positionPath(path,true).onComplete(OpenDoors); stepConfig.setEaseType(GoEaseType.QuadInOut); Go.to( transform.parent.gameObject.transform, callTime, stepConfig); }
public void HideList() { CancelInvoke ("RotateShip"); _ship.SetActive(false); GoTweenConfig config = new GoTweenConfig (); config.setIterations (1); config.easeType = GoEaseType.ExpoOut; config.localPosition (new Vector3 (-590, -30, 0)); config.delay = 0.5f; Go.to (transform, 0.5f, config); }
public void DestroyPlayerShip() { expls = Instantiate(Explosion,this.gameObject.transform.position, Quaternion.Euler(new Vector3(0,0,0))) as GameObject; this.gameObject.SetActive (false); GoTweenConfig config = new GoTweenConfig (); config.onComplete (delegate { Destroy (this.gameObject); GlobalManager.isPassed = false; GlobalManager.GotoStatisticPanel (); PlayerPrefs.SetInt("Score",GlobalManager.score); PlayerPrefs.SetInt("Level",GlobalManager.level); }); Go.to (this.gameObject.transform, 2, config); }
/// <summary> /// initializes a new instance and sets up the details according to the config parameter /// </summary> public GoTween( object target, float duration, GoTweenConfig config, Action<AbstractGoTween> onComplete = null ) { // default to removing on complete autoRemoveOnComplete = true; this.target = target; this.targetName = target.ToString(); this.duration = duration; // copy the TweenConfig info over id = config.id; delay = config.delay; loopType = config.loopType; iterations = config.iterations; _easeType = config.easeType; updateType = config.propertyUpdateType; isFrom = config.isFrom; timeScale = config.timeScale; _onComplete = config.onCompleteHandler; _onStart = config.onStartHandler; _onIterate = config.onIterateHandler; if( config.isPaused ) state = GoTweenState.Paused; // if onComplete is passed to the constructor it wins. it is left as the final param to allow an inline Action to be // set and maintain clean code (Actions always try to be the last param of a method) if( onComplete != null ) _onComplete = onComplete; // add all our properties for( var i = 0; i < config.tweenProperties.Count; i++ ) { var tweenProp = config.tweenProperties[i]; // if the tween property is initialized already it means it is being reused so we need to clone it if( tweenProp.isInitialized ) tweenProp = tweenProp.clone(); addTweenProperty( tweenProp ); } // calculate total duration if( iterations < 0 ) totalDuration = float.PositiveInfinity; else totalDuration = iterations * duration; }
// Use this for initialization void Start() { ProgressBar.transform.localPosition = new Vector3 (-500,0,0); GoTweenConfig config = new GoTweenConfig (); config.localPosition(new Vector3 (0, 0, 0)); config.delay = 1f; config.setIterations (1); config.onUpdate (delegate(AbstractGoTween obj) { onProgress(); }); config.onComplete (delegate { GlobalManager.GotoGamePanel(); }); Go.to (ProgressBar.transform, 4, config); }
public override void DoClickToAct() { if(isJumping == false) { //Bob isJumping = true; //clickToInstruction.renderer.enabled = false; var headPopPoints = new Vector3[] { new Vector3( 0, 0, 0 ), new Vector3( 0, 1, 0), new Vector3( 0, 0, 0 )}; var path = new GoSpline( headPopPoints ); path.closePath(); GoTweenConfig stepConfig = new GoTweenConfig().positionPath(path,true).onComplete(OnJumpComplete); stepConfig.setEaseType(GoEaseType.QuadOut); Go.to( player.transform, jumpTime, stepConfig); } }
public void MoveWindow(int easeType) { switch (easeType) { case 0: Go.defaultEaseType = GoEaseType.Linear; break; case 1: Go.defaultEaseType = GoEaseType.BackOut; break; case 2: Go.defaultEaseType = GoEaseType.BounceOut; break; case 3: Go.defaultEaseType = GoEaseType.CircInOut; break; case 4: Go.defaultEaseType = GoEaseType.SineOut; break; default: Go.defaultEaseType = GoEaseType.Linear; break; } float move = 0; if (goScreen) { move = -length; } else { move = length; } var moveUpConfig = new GoTweenConfig().position(new Vector3(move, 0), true); moveUpConfig.onComplete(orginalTween => Done()); var tweenOne = new GoTween(this.transform, duration, moveUpConfig); var chain = new GoTweenChain(); chain.append(tweenOne); chain.play(); }
public void ShowList() { _ship.transform.localPosition = new Vector3 (1500, 0, -120); _ship.SetActive(true); InvokeRepeating ("RotateShip", 0f, 0.002f); GoTweenConfig config = new GoTweenConfig (); config.setIterations (1); config.easeType = GoEaseType.ExpoOut; config.localPosition (new Vector3 (-390, -30, 0)); config.delay = 0.5f; Go.to (transform, 0.5f, config); config = new GoTweenConfig (); config.scale (new Vector3 (200, 200, 200)); config.localPosition (new Vector3 (50, 0, -120)); config.easeType = GoEaseType.ExpoOut; Go.to (_ship.transform, 1f, config); }
private void Move(Transform target, Vector3 to, Vector3 back, float duration) { animationReady = false; Go.defaultEaseType = GoEaseType.Linear; var moveUpConfig = new GoTweenConfig().position( to, true ); var moveBackConfig = new GoTweenConfig().position( -back, true ); moveBackConfig.onComplete(orginalTween => Done()); var tweenOne = new GoTween( target, duration, moveUpConfig); var tweenTwo = new GoTween( target, duration, moveBackConfig); var chain = new GoTweenChain(); chain.append(tweenOne).append(tweenTwo); chain.play(); }
public void FadeToPage(PageType pageType, Color color, float duration, bool force) { if(_currentPageType == pageType) if (!force) return; //we're already on the same page, so don't bother doing anything _transitionPageType=pageType; FSprite fadeSprite=new FSprite("Futile_White"); fadeSprite.scaleX=Futile.screen.width/fadeSprite.textureRect.width; fadeSprite.scaleY=Futile.screen.height/fadeSprite.textureRect.height; fadeSprite.color=color; fadeSprite.alpha=0f; _stage.AddChild(fadeSprite); GoTweenConfig config0=new GoTweenConfig().floatProp("alpha",1f).onComplete(MiddleTransition); config0.setEaseType(GoEaseType.Linear); //config0.setEaseType(EaseType.ExpoIn); //config0.setEaseType(EaseType.ElasticIn); Go.to (fadeSprite, duration*0.5f, config0); }
public override void DoClickToAct() { clickToStep.enabled = false; Vector3 nextPosition = new Vector3(nextPlatform.transform.position.x, nextPlatform.transform.position.y + jumpHitVerticalOffset, nextPlatform.transform.position.z); Vector3 jumpCenter; jumpCenter = player.transform.position + nextPlatform.transform.position; jumpCenter /= 2; jumpCenter.y += jumpHeight * Vector3.Distance(player.transform.position, nextPosition); //jumpCenter; Vector3[] jumpVecs = new Vector3[]{player.transform.position, jumpCenter ,new Vector3(nextPlatform.transform.position.x, nextPlatform.transform.position.y + jumpHitVerticalOffset, nextPlatform.transform.position.z)}; GoSpline path = new GoSpline (jumpVecs); //path.closePath (); GoTweenConfig jumpConfig = new GoTweenConfig().positionPath(path,false).onComplete(JumpCleanup); jumpConfig.setEaseType (GoEaseType.SineInOut); Go.to(player.transform, jumpTime, jumpConfig); //Invoke ("PlayLandAudio", jumpTime - 0.2f); }
public override void Start() { FSprite bg =new FSprite("colorgrid"); bg.shader=FShader.AdditiveColor; bg.color=new Color(0.1f,0.1f,0.1f); bg.scale=2f; AddChild(bg); base.Start(); for (int i=0;i<1;i++) { FSprite _holeBg=new FSprite("colorgrid"); _holeBg.scale=0.66f; _holeBg.color=Color.red; _holeBg.y=0; _holeBg.x=0; AddChild(_holeBg); GoTweenConfig config=new GoTweenConfig().oscillateFloatProp("rotation",90,1.5f,false,1); Go.to(_holeBg,1000000,config); FSprite _hole=new FSprite("sun"); _hole.scaleX=2f; _hole.scaleY=2f; _hole.alpha=0.0f; _hole.y=0; _hole.x=_holeBg.x; AddChild(_hole); FSpriteHolesShader shader=new FSpriteHolesShader(); shader.SetHole0(_hole); shader.UpdateEveryFrameHole0(true); config=new GoTweenConfig().oscillateFloatProp("y",120,5.5f,false,1); Go.to(_hole,1000000,config); config=new GoTweenConfig().oscillateFloatProp("rotation",180,10.5f,false,1); Go.to(_hole,1000000,config); _holeBg.shader=shader; } ShowTitle("Holes & masking with shaders"); }
protected void Click(Vector2 touch) { Go.killAllTweensWithTarget(_text); if (step==0) { _text.startVisibleCharIdx=0; GoTweenConfig config=new GoTweenConfig().intProp("endVisibleCharIdx",_text.charCount,false); Go.to(_text,2f,config); } else if (step==1) { _text.endVisibleCharIdx=_text.charCount; GoTweenConfig config=new GoTweenConfig().intProp("startVisibleCharIdx",_text.charCount,false); Go.to(_text,2f,config); } else if (step==2) { _text.endVisibleCharIdx=_text.charCount; GoTweenConfig config=new GoTweenConfig().intProp("startVisibleCharIdx",0,false); Go.to(_text,2f,config); } else { //step==3 _text.startVisibleCharIdx=0; GoTweenConfig config=new GoTweenConfig().intProp("endVisibleCharIdx",0,false); Go.to(_text,2f,config); } step++; if (step>=4) step=0; }