Beispiel #1
0
        public override void update()
        {
            base.update();

            if (Animating)
            {
                if (TimeMoving > Time.deltaTime)
                {
                    foreach (KeyValuePair <CardUi, Vector2> cardSpeedPair in CardSpeeds)
                    {
                        CardUi card = cardSpeedPair.Key;
                        card.position += cardSpeedPair.Value * Time.deltaTime;
                        card.setScale(card.scale.X + (1 - PreviousScale[card]) * (Time.deltaTime / SecondsToMove));
                    }
                    TimeMoving -= Time.deltaTime;
                }
                else
                {
                    foreach (KeyValuePair <CardUi, Vector2> cardSpeedPair in CardSpeeds)
                    {
                        CardUi card = cardSpeedPair.Key;
                        card.position += cardSpeedPair.Value * TimeMoving;
                        card.setScale(1);
                    }
                    TimeMoving = 0;
                    CardSpeeds.Clear();
                    AnimationHandler.EndAnimation();
                    Animating = false;
                }
            }
        }
Beispiel #2
0
        public override void update()
        {
            base.update();

            if (Animating)
            {
                if (TimeMoving > Time.deltaTime)
                {
                    foreach (KeyValuePair <CardUi, Vector2> cardSpeedPair in CardSpeeds)
                    {
                        cardSpeedPair.Key.position += cardSpeedPair.Value * Time.deltaTime;
                    }

                    List <CardUi>[] CardRows = new List <CardUi>[] { FrontRowCards, BackRowCards };
                    for (int i = 0; i < 2; i++)
                    {
                        for (int j = 0; j < CardRows[i].Count; j++)
                        {
                            CardUi card = CardRows[i][j];
                            card.setScale(card.scale.X + (TargetScale[i] - PreviousScale[i][card]) * (Time.deltaTime / SecondsToMove));
                        }
                    }
                    TimeMoving -= Time.deltaTime;
                }
                else
                {
                    foreach (KeyValuePair <CardUi, Vector2> cardSpeedPair in CardSpeeds)
                    {
                        CardUi card = cardSpeedPair.Key;
                        card.position += cardSpeedPair.Value * TimeMoving;
                    }

                    for (int i = 0; i < 2; i++)
                    {
                        for (int j = 0; j < CardRows[i].Count; j++)
                        {
                            CardRows[i][j].setScale(TargetScale[i]);
                        }
                    }

                    TimeMoving = 0;
                    CardSpeeds.Clear();
                    AnimationHandler.EndAnimation();
                    Animating = false;
                }
            }
        }