Beispiel #1
0
 private void Move(object obj)
 {
     if (PolarCoordinateHelper.GetDirection(Coordinates, CoordinatesTo).X *_direction.X <= 0 ||
         PolarCoordinateHelper.GetDirection(Coordinates, CoordinatesTo).Y *_direction.Y <= 0)
     {
         Dispose();
         return;
     }
     Coordinates += _direction * 10;
 }
Beispiel #2
0
        public Bullet(BulletType bulletType, string shooter, Vector2 coordinatesFrom, Vector2 coordinatesTo)
        {
            Shooter         = shooter;
            Type            = bulletType;
            CoordinatesFrom = coordinatesFrom;
            CoordinatesTo   = coordinatesTo;
            Coordinates     = CoordinatesFrom;
            Damage          = 10f;
            _direction      = PolarCoordinateHelper.GetDirection(CoordinatesFrom, CoordinatesTo);
            _direction.Normalize();

            _movingTimer = new Timer(Move, null, 0, 20);
        }