示例#1
0
        public bool Destroy( )
        {
            if (this == null || this.Deleted)
            {
                return(false);
            }

            if (OnBeforeDestroyed( ))
            {
                if (m_Child != null && !m_Child.Deleted && !m_Child.Alive)
                {
                    if (m_Child != null)
                    {
                        m_Child.Delete( );
                    }

                    Delete( );
                    return(true);
                }
                else
                {
                    Delete( );
                    return(true);
                }
            }

            return(false);
        }
示例#2
0
        public virtual bool Destroy( )
        {
            if (this == null || this.Deleted)
            {
                return(false);
            }

            if (OnBeforeDestroyed( ))
            {
                if (m_Child != null && !m_Child.Deleted && !m_Child.Alive)
                {
                    WoodenBox lootbox = new WoodenBox( );
                    lootbox.Name = this.Name + " Loot Box";

                    OnDestroyed(lootbox);

                    if (lootbox != null && !lootbox.Deleted)
                    {
                        if (DropsLoot)
                        {
                            lootbox.MoveToWorld(new Point3D(this.X, this.Y, this.Z), this.Map);
                            lootbox.AddItem(new Gold(100));
                            lootbox.Destroy();
                        }
                        else
                        {
                            lootbox.Delete( );
                        }
                    }

                    if (m_Child != null)
                    {
                        m_Child.Delete( );
                    }

                    Delete( );

                    return(true);
                }
                else
                {
                    WoodenBox lootbox = new WoodenBox( );
                    lootbox.Name = this.Name + " Loot Box";

                    OnDestroyed(lootbox);

                    if (lootbox != null && !lootbox.Deleted)
                    {
                        if (DropsLoot)
                        {
                            lootbox.MoveToWorld(new Point3D(this.X, this.Y, this.Z), this.Map);
                            lootbox.AddItem(new Gold(100));
                            lootbox.Destroy();
                        }
                        else
                        {
                            lootbox.Delete();
                        }
                    }

                    Delete( );
                    return(true);
                }
            }

            return(false);
        }
示例#3
0
        public bool Destroy( )
        {
            if (this == null || this.Deleted)
            {
                return(false);
            }

            if (OnBeforeDestroyed( ))
            {
                if (m_Child != null && !m_Child.Deleted && !m_Child.Alive)
                {
                    Rubble rubble = new Rubble(m_DestroyedID, this.Name);

                    if (rubble != null && !rubble.Deleted && this.Map != null && this.Map != Map.Internal)
                    {
                        rubble.MoveToWorld(this.Location, this.Map);
                    }

                    WoodenBox lootbox = new WoodenBox( );
                    lootbox.Name = this.Name + " Loot Box";

                    OnDestroyed(lootbox);

                    if (lootbox != null && !lootbox.Deleted)
                    {
                        if (DropsLoot)
                        {
                            lootbox.MoveToWorld(new Point3D(this.X, this.Y, this.Z), this.Map);
                        }
                        else
                        {
                            lootbox.Delete( );
                        }
                    }

                    if (m_Child != null)
                    {
                        m_Child.Delete( );
                    }

                    Delete( );

                    return(true);
                }
                else
                {
                    Static rubble = new Static(m_DestroyedID);

                    if (rubble != null && !rubble.Deleted && this.Map != null && this.Map != Map.Internal)
                    {
                        rubble.MoveToWorld(this.Location, this.Map);
                    }

                    WoodenBox lootbox = new WoodenBox( );
                    lootbox.Name = this.Name + " Loot Box";

                    OnDestroyed(lootbox);

                    if (lootbox != null && !lootbox.Deleted)
                    {
                        if (DropsLoot)
                        {
                            lootbox.MoveToWorld(new Point3D(this.X, this.Y, this.Z), this.Map);
                        }
                        else
                        {
                            lootbox.Delete( );
                        }
                    }

                    Delete( );
                    return(true);
                }
            }

            return(false);
        }