private void OnExecuteClicked() { if (!isExecuting) { executeButton.gameObject.SetActive(false); isExecuting = true; if (HazardConfiguration.IsCombinationDeadly(selectedHazards)) { Sequence tweenSequence = DOTween.Sequence(); for (int i = 0; i < availableSlots.Length; i++) { HazardComponent currentSlot = availableSlots[i]; if (currentSlot != null) { tweenSequence.Join(currentSlot.transform.DOMove(combinedPosition.position, mergeDuration)); } } tweenSequence.onComplete += OnCombinationComplete; } else { StartExecution(); } } }
private void DestroyHazard(HazardType hazardType) { for (int i = 0; i < availableSlots.Length; i++) { HazardComponent hazardComponent = availableSlots[i]; if (hazardComponent != null && hazardComponent.HazardType == hazardType) { Destroy(hazardComponent.gameObject); availableSlots[i] = null; EventManager.CallEvent(GameEvent.HazardRemoved, new HazardRemovedEventParams(hazardType)); selectedHazards &= ~hazardType; CheckButtonState(); return; } } }