Ejemplo n.º 1
0
 // 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);
     }
 }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
 private void OnAnimationFinished()
 {
     if (AnimationFinished != null)
     {
         AnimationFinished.Invoke();
     }
 }
Ejemplo n.º 4
0
        /// <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();
                    }
                }
            }
        }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
    // 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();
            }
        }
    }
Ejemplo n.º 7
0
 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);
     }
 }
Ejemplo n.º 9
0
    public void NextFrame()
    {
        currentFrame++;
        mainAnimation.clip.SampleAnimation(this.gameObject, GetTimeByFrame(currentFrame));

        if (currentFrame == mainAnimationFrames)
        {
            AnimationFinished?.Invoke();
        }
    }
Ejemplo n.º 10
0
        private void TransitionSetFinished(object sender, EventArgs e)
        {
            (sender as TransitionSet).Finished -= TransitionSetFinished;
            providerImage.Unparent();
            providerImage.Dispose();
            providerImage = null;

            FinishAnimation();
            AnimationFinished?.Invoke(direction);
            isAnimating = false;
        }
Ejemplo n.º 11
0
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (animationFinishedEvent == AnimatorStateMonitorType.OnStateExit)
     {
         AnimationFinished?.Invoke(animator);
     }
     if (selfDestroyOnStateExit)
     {
         Destroy(animator.gameObject);
     }
 }
Ejemplo n.º 12
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();
        }
Ejemplo n.º 13
0
 public void Update(GameTime gameTime)
 {
     _animationDelay--;
     if (_animationDelay == 0)
     {
         _animationDelay = ANIMATION_DELAY;
         if (_frame == _frames - 1)
         {
             AnimationFinished?.Invoke();
         }
         _frame++;
     }
 }
Ejemplo n.º 14
0
        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();
        }
Ejemplo n.º 15
0
        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);
                }
            }
        }
Ejemplo n.º 17
0
        /// <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();
        }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
 /// <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);
 }
 /// <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());
 }
 private void TextAnimationCompleted(object sender, EventArgs e)
 {
     textImageBack.Source  = textImage.Source;
     textImageBack.Opacity = 1f;
     AnimationFinished?.Invoke(this, new EventArgs());
 }
Ejemplo n.º 22
0
 public IEnumerator PlayPressureWarningAnimation()
 {
     SoundManager.PlayNetworkedAtPos(warningSFX, gameObject.AssumedWorldPosServer());
     AnimationFinished?.Invoke();
     yield break;
 }
Ejemplo n.º 23
0
 private void FrameBroker_TransitionAnimationFinished(bool direction)
 {
     AnimationFinished?.Invoke(direction);
 }
Ejemplo n.º 24
0
 public IEnumerator PlayPressureWarningAnimation()
 {
     ClientPlaySound(warningSFX);
     AnimationFinished?.Invoke();
     yield break;
 }
Ejemplo n.º 25
0
 private void EndingAnimation_Completed(object sender, object e)
 {
     AnimationFinished?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 26
0
 private void FrameBroker_TransitionAnimationFinished()
 {
     AnimationFinished?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 27
0
 void AndroidAnimation.IAnimationListener.OnAnimationEnd(AndroidAnimation animation)
 {
     View?.SetLayerType(LayerType.None, null);
     AnimationFinished?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 28
0
        private void Ani_Finished(object sender, EventArgs e)
        {
            FinishAnimation();

            AnimationFinished?.Invoke(direction);
        }
Ejemplo n.º 29
0
 protected virtual void OnAnimationFinished(EventArgs e)
 {
     AnimationFinished?.Invoke(this, e);
 }
Ejemplo n.º 30
0
        /// <summary>
        /// Called when popup IsOpened changes
        /// </summary>
        private void OnIsOpenChanged(bool oldValue, bool newValue)
        {
            if (PlacementTarget == null || Content == null)
            {
                throw new Exception("PlacementTarget is null");
            }

            if (PopupLayout == null)
            {
                throw new Exception("PopupLayout is null. Set app popup layout when app start.");
            }

            this.AbortAnimation(_openingAnimationName);
            this.AbortAnimation(_closingAnimationName);

            if (newValue)
            {
                // If actual content is not created
                if (_actualContent == null)
                {
                    if (Content is View content)
                    {
                        _actualContent = content;
                    }
                    else if (ContentTemplate != null)
                    {
                        _actualContent = ContentTemplate.CreateContent() as View;

                        if (Content != null)
                        {
                            Binding bind = new Binding("Content");
                            bind.Source = this;
                            bind.Mode   = BindingMode.OneWay;
                            _actualContent.SetBinding(View.BindingContextProperty, bind);
                        }
                    }
                }

                if (_popupRootLayout.Content != _actualContent)
                {
                    _popupRootLayout.Content = _actualContent;
                }

                _openPopups.Add(this);

                InitializeForOpeningAnimation();
                SetContentLayoutOptions(Placement);

                // Create opening animation
                _openingAnimationGroup = CreateOpeningAnimation();

                if (PopupLayout.Children.Contains(_popupRootLayout) == false)
                {
                    // Add popup to layout
                    PopupLayout.Children.Add(_popupRootLayout);
                }

                if (_openingAnimationGroup != null)
                {
                    _openingAnimationGroup.Commit(this, _openingAnimationName, 64, (uint)OpeningAnimation.Duration, Easing.Linear, (double p, bool isAborted) =>
                    {
                        AnimationFinished?.Invoke(this, IsOpen);
                    });
                }
                else
                {
                    AnimationFinished?.Invoke(this, IsOpen);
                }

                IsOpenChanged?.Invoke(this, IsOpen);
                OnOpened();
            }
            else
            {
                _openPopups.Remove(this);

                // Create closing animation
                _closingAnimationGroup = CreateClosingAnimation();

                if (_closingAnimationGroup != null)
                {
                    _closingAnimationGroup.Commit(this, _closingAnimationName, 64, (uint)ClosingAnimation.Duration, Easing.Linear, (arg1, arg2) =>
                    {
                        if (arg2 == false)
                        {
                            PopupLayout.Children.Remove(_popupRootLayout);
                        }

                        AnimationFinished?.Invoke(this, IsOpen);
                    });
                }
                else
                {
                    PopupLayout.Children.Remove(_popupRootLayout);
                    AnimationFinished?.Invoke(this, IsOpen);
                }

                IsOpenChanged?.Invoke(this, IsOpen);
                OnClosed();
            }
        }