Example #1
0
 public Explosion(int strength, explosiontype type, int posX, int posY)
 {
     this.strength = strength;
     this.type     = type;
     this.setX(posX);
     this.setY(posY);
 }
Example #2
0
        public void Destroy(int radius, explosiontype type)
        {
            // For y axe
            for (int y = -radius; y <= radius; y++)
            {
                // For x axe
                for (int x = -radius; x <= radius; x++)
                {
                    if (x * x + y * y <= radius * radius)
                    {
                        if (!IsOutOfMap(x, y))
                        {
                            // Check if terrain isn't null
                            if (World.terrain[getX() + x, getY() + y] != null)
                            {
                                // Check all entiy
                                foreach (Entity entity in World.entities)
                                {
                                    // Is in radius
                                    if (entity.getX() < getX() + 4 && entity.getX() > getX() - 4 && entity.getY() < getY() + 4 && entity.getY() > getY() - 4)
                                    {
                                        // Check EntityBomb
                                        if (entity is EntityBomb)
                                        {
                                            // If bomb explode
                                            ((EntityBomb)entity).executeAITask();
                                        }
                                        else if (entity is EntityPlayer)
                                        {
                                            // If Player setDead
                                            ((EntityPlayer)entity).setDead();
                                        }
                                        else
                                        {
                                            // Else setDead
                                            entity.setDead();
                                        }
                                    }
                                }

                                // Add every block to list
                                blocks.Add(World.terrain[getX() + x, getY() + y]);

                                // Change Terrain
                                World.changeTerrainElement(getX() + x, getY() + y, null);
                            }
                        }
                    }
                }
            }

            new Thread(Remake).Start();
        }
Example #3
0
 public void Damage(int strength, explosiontype type)
 {
 }
Example #4
0
 public void Particle(int strength, explosiontype type, int x, int y)
 {
 }
Example #5
0
 public void setType(explosiontype type)
 {
     this.type = type;
 }