Esempio n. 1
0
        /// <summary>
        /// to be called to raise the destruction event
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnDestruction(BlockDestructEvent e)
        {
            EventHandler <BlockDestructEvent> handler = this.destruction;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// gets called if the block is mined
        /// call to mine a block immediately
        /// </summary>
        /// <param name="silent">wether the block should be hidden or not</param>
        public void Destruct(Boolean silent = false)
        {
            // set hitpoints to minus one
            this.hitpoints = -1;

            // call onDestruction event
            BlockDestructEvent destructevent = new BlockDestructEvent();

            destructevent.silent = silent;
            this.OnDestruction(destructevent);
        }
Esempio n. 3
0
File: Block.cs Progetto: XF9/Fenrir
 /// <summary>
 /// to be called to raise the destruction event
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnDestruction(BlockDestructEvent e)
 {
     EventHandler<BlockDestructEvent> handler = this.destruction;
     if (handler != null)
         handler(this, e);
 }
Esempio n. 4
0
File: Scene.cs Progetto: XF9/Fenrir
 /// <summary>
 /// handles the event thats get raised if a blocks get destructed
 /// </summary>
 /// <param name="block">the block</param>
 /// <param name="arguments">the arguments</param>
 private void OnBlockDestructed(object block, BlockDestructEvent arguments)
 {
     try
     {
         Block theBlock = block as Block;
         this.OnDestructBlockEvent(theBlock);
     }
     catch (Exception e)
     {
         FenrirGame.Instance.Log(LogLevel.Error, "failed to handle block destruction event! " + ((Block)block).GridPosition + " - " + e.Message);
         FenrirGame.Instance.Log(LogLevel.Error, e.StackTrace);
     }
 }
Esempio n. 5
0
File: Block.cs Progetto: XF9/Fenrir
        /// <summary>
        /// gets called if the block is mined
        /// call to mine a block immediately
        /// </summary>
        /// <param name="silent">wether the block should be hidden or not</param>
        public void Destruct(Boolean silent = false)
        {
            // set hitpoints to minus one
            this.hitpoints = -1;

            // call onDestruction event
            BlockDestructEvent destructevent = new BlockDestructEvent();
            destructevent.silent = silent;
            this.OnDestruction(destructevent);
        }