public void MyAttack() { if (!c_setupAttack && !c_attacked) { c_setupAttack = true; c_squaresInAttackRange.Clear(); c_squaresInAttackRange = GridTest.CheckRange(transform.position, c_playerHealthScript.c_playerStats.playerAttackRange, "MoveCube"); if (c_squaresInAttackRange.Count != 0) { foreach (GameObject tile in c_squaresInAttackRange) { Debug.Log("Attempting to get character on tile..."); if (tile.GetComponent <AddGridToRange> ().GetEnemyOnTile(c_enemyDamageTag) != null) { c_enemiesInAttackRange.Add(tile.GetComponent <AddGridToRange> ().GetEnemyOnTile(c_enemyDamageTag)); //Debug.Log ("Added to tile"); } } } if (c_enemiesInAttackRange.Count != 0) { c_UI.UpdateBattleDialogue("Please select a target."); //foreach (GameObject enemy in c_enemiesInAttackRange) //Debug.Log (enemy.name); c_UI.DynamicHide(false); StartCoroutine(SearchForTile(c_squaresInAttackRange)); } else { c_UI.UpdateBattleDialogue("There are no targets in range."); c_setupAttack = false; foreach (GameObject tile in c_squaresInAttackRange) { tile.GetComponent <Renderer> ().material.SetColor("_Color", Color.red); } Invoke("DelayClearingSetupTiles", 1.5f); } } else if (c_enemy != null && !c_attacked) { c_playerHealthScript.CancelDefend(); c_myTurnObject.c_delayValue += (int)(c_personalDelay * c_currentSkill.UseSkill(c_enemy.transform.position, c_playerHealthScript, c_enemyDamageTag)); c_attacked = true; Debug.Log("" + gameObject.name + " attacked"); c_setupAttack = false; ClearTileColourInGrid(c_squaresInAttackRange); if (c_currentlyMoving == "Finished Moving") { EndTurn(); } else { c_UI.DynamicHide(true); } } else if (c_attacked) { c_UI.UpdateBattleDialogue("You have already attacked/defended. Please move or end your turn."); } else if (c_enemy == null) { c_UI.UpdateBattleDialogue("Please select a new target."); } }