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); }
// [SerializeField] Sprite sprite; void OnMouseUp() { if (selected == this) { return; } if (selected == null && gameObject.name == "Grass") { return; } Debug.Log($"# Selection # {gameObject.name} clicked"); ClearSelection(); Tower tower = GetComponent <Tower>(); if (tower != null) { TowerClickedEvent?.Invoke(tower); selected = this; return; } BuildPlace buildPlace = GetComponent <BuildPlace>(); if (buildPlace != null) { BuildPlaceClickedEvent?.Invoke(this, buildPlace.ConstructDataList); selected = this; return; } Wizard wizard = GetComponent <Wizard>(); if (wizard != null) { WizardClickedEvent?.Invoke(wizard); selected = this; return; } }