public GameObject GetBarricade() { if (ServiceLocator.Get <LevelManager>().towerInstance.GetComponent <Tower>().fullHealth < baseBarricadeCost) { return(null); } if (ServiceLocator.Get <LevelManager>().isTutorial) { if (totalBarricades < 1) { ServiceLocator.Get <LevelManager>().towerInstance.GetComponent <Tower>().TakeDamage(baseBarricadeCost); GameObject barricade = Instantiate(barricadePrefab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject; totalBarricades++; TutorialManager tutorialManager = GameObject.FindGameObjectWithTag("TutorialManager").GetComponent <TutorialManager>(); tutorialManager.AddBarricade(barricade.GetComponent <Barricade>()); return(barricade); } } else { if (totalBarricades <= barricadeLimit) { ServiceLocator.Get <LevelManager>().towerInstance.GetComponent <Tower>().TakeDamage(baseBarricadeCost); GameObject barricade = Instantiate(barricadePrefab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject; totalBarricades++; return(barricade); } } return(null); }