internal static bool ReadEnemyData(XElement enemyData, EnemyAssetData assetData, Declarations.EnemyType enemyType, out Declarations.EnemyData enemy) { switch (enemyType) { case Declarations.EnemyType.Swordsman: return(ReadBaseEnemyData(enemyData, assetData, out enemy)); case Declarations.EnemyType.Golem: return(ReadBaseEnemyData(enemyData, assetData, out enemy)); case Declarations.EnemyType.Dragon: return(ReadBaseEnemyData(enemyData, assetData, out enemy)); case Declarations.EnemyType.Rogue: return(ReadRogueData(enemyData, assetData, out enemy)); case Declarations.EnemyType.Boss: return(ReadBossData(enemyData, assetData, out enemy)); default: Debug.Log("Unknown enemy type"); break; } enemy = null; return(false); }
internal static bool IsGroundUnit(Declarations.EnemyType type) { switch (type) { case Declarations.EnemyType.Swordsman: case Declarations.EnemyType.Golem: case Declarations.EnemyType.Rogue: case Declarations.EnemyType.Boss: return(true); case Declarations.EnemyType.Dragon: return(false); default: Debug.LogError("Unknown enemy type"); return(true); } }
public static bool GetEnemyTypeFromString(string type, out Declarations.EnemyType enemyType) { if (string.IsNullOrEmpty(type)) { Debug.Log("Enemy type cannon be null or empty"); enemyType = Declarations.EnemyType.Swordsman; return(false); } switch (type) { case "Swordsman": enemyType = Declarations.EnemyType.Swordsman; break; case "Golem": enemyType = Declarations.EnemyType.Golem; break; case "Dragon": enemyType = Declarations.EnemyType.Dragon; break; case "Rogue": enemyType = Declarations.EnemyType.Rogue; break; case "Boss": enemyType = Declarations.EnemyType.Boss; break; default: Debug.Log(string.Format("Unknown enemy type: '{0}'", type)); enemyType = Declarations.EnemyType.Swordsman; return(false); } return(true); }