public void CheckMonsters2(string lineName) { bool monsterGotDamaged = false; bool monsterDied = false; int tempScore = GameManager.score; Monster[] MonsterObjectList = FindObjectsOfType <Monster>(); foreach (Monster m in MonsterObjectList) { if (lineName == (m.myLine).ToString()) { m.health--; monsterGotDamaged = true; DrawingManager.LineType oldLine = m.myLine; if (m.health > 0) { while (oldLine == m.myLine) { m.SetMyLine(DrawingManager.RandomLineType(), false); } } else if (m.health <= 0) { monsterDied = true; } } } if (monsterGotDamaged) { soundManager.RandomHurtSound().Play(); } if (monsterDied) { int intensity; int pointsGained = GameManager.score - tempScore; if (pointsGained >= 25) { intensity = 2; } else if (pointsGained >= 10) { intensity = 1; } else { intensity = 0; } soundManager.RandomDeathSound(intensity).Play(); } if (!monsterGotDamaged && !GameManager.hitModeChangeBlob) { //Debug.Log("You draw it wrong!"); soundManager.incorrectSound.Play(); GameManager.hitModeChangeBlob = false; } else if (GameManager.hitModeChangeBlob) { GameManager.hitModeChangeBlob = false; } }
public void SetMyLine(DrawingManager.LineType newLine, bool bypassDifficulty) { if (!bypassDifficulty) { while ((DrawingManager.symbolDifficulty[(int)newLine] > maxDifficulty || DrawingManager.symbolDifficulty[(int)newLine] > (GameManager.kills / 10) + 1)) //generate a new symbol if the generated symbol has a higher difficulty than the max difficulty allowed for the monster or is greater than (kills/10)+2 (Max 1 for 0-9 kills, Max 2 for 10-19 kills... { newLine = DrawingManager.RandomLineType(); } } SetMyLine(newLine); }
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; } }
public void SetMyLine(DrawingManager.LineType newLine) { myLine = newLine; SpriteRenderer[] mySymbol = gameObject.GetComponentsInChildren <SpriteRenderer>(); foreach (SpriteRenderer s in mySymbol) { if (s.tag == "MonsterDrawing") { if (myLine == DrawingManager.LineType.nothing) { s.enabled = false; } else { s.enabled = true; s.gameObject.transform.localScale = new Vector3(0.125f, 0.125f, 1); s.sprite = dm.possibleDrawings[(int)newLine]; } } } }