Beispiel #1
0
        public void CollisionHandling(GameObject sender, CollisionEventArgs e)
        {
            if (CollidedObjects.Contains(sender))
                return;
            else
                CollidedObjects.Add(sender);

            // If collision occured with a player bullet...
            if (e.collisionLayer == 2)
            {
                sender.Destroy();
                // Flash the thing here.
                if (Vulnerable)
                {
                    // Flash the thing here.
                    Health--;
                }
            }

            // Collided with player; kill!
            if (e.collisionLayer == 3)
            {
                PlayerShip thisShip = (PlayerShip)e.otherObject;
                thisShip.ObjectCollidedWith(this, new CollisionEventArgs(this, 1));
            }
        }
        public void CollisionHandling(GameObject sender, CollisionEventArgs e)
        {
            if (CollidedObjects.Contains(sender))
            {
                return;
            }
            else
                CollidedObjects.Add(sender);

            // If collision occured with a player bullet...
            //if (e.collisionLayer == 2)
            //{
                //sender.Destroy();
                // Flash the thing here.
                //Health--;
            //}
        }
        public void CollisionHandling(GameObject sender, CollisionEventArgs e)
        {
            if (CollidedObjects.Contains(sender))
                return;
            else
                CollidedObjects.Add(sender);

            // If collision occured with a player bullet...
            if (e.collisionLayer == 2)
            {
                sender.Destroy();
                // Flash the thing here.
                Health--;

                if (Health <= 0)
                    Explode();
            }
        }
Beispiel #4
0
        public void CollisionHandling(GameObject sender, CollisionEventArgs e)
        {
            if (CollidedObjects.Contains(sender))
            {
                return;
            }
            else
                CollidedObjects.Add(sender);

            // If collision occured with a player bullet...
            if (e.collisionLayer == 2)
            {
                sender.Destroy();
                // Flash the thing here.
                Health--;
                CheckForDeath();
            }
            else if (e.collisionLayer == 3)
            {
                Health -= 2;
                CheckForDeath();
            }
        }
Beispiel #5
0
 public void OuterCollision(GameObject sender, CollisionEventArgs e)
 {
     if (OnOuterCollision != null)
         OnOuterCollision(sender, e);
 }
Beispiel #6
0
        public void ObjectGrazed(GameObject sender, CollisionEventArgs e)
        {
            // If the object grazed was a bullet, graze it and report the graze.
            if (sender is Bullet)
            {
                Bullet thisBullet = (Bullet)sender;
                if (!thisBullet.Grazed)
                {
                    thisBullet.Grazed = true;
                    thisScene.GrazeCount++;
                    thisScene.Score += thisScene.GrazeValue;

                    thisScene.GainExperience(1f);
                    thisScene.PauseExperienceDecay(1f);
                }
                return;
            }
        }
Beispiel #7
0
        public void ObjectCollidedWith(GameObject sender, CollisionEventArgs e)
        {
            if (!Phasing && (sender is Bullet || sender is Enemy || sender is Boss))
            {
                Phasing = true;
                thisScene.PlayAnimation(new Animation(GameScene.PlayerExplosionTexture, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, 48, 20f, new Vector2(Center.X - 24, Center.Y - 25), false));
                AudioManager.PlaySoundEffect(GameScene.Explosion3Sound, .8f);

                thisScene.ResetRank();
                thisScene.scriptManager.Execute(thisScene.TryRespawn);

                Destroy();
            }
        }