public static object ProcessUserInput(int enemyType, int enemyState) { switch (enemyType) { case (int)(EnemyEnum.Werewolf): { var isTransformed = enemyState % 2 == 0; return(EnemyCreator.GetEnemyObject(isTransformed)); } case (int)(EnemyEnum.Vampire): return(enemyState % 2 == 0 ? EnemyCreator.GetEnemyObject(true, false) : EnemyCreator.GetEnemyObject(false, true));; case (int)(EnemyEnum.Ghost): { bool isAngry = enemyState % 2 == 0 ? true : false; return(EnemyCreator.GetGhostEnemyObject(isAngry)); } } return(null); }
static void Main(string[] args) { Player player = PlayerCreator.GetPlayer(); var enemyType = UserInput.GetEnemyType(); var enemyState = UserInput.GetEnemyState(); var parsedEnemyType = int.Parse(enemyType); var userInput = UserInput.ProcessUserInput(parsedEnemyType, enemyState); UserDialogue.InitialGreeting(player.Name, player.Damage, player.Armour, player.HitPoints); if (parsedEnemyType == (int)EnemyEnum.Werewolf) { var enemy = EnemyCreator.CreateWerewolf(userInput, player); var convertedEnemy = (BaseClass)enemy; var convertedPlayer = (BaseClass)player; Actions.PerformAction(convertedEnemy, convertedPlayer); } if (parsedEnemyType == (int)EnemyEnum.Vampire) { var enemy = EnemyCreator.CreateVampire(userInput, player); var convertedEnemy = (BaseClass)enemy; var convertedPlayer = (BaseClass)player; Actions.PerformAction(convertedEnemy, convertedPlayer); } if (parsedEnemyType == (int)EnemyEnum.Ghost) { var enemy = EnemyCreator.CreateGhost(userInput, player); var convertedEnemy = (BaseClass)enemy; var convertedPlayer = (BaseClass)player; Actions.PerformAction(convertedEnemy, convertedPlayer); } Console.ReadLine(); }