//Calculate archer damage function //Tank ability public IEnumerator TankAbility() { var tankScript = tank.GetComponent <TroopScript>(); tankScript.tileScript.PlaySmokeParticles(); enemyTroopScript.tileScript.PlaySmokeParticles(); yield return(new WaitForSeconds(1f)); //Store the enemy tank and the target troop positions Vector3 TankPos = new Vector3(tank.transform.position.x, enemySelectedTroop.transform.position.y, tank.transform.position.z); Vector3 TargetPos = new Vector3(enemySelectedTroop.transform.position.x, tank.transform.position.y, enemySelectedTroop.transform.position.z); //Swap the positions of the tank and the target troop tank.transform.position = TargetPos; enemySelectedTroop.transform.position = TankPos; tankScript.ReCallStartPos(); enemyTroopScript.ReCallStartPos(); //Set tank as new target troop and get its script enemySelectedTroop = tank.gameObject; enemyTroopScript = enemySelectedTroop.GetComponent <TroopScript>(); //Calculate damage and chance phase CalculateDamage(); awaitingInput = false; //gameManager.ChangePhase(); }