Exemple #1
0
        public void Draw(GameTime gameTime, Rectangle rectangle, float Rotation, Color color)
        {
            if (loaded)
            {
                if (!Animated)
                {
                    X.spriteBatch.Draw(texture, rectangle, Color.White);
                }
                else
                {
                    if (timer.PassedTime > AnimationTime && IsRunning)
                    {
                        timer.Reset();
                        timer.Start();

                        if (CurrentCell < TotalCells - 1)
                        {
                            CurrentCell++;
                        }
                        else
                        {
                            CurrentCell = 0;
                        }
                    }

                    X.spriteBatch.Draw(texture, rectangle, new Rectangle(
                                           cells[CurrentCell].Column * cells[CurrentCell].CellWidth,
                                           cells[CurrentCell].Row * cells[CurrentCell].CellWidth,
                                           cells[CurrentCell].CellWidth,
                                           cells[CurrentCell].CellHeight
                                           ), color, Rotation, new Vector2(texture.Width / 2, texture.Height / 2), SpriteEffects.None, 0);
                }
            }
        }
Exemple #2
0
        public override void Update(ref GameTime gameTime)
        {
            LastState    = CurrentState;
            CurrentState = Mouse.GetState();

            CurrentPosition = new Vector2(CurrentState.X, CurrentState.Y);

            if (Reset)
            {
                Delta = InitialPosition - CurrentPosition;
            }
            else
            {
                Delta = CurrentPosition - new Vector2(LastState.X, LastState.Y);
            }

            if (Reset)
            {
                Mouse.SetPosition((int)InitialPosition.X, (int)InitialPosition.Y);
            }

            ScrollPosition = CurrentState.ScrollWheelValue;
            ScrollDelta    = ScrollPosition - LastState.ScrollWheelValue;

            if (CurrentState == LastState)
            {
                idleTime.Start();
            }
            else
            {
                idleTime.Reset();
            }
        }
Exemple #3
0
        public void Rumble(float Left, float Right, float Time, GameTime gameTime)
        {
            left   = Left;
            right  = Right;
            length = Time;

            GamePad.SetVibration(index, Left, Right);
            vibrationTimer.Start();
        }
Exemple #4
0
        public override void Update(ref GameTime gameTime)
        {
            UpdateStates();

            if (CurrentState == LastState)
            {
                idleTime.Start();
            }
            else
            {
                idleTime.Reset();
            }
        }
Exemple #5
0
        public override void Update(ref GameTime gameTime)
        {
            GetState();

            if (CurrentState == LastState)
            {
                idleTime.Start();
            }
            else
            {
                idleTime.Reset();
            }

            if (vibrationTimer.PassedTime > length)
            {
                vibrationTimer.Reset();
                left   = 0;
                right  = 0;
                length = 0;
                GamePad.SetVibration(index, 0, 0);
            }
        }
Exemple #6
0
 public void Start()
 {
     IsStopped = false;
     CurrentFrame = 0;
     Timer.Start();
 }