Beispiel #1
0
 public bool Unregister(GameplayObject component)
 {
     switch (component.GetAssetType())
     {
         case SpriteType.BOMB:
             m_drawableComponents.Remove(m_bomb);
             m_bomb = null;
             break;
         case SpriteType.PLAYER_WALK:
             m_drawableComponents.Remove(m_player);
             m_player = null;
             break;
         case SpriteType.PLAYER_STAND:
             m_drawableComponents.Remove(m_player);
             m_player = null;
             break;
         case SpriteType.DIRT_FLOOR:
             m_drawableComponents.Remove(m_environmentTile);
             m_environmentTile = null;
             break;
         case SpriteType.EXPLOSION:
             m_drawableComponents.Remove(m_explosion);
             m_explosion = null;
             break;
         case SpriteType.WALL:
             m_drawableComponents.Remove(m_wall);
             m_wall = null;
             break;
         case SpriteType.CRATE:
             m_drawableComponents.Remove(m_crate);
             m_crate = null;
             break;
         case SpriteType.POWERUP:
             m_drawableComponents.Remove(m_powerup);
             m_powerup = null;
             break;
         default:
             throw new Exception("An unhandled type was detected in BoardTile.");
     }
     //Console.Write(GetDebugLog());
     return true;
 }
Beispiel #2
0
 public bool Register(GameplayObject component)
 {
     if (!Contains(component.GetAssetType()))
     {
         switch (component.GetAssetType())
         {
             case SpriteType.BOMB:
                 m_bomb = (Bomb)component;
                 m_drawableComponents.Add(m_bomb);
                 break;
             case SpriteType.PLAYER_WALK:
                 m_player = (Player)component;
                 m_drawableComponents.Add(m_player);
                 break;
             case SpriteType.PLAYER_STAND:
                 m_player = (Player)component;
                 m_drawableComponents.Add(m_player);
                 break;
             case SpriteType.DIRT_FLOOR:
                 m_environmentTile = (EnvironmentTile)component;
                 m_drawableComponents.Add(m_environmentTile);
                 break;
             case SpriteType.EXPLOSION:
                 if (!IsTypeRegistered(SpriteType.WALL))
                 {
                     m_explosion = (Explosion)component;
                     m_drawableComponents.Add(m_explosion);
                 }
                 break;
             case SpriteType.WALL:
                 m_wall = (Wall)component;
                 m_drawableComponents.Add(m_wall);
                 break;
             case SpriteType.CRATE:
                 m_crate = (Crate)component;
                 m_drawableComponents.Add(m_crate);
                 break;
             case SpriteType.POWERUP:
                 m_powerup = (Powerup)component;
                 m_drawableComponents.Add(m_powerup);
                 break;
             default:
                 throw new Exception("An unhandled type was detected in BoardTile.");
         }
         return true;
     }
     return false;
     //Console.Write(GetDebugLog());
 }