private void GetEnemyParameters(GameObject enemySpawnedPar) { EnemyCombat stats = enemySpawnedPar.GetComponent <EnemyCombat>(); if (stats != null) { float[] probabilities = stats.GetEnemyProbabilities(); sumProbability = probabilities[0]; substractionProbability = probabilities[1]; multiplyProbability = probabilities[2]; divideProbability = probabilities[3]; maxOperations = stats.GetMaxOperations(); monsterMovementsOnDefeat = stats.GetEnemyMovementsOnDefeat(); } else { Debug.LogError("Enemy spawned don't have the EnemyCombat component"); } }