示例#1
0
        public MoveAnimation Update(IntVec dir)
        {
            var oldState = CurrentState.Copy();

            IntVec pos = CurrentState.PlayerPosition + dir;

            if (GetObject(pos) == FieldObject.Wall)
            {
                return(null);
            }

            float animTime = 0.125f;

            var ent = CurrentState.EntityAt(pos);

            if (ent != null)
            {
                if (ent is Box && !TryMoveBox(ent as Box, dir))
                {
                    return(null);
                }
                if (ent is StickyBox && !TryMoveStickyBox(ent as StickyBox, dir))
                {
                    return(null);
                }
                if (ent is Hole)
                {
                    Hole h = ent as Hole;
                    if (!h.Filled)
                    {
                        return(null);
                    }
                }
            }
            else
            {
                while (GetObject(pos) == FieldObject.IceGround && GetObject(pos + dir) != FieldObject.Wall)
                {
                    var next = CurrentState.EntityAt(pos + dir);
                    if (next != null)
                    {
                        if (!(next is Hole) || !(next as Hole).Filled)
                        {
                            break;
                        }
                    }
                    animTime += 0.025f;
                    pos      += dir;
                }
            }

            var anim = new MoveAnimation(CurrentState.PlayerPosition, pos, animTime);

            CurrentState.PlayerPosition = pos;
            CurrentState.MoveCount++;

            history.Push(oldState);

            return(anim);
        }
示例#2
0
    //look more into the spikes & how to apply force for the upwards bump

    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            if (collision.gameObject.name == "PlayerFeetCollider")
            {
                Player        p  = collision.gameObject.GetComponentInParent <Player>();
                MovePlayer    mp = collision.gameObject.GetComponentInParent <MovePlayer>();
                MoveAnimation ma = collision.gameObject.GetComponent <MoveAnimation>();
                mp.isGrounded = true;
                if (!p.invincible)
                {
                    StartCoroutine(ma.playHurtAnimation());
                    StartCoroutine(p.SetInvincible());
                    p.LoseHP(damage);
                }
                collision.transform.parent.GetComponent <Rigidbody2D>().AddForce(transform.up * reboundForce);
            }
            else
            {
                Player        p  = collision.gameObject.GetComponent <Player>();
                MovePlayer    mp = collision.gameObject.GetComponent <MovePlayer>();
                MoveAnimation ma = collision.gameObject.GetComponent <MoveAnimation>();
                mp.isGrounded = true;
                if (!p.invincible)
                {
                    StartCoroutine(ma.playHurtAnimation());
                    StartCoroutine(p.SetInvincible());
                    p.LoseHP(damage);
                }
                collision.rigidbody.AddForce(transform.up * reboundForce);
            }
        }
    }
        public void SpawnEnnemy(Animation animation, GameTime gameTime)
        {
            var ennemy2 = new Ennemy("Ennemy1", 1000);

            ennemy2.SetScene(this);
            ennemy2.SetColor(Color.Red);
            ennemy2.SetSize(24, 24);
            ennemy2.SetSpeedMax(100);
            ennemy2.SetPosition(100, 100);
            ForegroundLayer.AddSprite(ennemy2.Sprite);

            var animation21 = new MoveAnimation(new Vector2(100, 100), new Vector2(100, 600));
            var animation22 = new MoveAnimation(new Vector2(100, 600), new Vector2(600, 600));
            var animation23 = new MoveAnimation(new Vector2(600, 600), new Vector2(600, 100));
            var animation24 = new MoveAnimation(new Vector2(600, 100), new Vector2(900, 100));
            var animation25 = new MoveAnimation(new Vector2(900, 100), new Vector2(900, 600));

            var animSequence2 = new AnimationSequence();

            animSequence2.AddAnimation(animation21);
            animSequence2.AddAnimation(animation22);
            animSequence2.AddAnimation(animation23);
            animSequence2.AddAnimation(animation24);
            animSequence2.AddAnimation(animation25);

            ennemy2.AttachAnimation(animSequence2);

            this.AnimationManager.AddAnimation(animSequence2);

            _ennemies.Add(ennemy2);
        }
示例#4
0
        public void Appear()
        {
            g_rotation = RANDOM.NextDouble() * 90d - 45d;
            g_pos_x    = RANDOM.NextDouble() * 160d - 80d;
            g_pos_y    = RANDOM.NextDouble() * 240d - 120d;

            if (_SpriteType == Control.SpriteType.Photo)
            {
                g_scale = 1d;
                double from_x = RANDOM.Next(2) == 0 ? -imageWidthInitial : App.SCREEN_WIDTH + imageWidthInitial;
                double from_y = RANDOM.Next(2) == 0 ? -imageHeightInitial : App.SCREEN_HEIGHT + imageHeightInitial;

                RotateAnimation.RotateFromTo(contentPanel, 0d, g_rotation, APPEAR_DURATION);
                MoveAnimation.MoveFromTo(contentPanel, from_x, from_y, g_pos_x, g_pos_y, APPEAR_DURATION, EASING,
                                         fe =>
                {
                    PrepareForManipulation();
                });
            }
            else if (_SpriteType == Control.SpriteType.Material || _SpriteType == Control.SpriteType.Text)
            {
                g_scale = RANDOM.NextDouble() * 0.3d + 0.8d;
                MoveAnimation.SetPosition(contentPanel, g_pos_x, g_pos_y);
                FadeAnimation.Fade(contentPanel, 0d, 1d, APPEAR_DURATION);
                RotateAnimation.RotateFromTo(contentPanel, 0d, g_rotation, APPEAR_DURATION);
                ScaleAnimation.ScaleFromTo(contentPanel, 1.5d, 1.5d, g_scale, g_scale, APPEAR_DURATION,
                                           fe =>
                {
                    ScaleAnimation.SetScale(fe, 1d, 1d);
                    PrepareForManipulation();
                });
            }
        }
示例#5
0
        public void Reset()
        {
            movements.Clear();
            currentAnim = null;

            map.Room.Reset();
            playerPos  = map.Room.CurrentState.PlayerPosition.ToVector2();
            playerTile = 8;
        }
示例#6
0
        protected override void OnActivated(EventArgs e)
        {
            if (!isInitialized)
            {
                controlContainer.Theme        = Theme;
                controlContainer.Style        = Style;
                controlContainer.StyleManager = StyleManager;

                MaximizeBox = false;
                MinimizeBox = false;
                Movable     = false;

                TopMost         = true;
                FormBorderStyle = FormBorderStyle.FixedDialog;

                Size = new Size(400, 200);

                Taskbar myTaskbar = new Taskbar();
                switch (myTaskbar.Position)
                {
                case TaskbarPosition.Left:
                    Location = new Point(myTaskbar.Bounds.Width + 5, myTaskbar.Bounds.Height - Height - 5);
                    break;

                case TaskbarPosition.Top:
                    Location = new Point(myTaskbar.Bounds.Width - Width - 5, myTaskbar.Bounds.Height + 5);
                    break;

                case TaskbarPosition.Right:
                    Location = new Point(myTaskbar.Bounds.X - Width - 5, myTaskbar.Bounds.Height - Height - 5);
                    break;

                case TaskbarPosition.Bottom:
                    Location = new Point(myTaskbar.Bounds.Width - Width - 5, myTaskbar.Bounds.Y - Height - 5);
                    break;

                case TaskbarPosition.Unknown:
                default:
                    Location = new Point(Screen.PrimaryScreen.Bounds.Width - Width - 5, Screen.PrimaryScreen.Bounds.Height - Height - 5);
                    break;
                }

                controlContainer.Location = new Point(0, 60);
                controlContainer.Size     = new Size(Width - 40, Height - 80);
                controlContainer.Anchor   = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left;

                StyleManager.UpdateOwnerForm();

                isInitialized = true;

                MoveAnimation myMoveAnim = new MoveAnimation();
                myMoveAnim.Start(controlContainer, new Point(20, 60), TransitionType.EaseInOutCubic, 15);
            }

            base.OnActivated(e);
        }
示例#7
0
 private void StartEditList()
 {
     listEditing = true;
     MoveAnimation.MoveTo(this.myThemeListBox, 0d, 0d, 200d, easingFunction,
                          fe =>
     {
     });
     FadeAnimation.Fade(this.switchMask, 0d, 1d, 200d);
     BuildBottomAppBar_Edit();
 }
    public void Start()
    {
        model              = transform;
        worldGrid          = FindObjectOfType <Grid>();
        cellSize           = Vector2Int.FloorToInt(worldGrid.cellSize);
        spriteCompensation = worldGrid.cellSize / 2.0f;

        moveAnimation  = GetComponent <MoveAnimation>();
        spriteRenderer = GetComponent <SpriteRenderer>();
    }
示例#9
0
        public BaseModalView()
        {
            Animation = new MoveAnimation()
            {
                PositionIn  = Rg.Plugins.Popup.Enums.MoveAnimationOptions.Bottom,
                DurationIn  = 300,
                DurationOut = 300
            };

            BackgroundColor = Color.Transparent;
        }
示例#10
0
        public PopupPage()
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);

            BindingContext = this;

            BackgroundColor  = Color.FromHex("#99000000");
            HasSystemPadding = Device.RuntimePlatform == Device.Android;
            Animation        = new MoveAnimation();
        }
示例#11
0
        private void lnk_go_Click(object sender, EventArgs e)
        {
            MoveAnimation move = new MoveAnimation();

            move.Start(MessageBar, new Point(0, 0), TransitionType.EaseInCubic, 20);

            if (tbx_doc.Text.Length != 0)
            {
                if (rbt_cnpj.Checked)
                {
                    if (ValidarCNPJ(tbx_doc.Text))
                    {
                        MessageBar.Style = MetroColorStyle.Green;
                        MessageBar.Text  = ValidarCPF(tbx_doc.Text).ToString();
                    }
                    else
                    {
                        MessageBar.Style = MetroColorStyle.Red;
                        MessageBar.Text  = ValidarCPF(tbx_doc.Text).ToString();
                    }
                }
                else if (rbt_cpf.Checked)
                {
                    if (ValidarCPF(tbx_doc.Text))
                    {
                        MessageBar.Style = MetroColorStyle.Green;
                        MessageBar.Text  = ValidarCPF(tbx_doc.Text).ToString();
                    }
                    else
                    {
                        MessageBar.Style = MetroColorStyle.Red;
                        MessageBar.Text  = ValidarCPF(tbx_doc.Text).ToString();
                    }
                }
                else if (rbt_pis.Checked)
                {
                    if (ValidarPIS(tbx_doc.Text))
                    {
                        MessageBar.Style = MetroColorStyle.Green;
                        MessageBar.Text  = ValidarCPF(tbx_doc.Text).ToString();
                    }
                    else
                    {
                        MessageBar.Style = MetroColorStyle.Red;
                        MessageBar.Text  = ValidarCPF(tbx_doc.Text).ToString();
                    }
                }
            }
            else
            {
                MessageBar.Style = MetroColorStyle.Red;
                MessageBar.Text  = "Opps! Nada foi digitado...";
            }
        }
示例#12
0
        private void EndEditList()
        {
            MoveAnimation.MoveTo(this.myThemeListBox, -64d, 0d, 200d, easingFunction, null);
            FadeAnimation.Fade(this.switchMask, 1d, 0d, 200d);
            foreach (var theme in myThemeData.myThemes)
            {
                theme.Selected = false;
            }

            BuildBottomAppBar_Normal();
            listEditing = false;
        }
示例#13
0
    public void HandleFinalDuel(GameObject winner, GameObject loser, AnimationCurve x, AnimationCurve y)
    {
        //Destroy(BracketLines);
        loserStack.GetComponent <LoserStack>().MakeLoserStack(winner, loser);
        FollowObject fo = this.camera.GetComponent <FollowObject>();

        fo.t = loser.transform;
        AnimationCurve x2 = AnimationCurve.Linear(0f, 0f, 1f, 1f);
        MoveAnimation  ma = loser.GetComponent <MoveAnimation>();

        loser.AddComponent <RotateOverTime>();
        ma.Setup(0.0f, 1.0f, loserStack, x2, x2);
    }
    void Update()
    {
        idleWeight = Mathf.Lerp(idleWeight, Mathf.InverseLerp(minWalkSpeed, maxIdleSpeed, speed), Time.deltaTime * 10);
        animationComponent[idle.name].weight = idleWeight;

        if (speed > 0)
        {
            float smallestDiff = Mathf.Infinity;
            foreach (MoveAnimation moveAnimation in moveAnimations)
            {
                float angleDiff = Mathf.Abs(Mathf.DeltaAngle(angle, moveAnimation.angle));
                float speedDiff = Mathf.Abs(speed - moveAnimation.speed);
                float diff      = angleDiff + speedDiff;
                if (moveAnimation == bestAnimation)
                {
                    diff *= 0.9f;
                }

                if (diff < smallestDiff)
                {
                    bestAnimation = moveAnimation;
                    smallestDiff  = diff;
                }
            }

            animationComponent.CrossFade(bestAnimation.clip.name);
        }
        else
        {
            bestAnimation = null;
        }

        if (lowerBodyForward != lowerBodyForwardTarget && idleWeight >= 0.9f)
        {
            animationComponent.CrossFade(turn.name, 0.05f);
        }

        if (bestAnimation != null && idleWeight < 0.9f)
        {
            float newAnimTime = Mathf.Repeat(animationComponent[bestAnimation.clip.name].normalizedTime * 2 + 0.1f, 1);
            if (newAnimTime < lastAnimTime)
            {
                if (Time.time > lastFootstepTime + 0.1f)
                {
                    footstepSignals.SendSignals(this);
                    lastFootstepTime = Time.time;
                }
            }
            lastAnimTime = newAnimTime;
        }
    }
示例#15
0
        private void tbx_doc_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsDigit(e.KeyChar) && e.KeyChar != 08 && e.KeyChar != 46 && e.KeyChar != 45)
            {
                MoveAnimation move = new MoveAnimation();

                e.Handled = true;

                MessageBar.Style = MetroColorStyle.Red;
                MessageBar.Text  = "Opps! Este campo só aceita números...";

                move.Start(MessageBar, new Point(0, 0), TransitionType.EaseInCubic, 20);
            }
        }
示例#16
0
        private void MoveTo(Control target, Point targetLocation)
        {
            if (target == null)
            {
                count -= 1; return;
            }

            target.Visible = true;
            var animation = new MoveAnimation(target, Speed, Duration);

            animation.TargetLocation = targetLocation;
            animation.Start();
            animation.AnimationExecuted += Animation_AnimationExecuted;
        }
示例#17
0
 /// <summary>
 /// Create move animation by supplied type
 /// </summary>
 /// <param name="type">Animation type</param>
 /// <param name="duration">Animation duration</param>
 public static MoveAnimationBase CreateMoveAnimation(MoveAnimation type, TimeSpan duration)
 {
     switch (type)
     {
         case MoveAnimation.None: 
             return null;
         case MoveAnimation.Move:
             return new MoveSimpleAnimation(duration);
         case MoveAnimation.Fade:
             return new MoveFadeAnimation(duration);
         
     }
     return null;
 }
示例#18
0
 /// <summary>Animates the position of the given control to the given positions.</summary>
 /// <param name="control">The control which should be moved.</param>
 /// <param name="x">The new horizontal position of the control.</param>
 /// <param name="y">The new vertical position of the control.</param>
 protected virtual void RunMoveAnimation(Control control, double x, double y)
 {
     if (MoveAnimation != null && CanAnimate)
     {
         //animate to the given position
         MoveAnimation.Animate(AnimationContext, control, x, y, AnimationLength);
     }
     else
     {
         //cannot animate, only the given positions
         SetX(control, x);
         SetY(control, y);
     }
 }
示例#19
0
    /// <summary>
    /// Запуск анимации перемещения фигуры. Ход фигуры на BoardState выполняется после завершения анимации.
    /// </summary>
    /// <param name="move"></param>
    public void BeginMove(FigureMove move)
    {
        // Блокируем интерфейс
        interfaceLocked = true;

        // Убираем выделение
        PieceController.ClearSelection();

        // Убираем все красные линии
        foreach (GameObject redLine in redLines)
        {
            Destroy(redLine);
        }
        redLines.Clear();

        // Находим GameObject фигуры
        Transform piece = FindTransformByPos(move.from);

        // Перемещаем спрайт на слой выше
        SpriteRenderer spriteRenderer = piece.GetChild(0).GetComponent <SpriteRenderer>();

        spriteRenderer.sortingLayerName = "CurrentPiece";
        currentMovingPiece = piece;

        // Запускаем анимацию
        MoveAnimation moveAnimation = piece.GetComponent <MoveAnimation>();

        currentMove = move;
        moveAnimation.StartAnimation(
            beginPos: new Vector3(move.from.x, move.from.y),
            endPos: new Vector3(move.to.x, move.to.y),
            finishedCallback: EndMove
            );

        // При рокировке запускаем анимацию для ладьи
        if (move.GetType() == typeof(CastlingMove))
        {
            // Находим GameObject ладьи
            CastlingMove castlingMove = (CastlingMove)move;
            Transform    rook         = FindTransformByPos(castlingMove.rookFrom);
            // Запускаем анимацию
            MoveAnimation rookMoveAnimation = rook.GetComponent <MoveAnimation>();
            rookMoveAnimation.StartAnimation(
                beginPos: new Vector3(castlingMove.rookFrom.x, castlingMove.rookFrom.y),
                endPos: new Vector3(castlingMove.rookTo.x, castlingMove.rookTo.y),
                finishedCallback: null
                );
        }
    }
示例#20
0
 private void KnobMove(bool right, bool useTransition)
 {
     if (knob != null)
     {
         double pos_x = this.Width * (right ? 0.5 : 0);
         if (useTransition)
         {
             MoveAnimation.MoveTo(knob, pos_x, 0, 200d);
         }
         else
         {
             MoveAnimation.SetPosition(knob, pos_x, 0);
         }
     }
 }
示例#21
0
        /// <summary>
        /// Create move animation by supplied type
        /// </summary>
        /// <param name="type">Animation type</param>
        /// <param name="duration">Animation duration</param>
        public static MoveAnimationBase CreateMoveAnimation(MoveAnimation type, TimeSpan duration)
        {
            switch (type)
            {
            case MoveAnimation.None:
                return(null);

            case MoveAnimation.Move:
                return(new MoveSimpleAnimation(duration));

            case MoveAnimation.Fade:
                return(new MoveFadeAnimation(duration));
            }
            return(null);
        }
示例#22
0
 public override void Update()
 {
     this.idleWeight = Mathf.Lerp(this.idleWeight, Mathf.InverseLerp(this.minWalkSpeed, this.maxIdleSpeed, this.speed), Time.deltaTime * 10);
     this.animationComponent[this.idle.name].weight = this.idleWeight;
     if (this.speed > 0)
     {
         float           positiveInfinity = float.PositiveInfinity;
         int             index            = 0;
         MoveAnimation[] moveAnimations   = this.moveAnimations;
         int             length           = moveAnimations.Length;
         while (index < length)
         {
             float num2 = Mathf.Abs(Mathf.DeltaAngle(this.angle, moveAnimations[index].angle));
             float num3 = Mathf.Abs((float)(this.speed - moveAnimations[index].speed));
             float num4 = num2 + num3;
             if (RuntimeServices.EqualityOperator(moveAnimations[index], this.bestAnimation))
             {
                 num4 *= 0.9f;
             }
             if (num4 < positiveInfinity)
             {
                 this.bestAnimation = moveAnimations[index];
                 positiveInfinity   = num4;
             }
             index++;
         }
         this.animationComponent.CrossFade(this.bestAnimation.clip.name);
     }
     else
     {
         this.bestAnimation = null;
     }
     if ((this.lowerBodyForward != this.lowerBodyForwardTarget) && (this.idleWeight >= 0.9f))
     {
         this.animationComponent.CrossFade(this.turn.name, 0.05f);
     }
     if ((this.bestAnimation > null) && (this.idleWeight < 0.9f))
     {
         float num5 = Mathf.Repeat((this.animationComponent[this.bestAnimation.clip.name].normalizedTime * 2) + 0.1f, (float)1);
         if ((num5 < this.lastAnimTime) && (Time.time > (this.lastFootstepTime + 0.1f)))
         {
             this.footstepSignals.SendSignals(this);
             this.lastFootstepTime = Time.time;
         }
         this.lastAnimTime = num5;
     }
 }
示例#23
0
    public void StartChain(List <GameObject> quads, List <GameObject> bracketNodes)
    {
        System.Random rnd = new System.Random(1555);
        for (int i = 0; i < quads.Count; i++)
        {
            GameObject quad        = quads[i];
            GameObject bracketNode = bracketNodes[i];

            MoveAnimation ma = quads[i].AddComponent <MoveAnimation>();

            ma.Setup(Random.Range(this.initialMinTimer, 0.0f),
                     this.initialTimeToMove,
                     bracketNode,
                     initialMove[rnd.Next(initialMove.Length)],
                     initialMove[rnd.Next(initialMove.Length)]);
        }
    }
示例#24
0
        public override void TurnStart()
        {
            print("trunstart");
            _selector.Selectable = true;
            var vectors = new IntVector[]
            {
                new IntVector(1, 0),
                new IntVector(0, 1),
                new IntVector(-1, 0),
                new IntVector(0, -1),
            };

            var moveArrows = new List <MoveArrow>();

            foreach (var vector in vectors)
            {
                var move = new Move(IntTransform, MapInfo, vector);
                if (!move.IsValid)
                {
                    continue;
                }
                var moveArrow = Instantiate(_moveArrowPref);
                moveArrow.transform.position = transform.position +
                                               new Vector3(vector.X * Const.MapChipWidth, 0,
                                                           vector.Y * Const.MapChipWidth);
                moveArrows.Add(moveArrow);
                moveArrow.OnSelected.Subscribe(_ =>
                {
                    move.Execute();
                    var anim = new MoveAnimation(transform, moveArrow.transform.position);
                    StartCoroutine(anim.Start());
                    _selector.Selectable = false;
                    anim.OnAnimationFinished.Subscribe(__ =>
                    {
                        foreach (var arrow in moveArrows)
                        {
                            Destroy(arrow.gameObject);
                        }
                        moveArrows.Clear();
                        ActionFinishedSubject.OnNext(Unit.Default);
                    });
                });
            }
        }
示例#25
0
        public void Appear()
        {
            g_rotation = RANDOM.NextDouble() * 90d - 45d;
            g_pos_x    = RANDOM.NextDouble() * 160d - 80d;
            g_pos_y    = RANDOM.NextDouble() * 240d - 120d;
            g_scale    = RANDOM.NextDouble() * 0.3d + 0.8d;

            double from_x = RANDOM.NextDouble() * 160d - 80d;
            double from_y = RANDOM.NextDouble() * 240d - 120d;

            MoveAnimation.MoveFromTo(contentPanel, from_x, from_y, g_pos_x, g_pos_y, APPEAR_DURATION, EASING,
                                     fe =>
            {
                PrepareForManipulation();
                //this.Selected = true;
            });

            RotateAnimation.RotateFromTo(contentPanel, 0d, g_rotation, APPEAR_DURATION);
            //ScaleAnimation.ScaleFromTo(contentPanel, 1d, 1d, g_scale, g_scale, APPEAR_DURATION);
            ScaleAnimation.SetScale(contentPanel, g_scale, g_scale);
        }
示例#26
0
        public override void Perform()
        {
            Vector3 oldPos = actor.mapMobile.transform.position;
            Vector3 newPos = Controllers.map.CellAt(destination).transform.position;

            PointyHexPoint dst = destination;

            Controllers.map.UnplaceMobile(actor.mapMobile);
            Controllers.map.PlaceMobile(actor.mapMobile, dst);
            actor.ct += actor.mapMobile.CostToEnter(Controllers.map.CellAt(dst));

            if (actor.mapMobile.visibility == Visibility.visible)
            {
                MoveAnimation newAnimation = actor.mapMobile.gameObject.AddComponent <MoveAnimation>();
                newAnimation.oldPos  = oldPos;
                newAnimation.newPos  = newPos;
                newAnimation.maxTime = moveTime;

                Controllers.turn.RegisterAnimation(newAnimation);
            }
        }
示例#27
0
        // Token: 0x06000418 RID: 1048 RVA: 0x0000E224 File Offset: 0x0000C424
        protected override void OnActivated(EventArgs e)
        {
            if (!this.isInitialized)
            {
                base.MaximizeBox     = false;
                base.MinimizeBox     = false;
                base.Movable         = false;
                base.TopMost         = true;
                base.FormBorderStyle = FormBorderStyle.FixedDialog;
                base.Size            = new Size(400, 200);
                Taskbar taskbar = new Taskbar();
                switch (taskbar.Position)
                {
                case TaskbarPosition.Left:
                    base.Location = new Point(taskbar.Bounds.Width + 5, taskbar.Bounds.Height - base.Height - 5);
                    goto IL_1A2;

                case TaskbarPosition.Top:
                    base.Location = new Point(taskbar.Bounds.Width - base.Width - 5, taskbar.Bounds.Height + 5);
                    goto IL_1A2;

                case TaskbarPosition.Right:
                    base.Location = new Point(taskbar.Bounds.X - base.Width - 5, taskbar.Bounds.Height - base.Height - 5);
                    goto IL_1A2;

                case TaskbarPosition.Bottom:
                    base.Location = new Point(taskbar.Bounds.Width - base.Width - 5, taskbar.Bounds.Y - base.Height - 5);
                    goto IL_1A2;
                }
                base.Location = new Point(Screen.PrimaryScreen.Bounds.Width - base.Width - 5, Screen.PrimaryScreen.Bounds.Height - base.Height - 5);
IL_1A2:
                this.controlContainer.Location = new Point(0, 60);
                this.controlContainer.Size     = new Size(base.Width - 40, base.Height - 80);
                this.controlContainer.Anchor   = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
                this.isInitialized             = true;
                MoveAnimation moveAnimation = new MoveAnimation();
                moveAnimation.Start(this.controlContainer, new Point(20, 60), TransitionType.EaseInOutCubic, 15);
            }
            base.OnActivated(e);
        }
示例#28
0
        static public Animation CreateAnimation(MoveImpl move)
        {
            Animation ret       = null;
            var       cur_route = GameBoard.instance.CalcRouteTo(move);

            if (cur_route != null)
            {
                List <Vector2> points = new List <Vector2> (cur_route.Count);
                points.Add(GameBoard.instance.FindCellPlace(cur_route [0]));
                for (int i = 1; i < cur_route.Count - 1; ++i)
                {
                    if (!AreCellsInRow(cur_route [i - 1], cur_route [i + 1]))
                    {
                        points.Add(GameBoard.instance.FindCellPlace(cur_route [i]));
                    }
                }
                points.Add(GameBoard.instance.FindCellPlace(cur_route [cur_route.Count - 1]));

                ret = new MoveAnimation(points.ToArray(), 1);
            }
            return(ret);
        }
    void Update()
    {
        idleWeight = Mathf.Lerp (idleWeight, Mathf.InverseLerp (minWalkSpeed, maxIdleSpeed, speed), Time.deltaTime * 10);
        animationComponent[idle.name].weight = idleWeight;

        if (speed > 0) {
            float smallestDiff = Mathf.Infinity;
            foreach(MoveAnimation moveAnimation in moveAnimations) {
                float angleDiff = Mathf.Abs(Mathf.DeltaAngle (angle, moveAnimation.angle));
                float speedDiff = Mathf.Abs (speed - moveAnimation.speed);
                float diff = angleDiff + speedDiff;
                if (moveAnimation == bestAnimation)
                    diff *= 0.9f;

                if (diff < smallestDiff) {
                    bestAnimation = moveAnimation;
                    smallestDiff = diff;
                }
            }

            animationComponent.CrossFade (bestAnimation.clip.name);
        }
        else {
            bestAnimation = null;
        }

        if (lowerBodyForward != lowerBodyForwardTarget && idleWeight >= 0.9f)
            animationComponent.CrossFade (turn.name, 0.05f);

        if (bestAnimation != null && idleWeight < 0.9f) {
            float newAnimTime= Mathf.Repeat (animationComponent[bestAnimation.clip.name].normalizedTime * 2 + 0.1f, 1);
            if (newAnimTime < lastAnimTime) {
                if (Time.time > lastFootstepTime + 0.1f) {
                    footstepSignals.SendSignals (this);
                    lastFootstepTime = Time.time;
                }
            }
            lastAnimTime = newAnimTime;
        }
    }
示例#30
0
 private void addAnimation(MoveAnimation moveAnimation)
 {
     animationsAndEvents.Add(new Animation(moveAnimation));
 }
    //  public bool isbrakePressed = false;

    void Start()
    {
        player = GameObject.Find("player").GetComponent <MoveAnimation>();
    }
示例#32
0
 public static TcpPacket CreateSpellAnim(MoveAnimation animation, int X1, int Y1, int arg1, int arg2, int arg3)
 {
     if (animation.AnimationIndex > -1 && animation.FrameSpeed > 0 && animation.Repetitions > 0) {
         return TcpPacket.CreatePacket("scriptspellanim", ((int)animation.AnimationType).ToString(), animation.AnimationIndex.ToString(),
             animation.FrameSpeed.ToString(), animation.Repetitions.ToString(), X1.ToString(), Y1.ToString(), arg1.ToString(), arg2.ToString(), arg3.ToString());
     } else {
         return null;
     }
 }
示例#33
0
        protected override void OnActivated(EventArgs e)
        {
            if (!isInitialized)
            {
                controlContainer.Theme        = Theme;
                controlContainer.Style        = Style;
                controlContainer.StyleManager = StyleManager;

                MaximizeBox = false;
                MinimizeBox = false;
                Movable     = true;

                TopMost = true;

                Size = new Size(500, 300);

                if (enableTaskBar == true)
                {
                    Taskbar myTaskbar = new Taskbar();
                    switch (myTaskbar.Position)
                    {
                    case TaskbarPosition.Left:
                        Location = new Point(myTaskbar.Bounds.Width + 5, myTaskbar.Bounds.Height - Height - 5);
                        break;

                    case TaskbarPosition.Top:
                        Location = new Point(myTaskbar.Bounds.Width - Width - 5, myTaskbar.Bounds.Height + 5);
                        break;

                    case TaskbarPosition.Right:
                        Location = new Point(myTaskbar.Bounds.X - Width - 5, myTaskbar.Bounds.Height - Height - 5);
                        break;

                    case TaskbarPosition.Bottom:
                        Location = new Point(myTaskbar.Bounds.Width - Width - 5, myTaskbar.Bounds.Y - Height - 5);
                        break;

                    case TaskbarPosition.Unknown:
                    default:
                        Location = new Point(Screen.PrimaryScreen.Bounds.Width - Width - 5, Screen.PrimaryScreen.Bounds.Height - Height - 5);
                        break;
                    }
                }
                controlContainer.Location = new Point(0, 60);
                controlContainer.Size     = new Size(Width - 40, Height - 80);
                controlContainer.Anchor   = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left;

                controlContainer.AutoScroll          = false;
                controlContainer.HorizontalScrollbar = false;
                controlContainer.VerticalScrollbar   = false;
                controlContainer.Refresh();

                if (StyleManager != null)
                {
                    StyleManager.Update();
                }

                isInitialized = true;

                MoveAnimation myMoveAnim = new MoveAnimation();
                myMoveAnim.Start(controlContainer, new Point(20, 60), TransitionType.EaseInOutCubic, 15);
            }

            base.OnActivated(e);
        }