public static void TrainingCollision(GameObject spell, GameObject trainingAttack) { SpellController spellControllerScript = spell.GetComponent <SpellController>(); TrainingAttackController trainingAttackControllerScript = trainingAttack.GetComponent <TrainingAttackController>(); MagicType spellType = spellControllerScript.m_elementType; MagicType attackType = trainingAttackControllerScript.m_elementType; spellControllerScript.PrepareToDie(); if ((int)spellType == (int)(attackType + 1) % s_numOfMagicElements) { trainingAttackControllerScript.PrepareToDie(); } }