public void CheckMonsters(string lineCoords) { bool monsterGotDamaged = false; //Debug.Log("The closest shape: " + closest + ", " + lineCoords); //GameObject[] MonsterObjectList = GameObject.FindGameObjectsWithTag("Monsters"); DrawingManager.LineType closest = DrawingManager.ClosestLineType(lineCoords); DrawingManager.LineType detectedType = DrawingManager.LineType.nothing; bool detectedALineType = false; Monster[] MonsterObjectList = FindObjectsOfType <Monster>(); foreach (Monster m in MonsterObjectList) { if (closest == m.myLine) { detectedType = closest; detectedALineType = true; soundManager.RandomDeathSound().Play(); m.health--; monsterGotDamaged = true; DrawingManager.LineType oldLine = m.myLine; if (m.health > 0) { while (oldLine == m.myLine) { m.SetMyLine(DrawingManager.RandomLineType(), false); } } } } if (detectedALineType) { Debug.Log("Grid detected: " + detectedType.ToString()); } else { Debug.Log("Grid does not detect"); } if (!monsterGotDamaged && !GameManager.hitModeChangeBlob) { //Debug.Log("You draw it wrong!"); soundManager.incorrectSound.Play(); GameManager.hitModeChangeBlob = false; } else if (GameManager.hitModeChangeBlob) { GameManager.hitModeChangeBlob = false; } }