예제 #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);
            }
        }
예제 #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);
        }
예제 #3
0
파일: Block.cs 프로젝트: 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);
 }
예제 #4
0
파일: Scene.cs 프로젝트: 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);
     }
 }
예제 #5
0
파일: Block.cs 프로젝트: 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);
        }