public void Show(BuildPlace buildPlace, List <ConstructData> constructDataList) { if (InputMouse.longTapAbleSelected == buildPlace) { return; } // if (InputMouse.longTapAbleSelected != null) // InputMouse.ClearSelection(); // InputMouse.longTapAbleSelected = buildPlace; _buildPlace = buildPlace; gameObject.SetActive(true); Vector3 newPos = (Vector2)buildPlace.transform.position; newPos.z -= 1; _transform.position = newPos; _transform.localScale = Vector3.zero; float scaleTime = 0.1f; LeanTween.scale(gameObject, Vector3.one, scaleTime); for (int i = 0; i < constructDataList.Count; i++) { ConstructionWheelSlot slot = GameObject.Instantiate(SlotPrefab, transform).GetComponent <ConstructionWheelSlot>(); slot.Init(constructDataList[i]); slot.Button.onClick.AddListener(() => Build(slot)); SlotsList.Add(slot); } LeanTween.delayedCall(scaleTime, ActivateSlots); }
void Build(ConstructionWheelSlot slot) { Hide(); GameObject go = Instantiate(slot.BuildingPrefab); go.transform.position = _buildPlace.transform.position; Destroy(_buildPlace.gameObject); }