/// <summary> /// Updates Animator. /// </summary> public void Update(GameTime gameTime) { if (CurrentAnimation == null) { return; } CurrentAnimation.Update(gameTime.GetSeconds()); if (CurrentAnimation.IsFinished) { if (CurrentAnimation.IsLoop) { CurrentAnimation.Start(); } else { AnimationFinished?.Invoke(_currentAnimationName, CurrentAnimation.PlayReversed); string newAnimation; if (_transitions.TryGetValue(_currentAnimationName, out newAnimation)) { SetAnimation(newAnimation); } else { CurrentAnimation = null; AnimatorFinished?.Invoke(); } } } }
private void OnAnimationFinished() { if (AnimationFinished != null) { AnimationFinished.Invoke(); } }
public IEnumerator PlayOpeningAnimation(bool skipAnimation = false, bool panelExposed = false, bool lights = true) { if (skipAnimation == false) { if (panelExposed) { overlayHackingHandler.ChangeSprite((int)Panel.Opening, false); } if (lights) { overlayLightsHandler.ChangeSprite((int)Lights.Opening, false); } overlayFillHandler.ChangeSprite((int)DoorFrame.Opening, false); doorBaseHandler.ChangeSprite((int)DoorFrame.Opening, false); ClientPlaySound(openingSFX); yield return(WaitFor.Seconds(openingAnimationTime)); } // Change to open sprite after done opening if (panelExposed) { overlayHackingHandler.ChangeSprite((int)Panel.Open, false); } else { overlayHackingHandler.ChangeSprite((int)Panel.NoPanel, false); } overlayLightsHandler.ChangeSprite((int)Lights.NoLight, false); overlayFillHandler.ChangeSprite((int)DoorFrame.Open, false); doorBaseHandler.ChangeSprite((int)DoorFrame.Open, false); AnimationFinished?.Invoke(); }
public IEnumerator PlayClosingAnimation(bool panelExposed = false, bool lights = true) { if (panelExposed) { overlayHackingHandler.ChangeSprite((int)Panel.Closing); } if (lights) { overlayLightsHandler.ChangeSprite((int)Lights.Closing); } overlayFillHandler.ChangeSprite((int)DoorFrame.Closing); doorBaseHandler.ChangeSprite((int)DoorFrame.Closing); SoundManager.PlayNetworkedAtPos(closingSFX, gameObject.AssumedWorldPosServer()); yield return(WaitFor.Seconds(openingAnimationTime)); //Change to closed sprite after it is done closing if (panelExposed) { overlayHackingHandler.ChangeSprite((int)Panel.Closed); } else { overlayHackingHandler.ChangeSprite((int)Panel.NoPanel); } overlayLightsHandler.ChangeSprite((int)Lights.NoLight); overlayFillHandler.ChangeSprite((int)DoorFrame.Closed); doorBaseHandler.ChangeSprite((int)DoorFrame.Closed); AnimationFinished?.Invoke(); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (animationFinishedEvent == AnimatorStateMonitorType.OnStateEnter) { AnimationFinished?.Invoke(animator); } }
// rotates menu void RotateMenu() { if (timer > 0) { // rotates based on degrees per second and time since last frame and subtracts timer transform.Rotate(rotationDirection * degreesPerSecond * Time.deltaTime); timer -= Time.deltaTime; // when timer reaches zero if (timer <= 0) { // resets timer timer = 0; // resets rotation values and sets position to a concrete final position transform.eulerAngles = new Vector3(transform.eulerAngles.x, startPosition + (rotationDirection.y * rotationDegrees), transform.eulerAngles.z); startPosition = transform.eulerAngles.y; rotationDirection = Vector3.zero; // coordinates cursor UpdateCurrentMenu(); AnimationFinished?.Invoke(); } } }
public override void OnResume() { base.OnResume(); if (!_isAnimating) { AnimationFinished?.Invoke(this, EventArgs.Empty); } }
public override void OnResume() { base.OnResume(); if (!_isAnimating) { View?.SetLayerType(LayerType.None, null); AnimationFinished?.Invoke(this, EventArgs.Empty); } }
public void NextFrame() { currentFrame++; mainAnimation.clip.SampleAnimation(this.gameObject, GetTimeByFrame(currentFrame)); if (currentFrame == mainAnimationFrames) { AnimationFinished?.Invoke(); } }
// Start is called before the first frame update void Start() { m_animator = GetComponent <Animator>(); if (m_animator == null && CheckChild == true) { m_animator = GetComponentInChildren <Animator>(); } //m_hashAnimation = Animator.StringToHash(NameOfOverAnimation); m_aniFinished = new AnimationFinished(m_animator, NameOfOverAnimation, AnimationOverEvent); }
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (animationFinishedEvent == AnimatorStateMonitorType.OnStateExit) { AnimationFinished?.Invoke(animator); } if (selfDestroyOnStateExit) { Destroy(animator.gameObject); } }
private void TransitionSetFinished(object sender, EventArgs e) { (sender as TransitionSet).Finished -= TransitionSetFinished; providerImage.Unparent(); providerImage.Dispose(); providerImage = null; FinishAnimation(); AnimationFinished?.Invoke(direction); isAnimating = false; }
// Start is called before the first frame update void Start() { m_AnimationFinished = new UnityEvent(); AnimationData.Generate(); m_animator = GetComponent <Animator>(); m_aniManager = GetComponent <AnimationPlayManager>(); m_aniManager.RegisteAnimation(NameOfAnimation, this); m_aniOver = new AnimationFinished(m_animator, NameInAnimationCtrl, m_AnimationFinished); m_AnimationFinished.AddListener(_animationFinished); m_bNameInCtrlValid = NameInAnimationCtrl.Length > 0; }
public IEnumerator PlayDeniedAnimation() { int previousLightSprite = overlayLightsHandler.CurrentSpriteIndex; overlayLightsHandler.ChangeSprite((int)Lights.Denied); SoundManager.PlayNetworkedAtPos(deniedSFX, gameObject.AssumedWorldPosServer()); yield return(WaitFor.Seconds(deniedAnimationTime)); overlayLightsHandler.ChangeSprite(previousLightSprite); AnimationFinished?.Invoke(); }
public void Update(GameTime gameTime) { _animationDelay--; if (_animationDelay == 0) { _animationDelay = ANIMATION_DELAY; if (_frame == _frames - 1) { AnimationFinished?.Invoke(); } _frame++; } }
public IEnumerator PlayPressureWarningAnimation() { int previousLightSprite = overlayLightsHandler.CurrentSpriteIndex; overlayLightsHandler.ChangeSprite((int)Lights.PressureWarning); yield return(WaitFor.Seconds(warningAnimationTime)); if (previousLightSprite == -1) { previousLightSprite = 0; } overlayLightsHandler.ChangeSprite(previousLightSprite); AnimationFinished?.Invoke(); }
public IEnumerator PlayDeniedAnimation() { int previousLightSprite = overlayLightsHandler.CurrentSpriteIndex; overlayLightsHandler.ChangeSprite((int)Lights.Denied); ClientPlaySound(deniedSFX); yield return(WaitFor.Seconds(deniedAnimationTime)); if (previousLightSprite == -1) { previousLightSprite = 0; } overlayLightsHandler.ChangeSprite(previousLightSprite); AnimationFinished?.Invoke(); }
public void Update() { if (!IsFinished) { // move towards the given position from the target's position at a given speed float movement = Speed * Time.deltaTime; Target.position = Vector3.MoveTowards(Target.position, animationPath[currentIndex], movement); if (Vector3.Distance(Target.position, animationPath[currentIndex]) < 0.1f) { currentIndex++; } // if we've gotten to the end of our animation path, what do we do? if (currentIndex == animationPath.Count) { IsFinished = true; AnimationFinished?.Invoke(this, EventArgs.Empty); } } }
/// <summary> /// Callback that will has been calling when swwitch animation would be fisnished. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Animation_Completed(object sender, EventArgs e) { // Drop stoked item. InProcessing = null; try { // Drop hidded data. UIElement ui = next.Children[0]; next.Children.Clear(); next.UpdateLayout(); // Move next object to current. current.Children.Clear(); current.Margin = next.Margin; current.Children.Add(ui); current.IsHitTestVisible = true; current.Opacity = 1; // Enable switch pamel. switchPanel.Opacity = 1; // Request next order. if (OrderBufer != null) { _ = SwitchToAsync(OrderBufer, LastAnmimationType); } } catch (Exception ex) { MessageBox.Show("Switch panel | " + "Animation error \n\n" + "InProcesing : " + InProcessing + "\n" + "Current : " + current.Name + "\n" + "Details: " + ex.Message); } // Inform subscribers. AnimationFinished?.Invoke(); }
public override AndroidAnimation OnCreateAnimation(int transit, bool enter, int nextAnim) { var result = base.OnCreateAnimation(transit, enter, nextAnim); _isAnimating = true; if (result == null && nextAnim != 0) { result = AnimationUtils.LoadAnimation(Context, nextAnim); } if (result == null) { AnimationFinished?.Invoke(this, EventArgs.Empty); return(result); } // we only want to use a hardware layer for the entering view because its quite likely // the view exiting is animating a button press of some sort. This means lots of GPU // transactions to update the texture. if (enter) { View.SetLayerType(LayerType.Hardware, null); } // This is very strange what we are about to do. For whatever reason if you take this animation // and wrap it into an animation set it will have a 1 frame glitch at the start where the // fragment shows at the final position. That sucks. So instead we reach into the returned // set and hook up to the first item. This means any animation we use depends on the first item // finishing at the end of the animation. if (result is AnimationSet set) { set.Animations[0].SetAnimationListener(this); } return(result); }
private void DecrementProgress(int index) { List <double> animationProgresses = this._animationProgresses; animationProgresses[index] -= ((this._animationDirections[index] == AnimationDirection.InOutOut || this._animationDirections[index] == AnimationDirection.InOutRepeatingOut) ? this.SecondaryIncrement : this.Increment); if (this._animationProgresses[index] < 0.0) { this._animationProgresses[index] = 0.0; for (int i = 0; i < this.GetAnimationCount(); i++) { if (this._animationDirections[i] == AnimationDirection.InOutIn || this._animationDirections[i] == AnimationDirection.InOutRepeatingIn || this._animationDirections[i] == AnimationDirection.InOutRepeatingOut || (this._animationDirections[i] == AnimationDirection.InOutOut && this._animationProgresses[i] != 0.0) || (this._animationDirections[i] == AnimationDirection.Out && this._animationProgresses[i] != 0.0)) { return; } } this._animationTimer.Stop(); AnimationFinished onAnimationFinished = this.OnAnimationFinished; if (onAnimationFinished != null) { onAnimationFinished(this); } } }
private void EndingAnimation_Completed(object sender, object e) { AnimationFinished?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Calls the given callback when the animation has been finished. /// </summary> /// <param name="callback">The callback.</param> /// <returns>The animation.</returns> public static IAnimation OnFinished(this IAnimation animation, AnimationFinished callback) { animation.Finished += callback; return(animation); }
private void TextAnimationCompleted(object sender, EventArgs e) { textImageBack.Source = textImage.Source; textImageBack.Opacity = 1f; AnimationFinished?.Invoke(this, new EventArgs()); }
/// <summary> /// Calls the given callback when the animation has been finished. /// </summary> /// <param name="callback">The callback.</param> /// <returns>The animation.</returns> public static IAnimation OnFinished(this IAnimation animation, AnimationFinished callback) { animation.Finished += callback; return animation; }
private void FrameBroker_TransitionAnimationFinished() { AnimationFinished?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Fired when the animation is finished /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ImageAnimationCompleted(object sender, EventArgs e) { projectionImageBack.Source = projectionImage.Source; AnimationFinished?.Invoke(this, new EventArgs()); }
/// <summary> /// Creates and initializes a new instance of the Naviframe class. /// </summary> /// <param name="parent">The parent is a given container which will be attached by Naviframe as a child. It's <see cref="EvasObject"/> type.</param> /// <since_tizen> preview </since_tizen> public Naviframe(EvasObject parent) : base(parent) { _transitionFinished = new SmartEvent(this, this.RealHandle, "transition,finished"); _transitionFinished.On += (s, e) => AnimationFinished?.Invoke(this, EventArgs.Empty); }
void AndroidAnimation.IAnimationListener.OnAnimationEnd(AndroidAnimation animation) { View?.SetLayerType(LayerType.None, null); AnimationFinished?.Invoke(this, EventArgs.Empty); }
private void Ani_Finished(object sender, EventArgs e) { FinishAnimation(); AnimationFinished?.Invoke(direction); }
protected virtual void OnAnimationFinished(EventArgs e) { AnimationFinished?.Invoke(this, e); }
public Animation SetAnimationFinishedCallback(AnimationFinished animFinishedCallback) { m_animFinishedCallback = animFinishedCallback; return this; }