void Start() { //EnclosurePannel = GameObject.FindWithTag("EnclosurePannel"); EnclosureList = new List <EnclosureScript>(); EnclosurePannel = enclosurePanel; int i = 0; if (EnclosurePannel.activeInHierarchy) { EnclosurePannel.SetActive(false); } _gameManager = GameManager.instance; HousePosition = House.transform.position; foreach (var enclosurePosition in EnclosurePositionList) { EnclosureScript enclosure; float distance = Vector3.Distance(House.transform.position, enclosurePosition); if (distance < 70) { enclosure = Instantiate(EnclosPrefabList[0]); enclosure.transform.position = enclosurePosition; } else if (distance < 120) { enclosure = Instantiate(EnclosPrefabList[1]); enclosure.transform.position = enclosurePosition; enclosure.GoldReward = GameVariables.EnclosureGold.medium; } else { enclosure = Instantiate(EnclosPrefabList[2]); enclosure.transform.position = enclosurePosition; enclosure.GoldReward = GameVariables.EnclosureGold.far; } EnclosureList.Add(enclosure); } EnclosureList = EnclosureList.OrderBy(o => o.Distance).ToList(); foreach (var enclosure in EnclosureList) { enclosure.Order = i; i++; } MiniMap = MiniMapObject.GetComponent <MiniMap>();// FindObjectOfType<MiniMap>(); MiniMap.InstantiateText(); }