protected override void OnLoad()
        {
            dtEnemy = GameEntry.DataTable.GetDataTable <DREnemy>();
            if (dtEnemy == null)
            {
                throw new System.Exception("Can not get data table Enemy");
            }

            DataProjectile dataProjectile = GameEntry.Data.GetData <DataProjectile>();

            if (dataProjectile == null)
            {
                Log.Error("Can't load DataProjectile");
                return;
            }

            dicEnemyData = new Dictionary <int, EnemyData>();

            DREnemy[] dREnemies = dtEnemy.GetAllDataRows();
            foreach (var drEnemy in dREnemies)
            {
                ProjectileData projectileData = dataProjectile.GetProjectileData(drEnemy.ProjectileData);
                EnemyData      enemyData      = new EnemyData(drEnemy, projectileData);
                dicEnemyData.Add(drEnemy.Id, enemyData);
            }
        }
        protected override void OnLoad()
        {
            DataProjectile dataProjectile = GameEntry.Data.GetData <DataProjectile>();

            if (dataProjectile == null)
            {
                Log.Error("Can't load DataProjectile");
                return;
            }

            dtTower = GameEntry.DataTable.GetDataTable <DRTower>();
            if (dtTower == null)
            {
                throw new System.Exception("Can not get data table Tower");
            }

            dtTowerLevel = GameEntry.DataTable.GetDataTable <DRTowerLevel>();
            if (dtTowerLevel == null)
            {
                throw new System.Exception("Can not get data table TowerLevel");
            }

            dicTowerData      = new Dictionary <int, TowerData>();
            dicTowerLevelData = new Dictionary <int, TowerLevelData>();
            dicTower          = new Dictionary <int, Tower>();

            DRTowerLevel[] drTowerLevels = dtTowerLevel.GetAllDataRows();
            foreach (var drTowerLevel in drTowerLevels)
            {
                if (dicTowerLevelData.ContainsKey(drTowerLevel.Id))
                {
                    throw new System.Exception(string.Format("Data tower level id '{0}' duplicate.", drTowerLevel.Id));
                }

                ProjectileData projectileData = dataProjectile.GetProjectileData(drTowerLevel.ProjectileData);
                TowerLevelData towerLevelData = new TowerLevelData(drTowerLevel, projectileData);
                dicTowerLevelData.Add(drTowerLevel.Id, towerLevelData);
            }

            DRTower[] drTowers = dtTower.GetAllDataRows();
            foreach (var drTower in drTowers)
            {
                TowerLevelData[] towerLevelDatas = new TowerLevelData[drTower.Levels.Length];
                for (int i = 0; i < drTower.Levels.Length; i++)
                {
                    if (!dicTowerLevelData.ContainsKey(drTower.Levels[i]))
                    {
                        throw new System.Exception(string.Format("Can not find tower level id '{0}' in DataTable TowerLevel.", drTower.Levels[i]));
                    }

                    towerLevelDatas[i] = dicTowerLevelData[drTower.Levels[i]];
                }

                TowerData towerData = new TowerData(drTower, towerLevelDatas);
                dicTowerData.Add(drTower.Id, towerData);
            }
        }