Update() public méthode

public Update ( ) : void
Résultat void
 public void Update()
 {
     Sprite.Update();
     PhysicsObject.Update();
     Timer++;
     if (Timer > Lifetime)
     {
         particles.Destroy();
         Game1.Instance.currentState.Level.RemoveFromLevel(this);
     }
     if (Position.Y > 800)
     {
         particles.Destroy();
         Game1.Instance.currentState.Level.RemoveFromLevel(this);
     }
 }
Exemple #2
0
        private void PlayerMovement()
        {
            var pos0 = _playerObject.Position;
            var pos1 = _playerObject.Position;

            _playerObject.Update();
            const int checkCount = 4;
            var       step       = (_playerObject.Position - pos1) / checkCount;

            _playerObject.Position = pos1;
            for (int i = 0; i < checkCount; i++)
            {
                pos1 = _playerObject.Position;
                _playerObject.Position += step;
                if (_floorObject.CollisionTest(_playerObject.TranslatedAABBB).IsCollision)
                {
                    _playerObject.Position = pos1;
                    _playerObject.Velocity = (pos1 - pos0) * 60D;
                    return;
                }
            }
        }