コード例 #1
0
ファイル: FinalBoss.cs プロジェクト: cmark89/AsteroidRebuttal
        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));
            }
        }
コード例 #2
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--;
            //}
        }
コード例 #3
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--;

                if (Health <= 0)
                    Explode();
            }
        }
コード例 #4
0
ファイル: Tortoise.cs プロジェクト: cmark89/AsteroidRebuttal
        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();
            }
        }
コード例 #5
0
 public void OuterCollision(GameObject sender, CollisionEventArgs e)
 {
     if (OnOuterCollision != null)
         OnOuterCollision(sender, e);
 }
コード例 #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;
            }
        }
コード例 #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();
            }
        }