예제 #1
0
 public Meteor(MeteorType meteorType, Point initialLocation)
 {
     IsActive = true;
     _meteorSprite = new Sprite();
     _meteorType = meteorType;
     CreateMeteor(initialLocation);
 }
예제 #2
0
        public void Activate()
        {
            _shipSprite = new Sprite();
            _shipSprite.Polygon = new[]
            {
                new Point(0, 0),
                new Point(30, 0),
                new Point(30, 20),
                new Point(0, 20),
                new Point(0, 0)};

            _startTime = DateTime.Now;
            _location = new Point(Constants.CanvasWidth, 60);
        }
예제 #3
0
        public void Fire(Point startLocation, double direction, float maxDistance, PhotonTimeManager photoTimeManager)
        {
            _photonTimeManager = photoTimeManager;

            if(!EnoughTimeHasPassed())
                return;

            _maxDistance = maxDistance;
            _distanceTraveled = 0;
            _bulletSprite = new Sprite();
            _bulletSprite.Polygon = new[]
                                        {
                                            new Point(startLocation.X, startLocation.Y),
                                            new Point(startLocation.X+1, startLocation.Y+1),
                                            new Point(startLocation.X, startLocation.Y)
                                        };

            _bulletSprite.Speed = Constants.BulletSpeed;
            _bulletSprite.TravelDirectionInDegrees = direction;
            _location = startLocation;
            _photonTimeManager.SetFired();
        }
예제 #4
0
 public PlayerShip()
 {
     _isActive = true;
     _shipSprite = new Sprite();
     _shipSprite.TravelDirectionInDegrees = 30f;
 }
예제 #5
0
 internal bool CollidesWith(Sprite sprite)
 {
     return sprite.Polygon.CollidesWith(this.Polygon);
 }