Exemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            if (_ideLayTime == _delayTime)
            {
                //Update sprite cho button.
                if (IsMouseHover)
                {
                    _sprite[1].Itexture2D = (_sprite[1].Itexture2D + 1) % _sprite[1].Ntexture2D;
                }
                else
                {
                    _sprite[0].Itexture2D = (_sprite[0].Itexture2D + 1) % _sprite[0].Ntexture2D;
                }

                //Nếu như Fire đã nổ xong thì ko update nữa..
                if (_sprite[2].Itexture2D < _sprite[2].Ntexture2D)
                {
                    _sprite[2].Itexture2D += 1;
                    if (_sprite[2].Itexture2D < _sprite[2].Ntexture2D)
                    {
                        _sprite[2].Itexture2D %= _sprite[2].Ntexture2D;
                    }
                }

                //Update vị trí cho button.
                if (!_motionInfo.IsStanding)
                {
                    Vector2 newPos = _motionInfo.Move(new Vector2(X, Y));
                    X = newPos.X;
                    Y = newPos.Y;
                }

                if (_isClicked)
                {
                    if (!_motionInfo.IsStanding)
                    {
                        _motionInfo.Move(new Vector2(X, Y));
                    }
                    else
                    {
                        OnMouse_Click(this, null);
                    }
                }
            }
            else
            {
                _ideLayTime += 1;
            }
        }
Exemplo n.º 2
0
 public override void Update(GameTime gameTime)
 {
     if (_iDelayTime == _delayTime)
     {
         //Update vị trí cho menu.
         //if (!_motionInfo.IsStanding)
         if (_motionInfo != null)
         {
             if (!_motionInfo.IsStanding)
             {
                 //Vector2 newPos = _motionInfo.Move(new Vector2(X, Y));
                 _motionInfo.Move(new Vector2(X, Y));
                 //X = newPos.X;
                 //Y = newPos.Y;
             }
         }
     }
     else
     {
         _iDelayTime++;
     }
 }
Exemplo n.º 3
0
 public override void Update(GameTime gameTime)
 {
     if (_iDelayTime == _delayTime)
     {
         if (_motion != null)
         {
             if (!_motion.IsStanding)
             {
                 IsVisible = true;
                 _motion.Move(new Vector2(X, Y));
                 if (_motion.IsStanding)
                 {
                     Rectangle _testVisible = new Rectangle(0, 0, GlobalVariables.ScreenWidth, GlobalVariables.ScreenHeight);
                     Point     _point1      = new Point((int)_x, (int)_y);
                     Point     _point2      = new Point((int)_x + (int)_width, (int)_y);
                     Point     _point3      = new Point((int)_x, (int)_y + (int)_height);
                     Point     _point4      = new Point((int)_x + (int)_width, (int)_y + (int)_height);
                     if (_testVisible.Contains(_point1) || _testVisible.Contains(_point2) || _testVisible.Contains(_point3) || _testVisible.Contains(_point4))
                     {
                         _isVisible = true;
                     }
                     else
                     {
                         _isVisible = false;
                     }
                     OnMove_Complete(this, null);
                 }
             }
         }
         for (int i = 0; i < _nChild; i++)
         {
             _child[i].Update(gameTime);
         }
     }
     else
     {
         _iDelayTime++;
     }
 }
Exemplo n.º 4
0
        public override void Update(GameTime gameTime)
        {
            if (_iDelayTime == _delayTime)
            {
                //Update vị trí cho menu.
                if (!_motionInfo.IsStanding)
                {
                    Vector2 newPos = _motionInfo.Move(new Vector2(X, Y));
                    X = newPos.X;
                    Y = newPos.Y;
                }
            }
            else
            {
                _iDelayTime++;
            }

            //Update vị trí các button
            for (int i = 0; i < _child.Count; ++i)
            {
                _child[i].Update(gameTime);
            }
        }