private void LoopExponentially( int length, int loopDepth, LoopType loopType, int index = 0, int nestLevel = 1, string value = "") { if (index++ < length) { if (nestLevel < loopDepth) { int startIndexNextLoop = 0; switch (loopType) { case LoopType.CombinationWithRepetitions: startIndexNextLoop = index - 1; break; case LoopType.CombinationWithoutRepetitions: startIndexNextLoop = index; break; } // loops in depth to the most nested loop LoopExponentially(length, loopDepth, loopType, startIndexNextLoop, nestLevel + 1, value + index); } if (value.Length == loopDepth - 1) { // do the action in the most nested loop loopAction(value + index); } // loops as a normal loop LoopExponentially(length, loopDepth, loopType, index, nestLevel, value); } }
public iTweenSimple(float time, LoopType type, System.Action<float> whenUpdate, System.Action whenRestart, System.Action whenComplete) { this.to(time, type, whenUpdate, whenRestart, whenComplete); }
public static Tweener DOMove(Transform target, Vector3 endValue, float duration, int loops = -1, LoopType loopType = LoopType.Yoyo, float delay = 0, System.Action doComplete = null) { Tweener tweener = target.DOMove(endValue, duration); tweener.SetLoops(loops, loopType); SetTweenerComplete(tweener, delay, doComplete); return tweener; }
private static List<Frame>.Enumerator Fix(List<Frame>.Enumerator e, LoopType l, ref int timeLeft) { IEnumerator<Frame> f = e; switch (l) { case LoopType.LoopEnough: { f.Reset(); int tL = timeLeft; while(f.MoveNext() && timeLeft > 0 && f.Current != null) { f.Current.Delay = Math.Min(tL, f.Current.OriginalDelay); tL -= f.Current.Delay; } f.Reset(); f.MoveNext(); return (List<Frame>.Enumerator)f; } case LoopType.FullLoop: { f.Reset(); int tL = 0; while (f.MoveNext() && f.Current != null) { tL += f.Current.OriginalDelay; f.Current.Delay = f.Current.OriginalDelay; } timeLeft = Math.Max(timeLeft, tL); f.Reset(); f.MoveNext(); return (List<Frame>.Enumerator)f; } default: throw new InvalidOperationException("OffsetAnimator.Fix called with invalid LoopType!"); } }
// Algorithm stolen from haha01haha01 http://code.google.com/p/hasuite/source/browse/trunk/HaRepackerLib/AnimationBuilder.cs public static IEnumerable<Frame> Process(Rectangle padding, Color background, LoopType loop, params List<Frame>[] zframess) { List<List<Frame>> framess = zframess.Select(aframess => aframess.Select(f => new Frame(f.Number, f.Image, new Point(-f.Offset.X, -f.Offset.Y), f.Delay)).ToList()).ToList(); framess = PadOffsets(Translate(framess), padding); Size fs = GetFrameSize(framess, padding); framess = framess.Select(f => f.OrderBy(z => z.Number).ToList()).ToList(); List<Frame> frames = MergeMultiple(framess, fs, background, loop).OrderBy(z => z.Number).ToList(); return FinalProcess(frames, fs, background); }
public void Run(LoopType type) { ThrowIfDisposed(); if (IsV4) ev_run(_native, type); else ev_loop(_native, type); }
public void playLoop(LoopType type, float delay) { if (type == LoopType.None) { loopSource.Stop(); } else { LoopData loop = getLoop(type); loopSource.clip = loop.clip; loopSource.volume = loop.volume; loopSource.PlayDelayed(delay); } }
LoopData getLoop(LoopType type) { switch(type) { case LoopType.Wind: return windLoop; case LoopType.Ocean: return oceanLoop; default: return null; } }
public void LoopCommandObjectCreatedIsSameAsAConstructedObject(LoopType loopType) { ILoopCommand commandFromFactory = (LoopCommand)commandFactory.NewLoopCommand(loopType); ILoopCommand commandConstructedDirectly = new LoopCommand(loopType); Assert.IsNotNull(commandFromFactory); Assert.AreEqual(typeof(LoopCommand), commandFromFactory.GetType()); Assert.AreEqual(commandConstructedDirectly.CommandType, commandFromFactory.CommandType); Assert.AreEqual(commandConstructedDirectly.LoopType, commandFromFactory.LoopType); }
void loadAnimatorData() { if(AMTimeline.window) { __aData = AMTimeline.window.aData; numFrames = __aData.getCurrentTake().numFrames; frameRate = __aData.getCurrentTake().frameRate; loopCount = __aData.getCurrentTake().numLoop; loopMode = __aData.getCurrentTake().loopMode; loopBackFrame = __aData.getCurrentTake().loopBackToFrame; } }
public void LoopChange(string input, LoopType loopType) { ILoopCommand _loopCommand = Stub<ILoopCommand>(); Expect.Call(_commandFactory.NewLoopCommand(loopType)).Return(_loopCommand); ReplayAll(); IList<ICommand> result = _textDiscriminator.Interpret(input); Assert.IsNotNull(result); Assert.AreEqual(1, result.Count); VerifyAll(); }
void loadAnimatorData() { if(AMTimeline.window) { __aData = AMTimeline.window.aData; AMTakeData take = aData.currentTake; numFrames = take.numFrames; frameRate = take.frameRate; loopCount = take.numLoop; loopMode = take.loopMode; loopBackFrame = take.loopBackToFrame; } }
public Player(IFileFinder fileFinder, IPlaylistReader playlistReader, IAudioStreamFactory audioStreamFactory, IBackgroundWorkerFactory backgroundWorkerFactory, IFileSystemFacade fileSystem) { this.fileFinder = fileFinder; this.playlistReader = playlistReader; this.backgroundWorkerFactory = backgroundWorkerFactory; this.audioStreamFactory = audioStreamFactory; this.fileSystem = fileSystem; history = new List<string>(); isStopped = true; isPlaying = false; isPaused = false; wasPausedBeforeBadSound = isPaused; loopType = LoopType.None; upto = 0; }
public void to(float time, LoopType type, System.Action<float> whenUpdate, System.Action whenRestart, System.Action whenComplete) { this.time_ = time < 0 ? 0 : time; this.loopType = time > 0 ? type : LoopType.none; this.percentage = 0; this.TweenStart(); this.whenUpdate = whenUpdate; this.whenRestart = whenRestart; this.whenComplete = whenComplete; if (time == 0){ this.percentage = 1; this.TweenComplete(); } }
/// <summary>Clears and resets this TweenParams instance using default values, /// so it can be reused without instantiating another one</summary> public TweenParams Clear() { id = target = null; updateType = DOTween.defaultUpdateType; isIndependentUpdate = DOTween.defaultTimeScaleIndependent; onStart = onPlay = onRewind = onUpdate = onStepComplete = onComplete = onKill = null; onWaypointChange = null; isRecyclable = DOTween.defaultRecyclable; isSpeedBased = false; autoKill = DOTween.defaultAutoKill; loops = 1; loopType = DOTween.defaultLoopType; delay = 0; isRelative = false; easeType = Ease.Unset; customEase = null; easeOvershootOrAmplitude = DOTween.defaultEaseOvershootOrAmplitude; easePeriod = DOTween.defaultEasePeriod; return this; }
/// <summary> /// Creates a new loop construct and attaches it to the logical tree. /// </summary> /// <param name="entry">The entry to the loop construct.</param> /// <param name="loopBody">Collection containing all of the constructs in the loop body.</param> /// <param name="loopType">The type of the loop.</param> /// <param name="loopCondition">The condition of the loop.</param> public LoopLogicalConstruct(ILogicalConstruct entry, HashSet<ILogicalConstruct> loopBody, LoopType loopType, ConditionLogicalConstruct loopCondition, TypeSystem typeSystem) { if (loopCondition != null) { loopCondition.LogicalContainer = this; } LoopType = loopType; LoopCondition = loopCondition; if(this.LoopType != LoopType.InfiniteLoop) { loopBody.Remove(LoopCondition); } DetermineLoopBodyBlock(entry, loopBody); RedirectChildrenToNewParent(GetLoopChildrenCollection()); FixLoopCondition(typeSystem); }
internal void reset() { // any pointers or values that are not guaranteed to be set later are defaulted here transform = null; targetVector = _startVector = _diffVector = Vector3.zero; delay = 0; loopType = LoopType.None; easeFunction = null; isRelativeTween = false; onComplete = onLoopComplete = null; customAction = null; _material = null; materialProperty = null; if( nextTween != null ) { // null out and return to the stack all additional tweens GoKitLite.instance._inactiveTweenStack.Push( nextTween ); nextTween.reset(); } nextTween = null; }
void NewSequence(LoopType loopType, bool flip) { main.Rewind(); main.Kill(); Sequence innerS0 = DOTween.Sequence() .SetId("INNER") // .SetLoops(3, loopType) .OnStepComplete(()=>Debug.Log("INNER Step Complete")); // .Append(targets[0].DOMoveX(3, 1).SetEase(Ease.Linear)); // innerS0.InsertCallback(0.25f, ()=> Callback("INNER")); Sequence innerS1 = DOTween.Sequence() .SetId("INNER INNER") // .SetLoops(3, loopType) .OnStepComplete(()=> Debug.Log("INNER INNER Step Complete")); innerS1.Append(targets[0].DOMoveX(3, 1).SetEase(Ease.Linear)); innerS1.InsertCallback(0.25f, ()=> Callback("INNER INNER")); innerS0.Append(innerS1); innerS0.InsertCallback(0.25f, ()=> Callback("INNER")); main = DOTween.Sequence() .SetId("MAIN") .SetLoops(3, loopType) .SetAutoKill(false) .OnStepComplete(()=> Debug.Log("MAIN Step Complete")); // .Append(targets[0].DOMoveX(3, 1).SetEase(Ease.Linear)); main.Append(innerS0); main.InsertCallback(0.25f, ()=> Callback("MAIN")); if (flip) { main.Complete(); main.Flip(); main.PlayBackwards(); } }
public override bool CreateTween(GameObject target, float duration, int loops, LoopType loopType) { CanvasGroup canvasGroup = target.GetComponent <CanvasGroup>(); if (canvasGroup == null) { Debug.LogError($"{target} does not have {TargetComponentType} component"); return(false); } TweenerCore <float, float, FloatOptions> canvasTween = canvasGroup.DOFade(alpha, duration); SetTween(canvasTween, loops, loopType); return(true); }
public CanvasGroupAnimation_Alpha(CanvasGroupAnimator materialAnimator, Action onCompleteAction, UIAnimation_Base.TweenType tweenType, float startValue, float endValue, float deltaValue, float duration, AnimationCurve easeCurve, LoopType loopType, int loopCount) : base(onCompleteAction, tweenType, startValue, endValue, deltaValue, duration, easeCurve, loopType, loopCount) { this.canvasGroupAnimator = materialAnimator; }
/// <summary> /// Sets the fallback animation to play and its loop type /// </summary> public void SetFallbackAnimation(string animation, LoopType loopType) { fallbackAnimation = GetAnimation(animation); fallbackLoopType = loopType; }
public TimedTask(string deviceId, int portNumber, bool enabled, string taskId, ExecType execType, ExecAction execAction, int executed, LoopType loopType, Moment moment, string loopMonent) : this() { DeviceId = deviceId; PortNumber = portNumber; Enabled = enabled; TaskId = taskId; ExecType = execType; ExecAction = execAction; Executed = executed;//未执行 执行中 已执行 LoopType = loopType; Moment = moment; LoopMonent = loopMonent; }
public Tweener <T, TTweenData> SetLoop(bool flag, LoopType loopType = LoopType.Normal) { Loop = flag; LoopType = loopType; return(this); }
private static Tween CreateRotationTween(GameObject obj, TweenType tweenType, TweenStyle tweenStyle, Transform point, Vector3 axis, float angle, float duration, LoopType loopType) { Tween tween = GetTween(obj, tweenType); if (tween == null) { tween = obj.AddComponent <Tween>(); } tween.angleSoFar = 0; tween.tweenType = tweenType; tween.tweenStyle = tweenStyle; tween.pointT = point; tween.axis = axis; tween.fromValue = 0; tween.toValue = angle; tween.duration = duration; tween.loopType = loopType; return(tween); }
/// <summary> /// Tweens the Z rotation of the GameObject /// </summary> public static Tween RotateZ(Transform transform, TweenStyle tweenStyle, float fromValue, float toValue, float duration, LoopType loopType = LoopType.None) { return(CreateTween(transform.gameObject, TweenType.RotateZ, tweenStyle, fromValue, toValue, duration, false, loopType)); }
public UICircleAnimation_Repetitions(UICircleAnimator myUICircleAnimator, Action onCompleteAction, TweenType tweenType, float startAngle, float endAngle, float deltaAngle, float duration, AnimationCurve easeCurve, LoopType loopType, int loopCount) : base(myUICircleAnimator, onCompleteAction, tweenType, startAngle, endAngle, deltaAngle, duration, easeCurve, loopType, loopCount) { }
public override void Reset() { base.Reset(); gameObject = null; duration = new FsmFloat { UseVariable = false }; setSpeedBased = new FsmBool { UseVariable = false, Value = false }; pathType = PathType.Linear; pathMode = PathMode.Full3D; resolution = new FsmInt { UseVariable = false, Value = 10 }; gizmoColor = new FsmColor { UseVariable = false }; closePath = new FsmBool { UseVariable = false, Value = false }; lockPosition = AxisConstraint.None; lockRotation = AxisConstraint.None; lookAt = LookAt.nothing; lookAtPosition = new FsmVector3 { UseVariable = false, Value = Vector3.zero }; lookAtTarget = new FsmGameObject { UseVariable = false, Value = null }; lookAhead = new FsmFloat { UseVariable = false, Value = 0 }; forwardDirection = new FsmVector3 { UseVariable = false, Value = Vector3.forward }; up = new FsmVector3 { UseVariable = false, Value = Vector3.up }; startEvent = null; finishEvent = null; finishImmediately = new FsmBool { UseVariable = false, Value = false }; startDelay = new FsmFloat { Value = 0 }; easeType = Ease.Linear; loops = new FsmInt { Value = 0 }; loopType = LoopType.Restart; autoKillOnCompletion = new FsmBool { Value = true }; recyclable = new FsmBool { Value = false }; updateType = UpdateType.Normal; isIndependentUpdate = new FsmBool { Value = false }; debugThis = new FsmBool { Value = false }; }
public UICircleAnimation_Float(UICircleAnimator myUICircleAnimator, Action onCompleteAction, TweenType tweenType, float startValue, float endValue, float deltaValue, float duration, AnimationCurve easeCurve, LoopType loopType, int loopCount) : base(onCompleteAction, tweenType, startValue, endValue, deltaValue, duration, easeCurve, loopType, loopCount) { this.myUICircleAnimator = myUICircleAnimator; }
public UICircleAnimation_Thickness(UICircleAnimator myUICircleAnimator, Action onCompleteAction, TweenType tweenType, float startThickness, float endThickness, float deltaThickness, float duration, AnimationCurve easeCurve, LoopType loopType, int loopCount) : base(myUICircleAnimator, onCompleteAction, tweenType, startThickness, endThickness, deltaThickness, duration, easeCurve, loopType, loopCount) { }
public override bool CreateTween(GameObject target, float duration, int loops, LoopType loopType) { TweenerCore <Vector3, Vector3, VectorOptions> moveTween; if (localMove) { moveTween = target.transform.DOLocalMove(GetPosition(), duration); } else { moveTween = target.transform.DOMove(GetPosition(), duration); } moveTween.SetOptions(axisConstraint); SetTween(moveTween, loops, loopType); return(true); }
public TweenScript SetLoopType(LoopType type, int loopCount = -1) { loopType = type; this.loopCount = loopCount; return(this); }
/// <summary> /// Level constructor /// </summary> public Level(int level) { levelNumber = level; rotateEaseType = Ease.Linear; rotateLoopType = LoopType.Incremental; sizeRayonRation = 0.25f; rotateDelay = 20f - (level % 10); if (level % 2 < 1) { rotateLoopType = LoopType.Incremental; } else { rotateLoopType = LoopType.Yoyo; } int numOfEnum = (System.Enum.GetValues(typeof(Ease)).Length); int enumNumber = level % numOfEnum; rotateEaseType = (Ease)(enumNumber); while (rotateEaseType.ToString().Contains("Elastic") || rotateEaseType.ToString().Contains("INTERNAL_Zero") || rotateEaseType.ToString().Contains("INTERNAL_Custom")) { enumNumber++; if (enumNumber >= numOfEnum) { enumNumber = 0; } rotateEaseType = (Ease)(enumNumber); } numberDotsOnCircle = (int)((10 + level % 35)); if (level < 12) { numberDotsOnCircle = 5; } if (level == 1) { numberDotsOnCircle = 1; } if (level == 2) { numberDotsOnCircle = 2; } if (level > maxLevel) { Util.SetLastLevelPlayed(Level.maxLevel); level = Level.maxLevel; Util.SetMaxLevelUnlock(Level.maxLevel); Application.OpenURL("http://barouch.fr/moregames.php"); } }
/// <summary> /// Adds supplied Euler angles in degrees to a GameObject's rotation over time. /// </summary> /// <param name="amount"> /// A <see cref="Vector3"/> /// </param> /// <param name="time"> /// A <see cref="System.Single"/> /// </param> /// <param name="delay"> /// A <see cref="System.Single"/> /// </param> /// <param name="easetype"> /// A <see cref="EaseType"/> /// </param> /// <param name="looptype"> /// A <see cref="LoopType"/> /// </param> public static void RotateAdd(this GameObject go,Vector3 amount,float time,float delay,EaseType easeType,LoopType loopType){ iTween.RotateAdd(go,iTween.Hash("amount",amount,"time",time,"delay",delay,"easeType",easeType.ToString(),"looptype",loopType.ToString())); }
public ATweener <T1, T2> SetLoops(int loops, LoopType loopType) { this.loops = loops; this.loopType = loopType; return(this); }
public void ProcessCommand(ICommand command) { //can't switch on type, so we use a series of ifs to get to the commands that we can switch on if (command is IFileCommand) { IFileCommand pfCommand = command as IFileCommand; switch (pfCommand.CommandType) { case CommandType.PlayShortestTrack: PlayNewTrack(fileFinder.FindFiles(pfCommand.Search, FileTypes.MP3, FileListSort.SmallestFirst)); break; case CommandType.PlayRandomTrack: PlayNewTrack(fileFinder.FindFiles(pfCommand.Search, FileTypes.MP3, FileListSort.Random)); break; case CommandType.PlayPlaylist: PlayPlaylist( fileFinder.FindFiles(pfCommand.Search, new FileTypes[] {FileTypes.M3U, FileTypes.PLS}, FileListSort.SmallestFirst)); break; case CommandType.PlayQueryAsList: PlayGenericList(fileFinder.FindFiles(pfCommand.Search, FileTypes.MP3, FileListSort.SmallestFirst)); break; } } else if (command is IChangeStateCommand) { IChangeStateCommand csCommand = command as IChangeStateCommand; switch (csCommand.CommandType) { case CommandType.SkipTime: throw new NotImplementedException(); //break; case CommandType.SkipTrack: SkipTracks(csCommand.Magnitude); break; case CommandType.SkipToTrack: SkipToTrack(csCommand.Magnitude - 1); break; case CommandType.Volume: throw new NotImplementedException(); //break; } } else if (command is ILoopCommand) { ILoopCommand lCommand = command as ILoopCommand; loopType = lCommand.LoopType; } else switch (command.CommandType) { case CommandType.Exit: case CommandType.Stop: Stop(); break; case CommandType.Repeat: Repeat(); break; case CommandType.PlayPause: PlayPause(); break; case CommandType.Ignore: break; } //ignore any other commands }
public static IObservable <T> Tween <T>(Func <T> start, Func <T> finish, float duration, EaseType easeType, LoopType loopType = LoopType.None, Action onCompleteTween = null) where T : struct { return(Tween(start, finish, () => duration, easeType, loopType, onCompleteTween)); }
/// <summary> /// Rotates the GameObject around a point on the axis by the given angle /// </summary> public static Tween RotateAround(Transform transform, TweenStyle tweenStyle, Transform point, Vector3 axis, float angle, float duration, LoopType loopType = LoopType.None) { return(CreateRotationTween(transform.gameObject, TweenType.Rotation, tweenStyle, point, axis, angle, duration, loopType)); }
public static IObservable <T> Tween <T>(Func <T> start, Func <T> finish, Func <float> duration, EaseType easeType, LoopType loopType = LoopType.None, Action onCompleteTween = null) where T : struct { return(Tween( () => Activator.CreateInstance(OperatableStructMap[typeof(T)], start()) as OperatableBase <T>, () => Activator.CreateInstance(OperatableStructMap[typeof(T)], finish()) as OperatableBase <T>, duration, easeType, loopType, onCompleteTween )); }
/// <summary> /// Tweens the Z position of the GameObject /// </summary> public static Tween PositionZ(Transform transform, TweenStyle tweenStyle, float fromValue, float toValue, float duration, bool transformLocal = false, LoopType loopType = LoopType.None) { return(CreateTween(transform.gameObject, TweenType.PositionZ, tweenStyle, fromValue, toValue, duration, transformLocal, loopType)); }
/// <summary> /// Instantly changes a GameObject's Euler angles in degrees then returns it to it's starting rotation over time. /// </summary> /// <param name="rotation"> /// A <see cref="Vector3"/> /// </param> /// <param name="time"> /// A <see cref="System.Single"/> /// </param> /// <param name="delay"> /// A <see cref="System.Single"/> /// </param> /// <param name="easeType"> /// A <see cref="EaseType"/> /// </param> /// <param name="loopType"> /// A <see cref="LoopType"/> /// </param> public static void RotateFrom(this GameObject go,Vector3 rotation,float time,float delay,EaseType easeType,LoopType loopType){ iTween.RotateFrom(go,iTween.Hash("rotation",rotation,"time",time,"delay",delay,"easeType",easeType.ToString(),"looptype",loopType.ToString())); }
/// <summary> /// sets the number of iterations and the loop type. setting to -1 will loop infinitely /// </summary> public TweenConfig setIterations(int iterations, LoopType loopType) { this.iterations = iterations; this.loopType = loopType; return(this); }
/// <summary> /// Changes a GameObject's color values over time. If a GUIText or GUITexture component is attached, they will become the target of the animation. /// </summary> /// <param name="color"> /// A <see cref="Color"/> /// </param> /// <param name="time"> /// A <see cref="System.Single"/> /// </param> /// <param name="delay"> /// A <see cref="System.Single"/> /// </param> /// <param name="loopType"> /// A <see cref="LoopType"/> /// </param> public static void ColorTo(this GameObject go,Color color,float time,float delay,LoopType loopType){ iTween.ColorTo(go,iTween.Hash("color",color,"time",time,"delay",delay,"looptype",loopType.ToString())); }
private static Tween CreateColourTween(GameObject obj, TweenType tweenType, TweenStyle tweenStyle, Color fromValue, Color toValue, float duration, LoopType loopType) { Tween tween = GetTween(obj, tweenType); if (tween == null) { tween = obj.AddComponent <Tween>(); } tween.tweenType = tweenType; tween.tweenStyle = tweenStyle; tween.fromColour = fromValue; tween.toColour = toValue; tween.duration = duration; tween.loopType = loopType; return(tween); }
/// <summary> /// Rotates a GameObject to look at the supplied Vector3 over time. /// </summary> /// <param name="lookTarget"> /// A <see cref="Vector3"/> /// </param> /// <param name="time"> /// A <see cref="System.Single"/> /// </param> /// <param name="delay"> /// A <see cref="System.Single"/> /// </param> /// <param name="easeType"> /// A <see cref="EaseType"/> /// </param> /// <param name="loopType"> /// A <see cref="LoopType"/> /// </param> public static void LookTo(this GameObject go,Vector3 lookTarget,float time,float delay,EaseType easeType,LoopType loopType){ iTween.LookTo(go,iTween.Hash("lookTarget",lookTarget,"time",time,"delay",delay,"easeType",easeType.ToString(),"looptype",loopType.ToString())); }
void Update() { #if UNITY_EDITOR if (stageManager.isIntro) { if (Input.GetMouseButtonDown(2)) { Time.timeScale = 10.0f; } else if (Input.GetMouseButtonUp(2)) { Time.timeScale = 1.0f; } } #endif // Debug.Log("timescale: " + Time.timeScale); if (_waitForTouchToStartGame && Input.GetMouseButtonUp(0)) { _waitForTouchToStartGame = false; closeTitleAndPlayGame(); } if (uiManager.uiLoading.gameObject.activeInHierarchy == true && recordMode != RecordMode.continueGame && _openContinuePopup == false) { return; } #if UNITY_EDITOR if (Input.GetKeyUp(KeyCode.Q)) { Time.timeScale -= 0.1f; } else if (Input.GetKeyUp(KeyCode.W)) { Time.timeScale *= 2.0f; } else if (Input.GetKeyUp(KeyCode.S)) { Log.saveFileLog(); } #endif if (Time.smoothDeltaTime <= 0.0f || Time.timeScale <= 0) { globalDeltaTime = 0.0f; if (stageManager.isIntro) { cutSceneManager.updateFrame(); } return; } if (uiManager.currentUI != UIManager.Status.UI_PLAY) { if (uiManager.currentUI == UIManager.Status.UI_MENU) { // checkAutoLandScape(); } LOOP_INTERVAL.Set(Time.smoothDeltaTime); _loopType = LoopType.preview; if (Time.frameCount % 500 == 0) { System.GC.Collect(); } if (Time.frameCount % 3600 == 0) { clearMemory(); } } else { if (_isPaused) { if (Time.frameCount % 30 == 0) { System.GC.Collect(); } return; } _loopType = LoopType.inGame; LOOP_INTERVAL.Set(0.05f); ////(1.0f/20.0f); // 초당 20번 연산. if (isAutoPlay == false && BattleSimulator.nowSimulation == false) { player.moveState = Player.MoveState.Stop; } if (recordMode == RecordMode.record && isPlaying) { checkPlayerTouchForMove(); } } float newTime = currentTime + Time.smoothDeltaTime; //((float)(Mathf.RoundToInt(Time.smoothDeltaTime*100.0f))*0.01f); float frameTime = newTime - currentTime; if (frameTime > LOOP_INTERVAL * 10.0f) { frameTime = LOOP_INTERVAL * 10.0f; } #if UNITY_EDITOR if (BattleSimulator.nowSimulation && BattleSimulator.instance.skipTime > 0 && BattleSimulator.instance.skipTime > LOOP_INTERVAL) { frameTime = BattleSimulator.instance.skipTime; } #endif //if(playMode == Play_Mode.REPLAY) frameTime = 10.0f; if (recordMode == RecordMode.continueGame) { frameTime = 30.0f; } currentTime.Set(newTime); _updateLoopLeftTime.Set(_updateLoopLeftTime.Get() + frameTime); float useLoopUpdateTime = 0.0f; loopIndex = 0; while (_updateLoopLeftTime >= LOOP_INTERVAL) { globalDeltaTime = LOOP_INTERVAL; //Time.smoothDeltaTime;//Time.smoothDeltaTime; //LOOP_INTERVAL; updateLoop(); globalGamePassTime += globalDeltaTime; useLoopUpdateTime += globalDeltaTime; _updateLoopLeftTime.Set(_updateLoopLeftTime - globalDeltaTime); if (stageManager.isIntro) { #if UNITY_EDITOR Debug.Log("intro loop : " + _updateLoopLeftTime); #endif cutSceneManager.updateFrame(); if (Time.timeScale <= 0) { _updateLoopLeftTime = 0; } } ++loopIndex; } if (useLoopUpdateTime > 0) { renderSkipFrame = false; } else { renderSkipFrame = (isPlaying && uiManager.currentUI == UIManager.Status.UI_PLAY); } renderRatio = _updateLoopLeftTime / LOOP_INTERVAL; render(); globalTime = Time.realtimeSinceStartup; }
/// <summary> /// Changes a GameObject's position over time along a supplied path. /// </summary> /// <param name="go"> /// A <see cref="GameObject"/> /// </param> /// <param name="path"> /// A <see cref="Transform[]"/> /// </param> /// <param name="time"> /// A <see cref="System.Single"/> /// </param> /// <param name="delay"> /// A <see cref="System.Single"/> /// </param> /// <param name="easeType"> /// A <see cref="EaseType"/> /// </param> /// <param name="loopType"> /// A <see cref="LoopType"/> /// </param> public static void MoveTo(this GameObject go,Transform[] path,float time,float delay,EaseType easeType,LoopType loopType){ iTween.MoveTo(go,iTween.Hash("path",path,"time",time,"delay",delay,"easeType",easeType.ToString(),"looptype",loopType.ToString())); }
public TweenFlow setIterations( int iterations, LoopType loopType ) { this.iterations = iterations; this.loopType = loopType; return this; }
public override bool CreateTween(GameObject target, float duration, int loops, LoopType loopType) { Tweener tween = target.transform.DOPunchScale(punch, duration, vibrato, elasticity); SetTween(tween, loops, loopType); return(true); }
/// <summary> /// Changes a GameObject's scale over time. /// </summary> /// <param name="scale"> /// A <see cref="Vector3"/> /// </param> /// <param name="time"> /// A <see cref="System.Single"/> /// </param> /// <param name="delay"> /// A <see cref="System.Single"/> /// </param> /// <param name="easeType"> /// A <see cref="EaseType"/> /// </param> /// <param name="loopType"> /// A <see cref="LoopType"/> /// </param> public static void ScaleTo(this GameObject go,Vector3 scale,float time,float delay,EaseType easeType,LoopType loopType){ iTween.ScaleTo(go,iTween.Hash("scale",scale,"time",time,"delay",delay,"easeType",easeType.ToString(),"looptype",loopType.ToString())); }
public override void Reset() { base.Reset(); gameObject = null; to = new FsmFloat { UseVariable = false }; duration = new FsmFloat { UseVariable = false }; setSpeedBased = new FsmBool { UseVariable = false, Value = false }; setRelative = new FsmBool { UseVariable = false, Value = false }; playInReverse = new FsmBool { UseVariable = false, Value = false }; setReverseRelative = new FsmBool { UseVariable = false, Value = false }; startEvent = null; finishEvent = null; finishImmediately = new FsmBool { UseVariable = false, Value = false }; stringAsId = new FsmString { UseVariable = false }; tagAsId = new FsmString { UseVariable = false }; startDelay = new FsmFloat { Value = 0 }; selectedEase = DOTweenActionsEnums.SelectedEase.EaseType; easeType = Ease.Linear; loops = new FsmInt { Value = 0 }; loopType = LoopType.Restart; autoKillOnCompletion = new FsmBool { Value = true }; recyclable = new FsmBool { Value = false }; updateType = UpdateType.Normal; isIndependentUpdate = new FsmBool { Value = false }; debugThis = new FsmBool { Value = false }; }
/// <summary> /// Changes a GameObject's alpha value over time. If a GUIText or GUITexture component is attached, it will become the target of the animation. Identical to using ColorTo and using the "a" parameter. /// </summary> /// <param name="alpha"> /// A <see cref="System.Single"/> /// </param> /// <param name="time"> /// A <see cref="System.Single"/> /// </param> /// <param name="delay"> /// A <see cref="System.Single"/> /// </param> /// <param name="loopType"> /// A <see cref="LoopType"/> /// </param> public static void FadeTo(this GameObject go,float alpha,float time,float delay,LoopType loopType){ iTween.FadeTo(go,iTween.Hash("alpha",alpha,"time",time,"delay",delay,"looptype",loopType.ToString())); }
private Tween CreateMoveTween(Vector3 destination, float duration, Ease easeSetting, int loops, LoopType loopSetting) { var tween = StartTransform.DOLocalMove(destination, duration).SetEase(easeSetting).SetLoops(loops, loopSetting).SetAutoKill(false); tween.Pause(); return(tween); }
/// <summary> /// Changes a GameObject's position over time to a supplied destination. /// </summary> /// <param name="position"> /// A <see cref="Vector3"/> /// </param> /// <param name="time"> /// A <see cref="System.Single"/> /// </param> /// <param name="delay"> /// A <see cref="System.Single"/> /// </param> /// <param name="easeType"> /// A <see cref="EaseType"/> /// </param> /// <param name="loopType"> /// A <see cref="LoopType"/> /// </param> public static void MoveTo(this GameObject go,Vector3 position,float time,float delay,EaseType easeType,LoopType loopType){ iTween.MoveTo(go,iTween.Hash("position",position,"time",time,"delay",delay,"easeType",easeType.ToString(),"looptype",loopType.ToString())); }
/// <summary> /// This will tween the "point" value on a Rotation Tween. Use this if you have a Rotation tween on a GameObject that is moving. /// </summary> public Tween TweenRotationPoint(TweenStyle tweenStyle, Vector3 fromPoint, Vector3 toPoint, float duration, LoopType loopType = LoopType.None) { // If the TweenType for the current Tween is not a Rotation then do nothing if (tweenType != TweenType.Rotation) { return(null); } Tween tween = GetTween(this.gameObject, TweenType.RotationPoint); if (tween == null) { tween = this.gameObject.AddComponent <Tween>(); } tween.tweenType = TweenType.RotationPoint; tween.tweenStyle = tweenStyle; tween.fromPoint = fromPoint; tween.toPoint = toPoint; tween.duration = duration; tween.loopType = loopType; return(tween); }
/// <summary> /// Instantly changes an AudioSource's volume and pitch then returns it to it's starting volume and pitch over time. Default AudioSource attached to GameObject will be used. /// </summary> /// <param name="volume"> /// A <see cref="System.Single"/> /// </param> /// <param name="pitch"> /// A <see cref="System.Single"/> /// </param> /// <param name="time"> /// A <see cref="System.Single"/> /// </param> /// <param name="delay"> /// A <see cref="System.Single"/> /// </param> /// <param name="looptype"> /// A <see cref="LoopType"/> /// </param> public static void AudioFrom(this GameObject go,float volume,float pitch,float time,float delay,LoopType loopType){ iTween.AudioFrom(go,iTween.Hash("volume",volume,"pitch",pitch,"time",time,"delay",delay,"looptype",loopType.ToString())); }
/// <summary> /// Tweens the color of the Material /// </summary> public static Tween Colour(Renderer renderer, TweenStyle tweenStyle, Color fromValue, Color toValue, float duration, LoopType loopType = LoopType.None) { return(CreateColourTween(renderer.gameObject, TweenType.ColourMaterial, tweenStyle, fromValue, toValue, duration, loopType)); }
//grab and set generic, neccesary iTween arguments: void RetrieveArgs() { foreach (Hashtable item in tweens) { if((GameObject)item["target"] == gameObject){ tweenArguments=item; break; } } id=(string)tweenArguments["id"]; type=(string)tweenArguments["type"]; /* GFX47 MOD START */ _name=(string)tweenArguments["name"]; /* GFX47 MOD END */ method=(string)tweenArguments["method"]; if(tweenArguments.Contains("time")){ time=(float)tweenArguments["time"]; }else{ time=Defaults.time; } //do we need to use physics, is there a rigidbody? if(rigidbody != null){ physics=true; } if(tweenArguments.Contains("delay")){ delay=(float)tweenArguments["delay"]; }else{ delay=Defaults.delay; } if(tweenArguments.Contains("namedcolorvalue")){ //allows namedcolorvalue to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: if(tweenArguments["namedcolorvalue"].GetType() == typeof(NamedValueColor)){ namedcolorvalue=(NamedValueColor)tweenArguments["namedcolorvalue"]; }else{ try { namedcolorvalue=(NamedValueColor)Enum.Parse(typeof(NamedValueColor),(string)tweenArguments["namedcolorvalue"],true); } catch { Debug.LogWarning("iTween: Unsupported namedcolorvalue supplied! Default will be used."); namedcolorvalue = iTween.NamedValueColor._Color; } } }else{ namedcolorvalue=Defaults.namedColorValue; } if(tweenArguments.Contains("looptype")){ //allows loopType to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: if(tweenArguments["looptype"].GetType() == typeof(LoopType)){ loopType=(LoopType)tweenArguments["looptype"]; }else{ try { loopType=(LoopType)Enum.Parse(typeof(LoopType),(string)tweenArguments["looptype"],true); } catch { Debug.LogWarning("iTween: Unsupported loopType supplied! Default will be used."); loopType = iTween.LoopType.none; } } }else{ loopType = iTween.LoopType.none; } if(tweenArguments.Contains("easetype")){ //allows easeType to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: if(tweenArguments["easetype"].GetType() == typeof(EaseType)){ easeType=(EaseType)tweenArguments["easetype"]; }else{ try { easeType=(EaseType)Enum.Parse(typeof(EaseType),(string)tweenArguments["easetype"],true); } catch { Debug.LogWarning("iTween: Unsupported easeType supplied! Default will be used."); easeType=Defaults.easeType; } } }else{ easeType=Defaults.easeType; } if(tweenArguments.Contains("space")){ //allows space to be set as either an enum(C# friendly) or a string(JS friendly), string case usage doesn't matter to further increase usability: if(tweenArguments["space"].GetType() == typeof(Space)){ space=(Space)tweenArguments["space"]; }else{ try { space=(Space)Enum.Parse(typeof(Space),(string)tweenArguments["space"],true); } catch { Debug.LogWarning("iTween: Unsupported space supplied! Default will be used."); space = Defaults.space; } } }else{ space = Defaults.space; } if(tweenArguments.Contains("islocal")){ isLocal = (bool)tweenArguments["islocal"]; }else{ isLocal = Defaults.isLocal; } // Added by PressPlay if (tweenArguments.Contains("ignoretimescale")) { useRealTime = (bool)tweenArguments["ignoretimescale"]; } else { useRealTime = Defaults.useRealTime; } //instantiates a cached ease equation reference: GetEasingFunction(); }
/// <summary> /// Tweens the color of the UI Image /// </summary> public static Tween Colour(UnityEngine.UI.Graphic uiGraphic, TweenStyle tweenStyle, Color fromValue, Color toValue, float duration, LoopType loopType = LoopType.None) { return(CreateColourTween(uiGraphic.gameObject, TweenType.ColourGraphic, tweenStyle, fromValue, toValue, duration, loopType)); }
private static IObservable <T> Tween <T>(Func <OperatableBase <T> > start, Func <OperatableBase <T> > finish, Func <float> duration, EaseType easeType, LoopType loopType, Action onCompleteTween) where T : struct { T startValue = default(T); T finishValue = default(T); onCompleteTween = onCompleteTween ?? (() => { }); Func <IObserver <T>, IDisposable> returnStartValue = (observer) => { observer.OnNext(startValue); return(null); }; Func <IObserver <T>, IDisposable> returnFinishValue = (observer) => { observer.OnNext(finishValue); return(null); }; IObservable <T> stream = Observable.Empty <TweenInformation <T> >() // Repeat() のために、毎回初期値を生成 .StartWith(() => new TweenInformation <T>(Time.time, start(), finish(), duration(), easeType, out startValue, out finishValue)) // Update のストリームに変換 .SelectMany(information => Observable.EveryUpdate().Do(_ => information.Time = Time.time - information.StartTime).Select(_ => information)) // Tween 時間が処理時間よりも小さい間流し続ける .TakeWhile(information => information.Time <= information.Duration) // 実際の Easing 処理実行 .Select(information => Easing(information.Time, information.Start, (information.Finish - information.Start), information.Duration, information.EaseType).Value) // 最終フレームの値を確実に流すために OnCompleted が来たら値を一つ流すストリームに繋ぐ // 1回分の Tween が終わったらコールバックを呼ぶ .Concat(Observable.Create(returnFinishValue).Take(1).Do(_ => onCompleteTween())); switch (loopType) { case LoopType.None: // Do nothing. break; case LoopType.Repeat: stream = stream.Repeat(); break; case LoopType.PingPong: stream = stream .Concat( Observable.Empty <TweenInformation <T> >() // Repeat() のために、毎回初期値を生成 .StartWith(() => new TweenInformation <T>(Time.time, start(), finish(), duration(), easeType, out startValue, out finishValue)) // Update のストリームに変換 .SelectMany(information => Observable.EveryUpdate().Do(_ => information.Time = Time.time - information.StartTime).Select(_ => information)) // Tween 時間が処理時間よりも小さい間流し続ける .TakeWhile(information => information.Time <= information.Duration) // start と finish を入れ替えて、実際の Easing 処理実行 .Select(information => Easing(information.Time, information.Finish, (information.Start - information.Finish), information.Duration, information.EaseType).Value) // 最終フレームの値を確実に流すために OnCompleted が来たら最終値を一つ流すストリームに繋ぐ // 1回分の Tween が終わったらコールバックを呼ぶ .Concat(Observable.Create(returnStartValue).Take(1).Do(_ => onCompleteTween())) ) .Repeat(); break; case LoopType.Mirror: stream = stream .Concat( Observable.Empty <TweenInformation <T> >() // Repeat() のために、毎回初期値を生成 .StartWith(() => new TweenInformation <T>(Time.time, start(), finish(), duration(), easeType, out startValue, out finishValue)) // Update のストリームに変換 .SelectMany(information => Observable.EveryUpdate().Do(_ => information.Time = Time.time - information.StartTime).Select(_ => information)) // Tween 時間が処理時間よりも小さい間流し続ける .TakeWhile(information => information.Time <= information.Duration) // start と finish を入れ替えて、実際の Easing 処理実行 .Select(information => Easing(information.Time, information.Finish, (information.Start - information.Finish), information.Duration, MirrorEaseTypeMap[information.EaseType]).Value) // 最終フレームの値を確実に流すために OnCompleted が来たら最終値を一つ流すストリームに繋ぐ // 1回分の Tween が終わったらコールバックを呼ぶ .Concat(Observable.Create(returnStartValue).Take(1).Do(_ => onCompleteTween())) ) .Repeat(); break; } return(stream); }
private static Tween CreateTween(GameObject obj, TweenType tweenType, TweenStyle tweenStyle, float fromValue, float toValue, float duration, bool transformLocal, LoopType loopType) { Tween tween = GetTween(obj, tweenType); if (tween == null) { tween = obj.AddComponent <Tween>(); } tween.tweenType = tweenType; tween.tweenStyle = tweenStyle; tween.fromValue = fromValue; tween.toValue = toValue; tween.duration = duration; tween.useLocal = transformLocal; tween.loopType = loopType; return(tween); }