IEnumerator BoostCardSelection() { SelectedBoostCard?.Invoke(BoostDeck.TopItem); if (_selectedAudio) { AudioHelper.PlayClip2D(_selectedAudio, 0.5f); } yield return(new WaitForEndOfFrame()); while (true) { if (Input.GetMouseButtonDown(0)) { RaycastHit hit = GetPointerRaycast(); IBoostable boostable = hit.collider?.GetComponent <IBoostable>(); if (boostable != null) { ITargetable boostTarget = boostable as ITargetable; TargetController.CurrentTarget = boostTarget; PlayBoostCard(); _boostRoutine = null; yield break; } else if (hit.collider?.gameObject.layer == LayerMask.NameToLayer("PlayerTarget")) { TargetController.CurrentTarget = GetComponent <ITargetable>(); PlayBoostCard(); EndedSelection?.Invoke(); _boostRoutine = null; yield break; } else { if (_clickFailAudio) { AudioHelper.PlayClip2D(_clickFailAudio, 0.5f); } } } else if (Input.GetMouseButtonDown(1)) { EndedSelection?.Invoke(); if (_droppedAudio) { AudioHelper.PlayClip2D(_droppedAudio, 0.5f); } _boostRoutine = null; yield break; } yield return(null); } }
public override void Activate(ITargetable target) { MonoBehaviour objectToBoost = target as MonoBehaviour; IBoostable boostable = objectToBoost?.GetComponent <IBoostable>(); if (objectToBoost != null) { if (_healValue < 0) { _healValue = 0; } boostable.BoostHealth(_healValue); } }