public void Handle(ICollidable object1, ICollidable object2, CollisionDirection.DirectionTag direction)
 {
     if (typeof(Fireball).IsInstanceOfType(object1) && typeof(AbstractPipe).IsInstanceOfType(object2))
     {
         fireball = (Fireball)object1;
         pipe     = (AbstractPipe)object2;
         fireball.Explode();
         GameManager.Instance.Remove(fireball);
     }
 }
예제 #2
0
 public static void HandleCollision(Fireball fireball, IEnemy enemy)
 {
     if (fireball.Collidable && enemy.Collidable)
     {
         enemy.TakeDamage();
         ScoreManager.CollectEnemyScore(enemy, false);
         fireball.Explode();
         SoundFactory.Instance.PlayKickEnemySound();
     }
 }
 public void Handle(ICollidable object1, ICollidable object2, CollisionDirection.DirectionTag direction)
 {
     if (typeof(Enemy).IsInstanceOfType(object1) && typeof(Fireball).IsInstanceOfType(object2))
     {
         this.enemy    = (Enemy)object1;
         this.fireball = (Fireball)object2;
         fireball.Explode();
         GameManager.Instance.Remove(enemy);
         GameManager.Instance.Remove(fireball);
     }
 }
 private void DetonateAllFireballs()
 {
     GameObject[] fbs = GameObject.FindGameObjectsWithTag("BossProjectile");
     foreach (GameObject fb in fbs)
     {
         Fireball script = fb.GetComponent <Fireball>();
         if (script != null)
         {
             script.Explode();
         }
     }
 }
예제 #5
0
        public void Handle(ICollidable object1, ICollidable object2, CollisionDirection.DirectionTag direction)
        {
            if (typeof(Fireball).IsInstanceOfType(object1) && typeof(AbstractBlock).IsInstanceOfType(object2))
            {
                fireball = (Fireball)object1;
                block    = (AbstractBlock)object2;
                if (!typeof(GroundBlock).IsInstanceOfType(object2) && (direction == CollisionDirection.DirectionTag.Left || direction == CollisionDirection.DirectionTag.Right))
                {
                    fireball.Explode();
                    GameManager.Instance.Remove(fireball);
                    GameManager.Instance.Remove(block);
                }
                else
                {
                    switch (direction)
                    {
                    case CollisionDirection.DirectionTag.Top:
                        fireball.BounceVertically();
                        break;

                    case CollisionDirection.DirectionTag.Bottom:
                        fireball.BounceVertically();
                        break;

                    case CollisionDirection.DirectionTag.Left:
                        fireball.BounceHorizontally();
                        break;

                    case CollisionDirection.DirectionTag.Right:
                        fireball.BounceHorizontally();
                        break;

                    default:
                        Console.WriteLine(Config.GetCollisionResolutionException() + GetType().ToString());
                        break;
                    }
                }
            }
        }
예제 #6
0
        public void Handle(ICollidable object1, ICollidable object2, CollisionDirection.DirectionTag direction)
        {
            if (typeof(Fireball).IsInstanceOfType(object1) && typeof(AbstractBlock).IsInstanceOfType(object2))
            {
                fireball = (Fireball)object1;
                block    = (AbstractBlock)object2;
                if (typeof(StairBlock).IsInstanceOfType(object2))
                {
                    fireball.Explode();
                    GameManager.Instance.Remove(fireball);
                }
                else
                {
                    switch (direction)
                    {
                    case CollisionDirection.DirectionTag.Top:
                        fireball.BounceVertically();
                        break;

                    case CollisionDirection.DirectionTag.Bottom:
                        fireball.BounceVertically();
                        break;

                    case CollisionDirection.DirectionTag.Left:
                        fireball.BounceHorizontally();
                        break;

                    case CollisionDirection.DirectionTag.Right:
                        fireball.BounceHorizontally();
                        break;

                    default:
                        Console.WriteLine("Unexpected direction received by FireballBlockCollisionResolution");
                        break;
                    }
                }
            }
        }
        public static void HandleCollision(Fireball fireball, IGameObject block, CollisionSide side)
        {
            if (fireball.Collidable && block.Collidable)
            {
                switch (side)
                {
                case CollisionSide.Left:
                case CollisionSide.Right:
                    fireball.Explode();
                    Factories.SoundFactory.Instance.PlayBumpBlockSound();
                    break;

                case CollisionSide.Top:
                    fireball.Physics.CollisionVertical(block.Physics.Location.Y - fireball.Rectangle.Height);
                    fireball.Jump();
                    break;

                case CollisionSide.Bottom:
                    fireball.Physics.CollisionVertical(block.Physics.Location.Y - fireball.Rectangle.Height);
                    break;
                }
            }
        }
예제 #8
0
        public static void UpdateLocation(Fireball fireball, IBlock block, Direction direction)
        {
            switch (direction)
            {
            case Direction.Top:
                fireball.Location = new Microsoft.Xna.Framework.Vector2(fireball.Location.X, block.Location.Y - fireball.Rectangle.Height);
                fireball.FireballPhysicalProperty.Velocity = new Microsoft.Xna.Framework.Vector2(fireball.FireballPhysicalProperty.Velocity.X, Util.Instance.Vector_fireball_j);
                fireball.FireballPhysicalProperty.Jump();
                break;

            case Direction.Bottom:
                fireball.FireballPhysicalProperty.Jump();
                fireball.Location = new Microsoft.Xna.Framework.Vector2(fireball.Location.X, block.Location.Y - fireball.Rectangle.Height);
                fireball.FireballPhysicalProperty.Velocity = new Microsoft.Xna.Framework.Vector2(fireball.FireballPhysicalProperty.Velocity.X, Util.Instance.Vector_fireball_j);
                fireball.FireballPhysicalProperty.Jump();
                break;

            case Direction.Left:
            case Direction.Right:
                fireball.Explode();
                SoundFactory.Instance.PlayBumpBlockSound();
                break;
            }
        }
 public static void HandleCollision(Fireball fireball, IBoss boss)
 {
     fireball.Explode();
     boss.CollideWithFireball(fireball);
     SoundFactory.Instance.PlayKickEnemySound();
 }