Example #1
0
 public override void MissileEndByRange(Missile missile)
 {
     Explode(missile);
 }
Example #2
0
 public override void MissileHitObject(Missile missile)
 {
     Explode(missile);
 }
Example #3
0
 public virtual void MissileEndByRange(Missile missile)
 {
 }
Example #4
0
 public virtual void MissileHitObject(Missile missile)
 {
 }
Example #5
0
 public virtual void MissileHit(Missile missile, Character target)
 {
 }
Example #6
0
        public static bool MissileHitObject(Missile missile)
        {
            int       tileX;
            int       tileY;
            Rectangle tileBound;

            switch (missile.Dir)
            {
            case Dir.Up:
                tileY = missile.HitBox.Y / Globals.TileSize;
                for (int i = missile.HitBox.X / Globals.TileSize; i <= (missile.HitBox.X + missile.HitBox.Width) / Globals.TileSize; i += 1)
                {
                    if (tileY < Game.World.TileList.GetLength(1) && i < Game.World.TileList.GetLength(0))
                    {
                        tileX = i;
                        if (Game.World.TileList[tileX, tileY].IsBlocked)
                        {
                            tileBound = new Rectangle(tileX * Globals.TileSize + 4, tileY * Globals.TileSize + 4, Globals.TileSize - 8, Globals.TileSize - 14);
                            if (missile.HitBox.IntersectsWith(tileBound))
                            {
                                return(true);
                            }
                        }
                    }
                }
                break;

            case Dir.Down:
                tileY = (missile.HitBox.Y + missile.HitBox.Height) / Globals.TileSize;
                for (int i = missile.HitBox.X / Globals.TileSize; i <= (missile.HitBox.X + missile.HitBox.Width) / Globals.TileSize; i += 1)
                {
                    if (tileY < Game.World.TileList.GetLength(1) && i < Game.World.TileList.GetLength(0))
                    {
                        tileX = i;
                        if (Game.World.TileList[tileX, tileY].IsBlocked)
                        {
                            tileBound = new Rectangle(tileX * Globals.TileSize + 4, tileY * Globals.TileSize + 4, Globals.TileSize - 8, Globals.TileSize - 14);
                            if (missile.HitBox.IntersectsWith(tileBound))
                            {
                                return(true);
                            }
                        }
                    }
                }
                break;

            case Dir.Left:
                tileX = missile.HitBox.X / Globals.TileSize;
                for (int i = missile.HitBox.Y / Globals.TileSize; i <= (missile.HitBox.Y + missile.HitBox.Height) / Globals.TileSize; i += 1)
                {
                    if (tileX < Game.World.TileList.GetLength(0) && i < Game.World.TileList.GetLength(1))
                    {
                        tileY = i;
                        if (Game.World.TileList[tileX, tileY].IsBlocked)
                        {
                            tileBound = new Rectangle(tileX * Globals.TileSize + 4, tileY * Globals.TileSize + 4, Globals.TileSize - 8, Globals.TileSize - 14);
                            if (missile.HitBox.IntersectsWith(tileBound))
                            {
                                return(true);
                            }
                        }
                    }
                }
                break;

            case Dir.Right:
                tileX = (missile.HitBox.X + missile.HitBox.Width) / Globals.TileSize;
                for (int i = missile.HitBox.Y / Globals.TileSize; i <= (missile.HitBox.Y + missile.HitBox.Height) / Globals.TileSize; i += 1)
                {
                    if (tileX < Game.World.TileList.GetLength(0) && i < Game.World.TileList.GetLength(1))
                    {
                        tileY = i;
                        if (Game.World.TileList[tileX, tileY].IsBlocked)
                        {
                            tileBound = new Rectangle(tileX * Globals.TileSize + 4, tileY * Globals.TileSize + 4, Globals.TileSize - 8, Globals.TileSize - 14);
                            if (missile.HitBox.IntersectsWith(tileBound))
                            {
                                return(true);
                            }
                        }
                    }
                }
                break;
            }

            return(false);
        }
Example #7
0
 public override void MissileHit(Missile missile, Character target)
 {
     base.MissileHit(missile, target);
     SoundManager.PlayByFileName(SFXs[Globals.gen.Next(0, SFXs.Count)]);
 }