// ************************************************************** // STAMINA - END // ************************************************************** public void PublishHealth() { // publish new health to hurtbox PlayerHurtBox.GetInstance().currentHealth = health; PlayerHurtBox.GetInstance().maxHealth = maxHealth; // publish health to gui eventHealth.Invoke(maxHealth, health); }
public void Switch(DropHandler other, bool notify = true) { Dragable ownDragable = GetComponentInChildren <Dragable>(); ownDragable.transform.SetParent(other.transform); ownDragable.GetComponent <RectTransform>().localPosition = Vector3.zero; Dragable otherDragable = other.GetComponentInChildren <Dragable>(); otherDragable.transform.SetParent(transform); otherDragable.GetComponent <RectTransform>().localPosition = Vector3.zero; if (notify) { OnDropEvent.Invoke(other.transform.gameObject, index); other.OnDropEvent.Invoke(ownDragable.gameObject, other.index); OnSwapEvent.Invoke(other.index, index); } }
protected virtual void Update() { // Get fingers and calculate how many are still touching the screen var fingers = Use.GetFingers(); var fingerCount = GetFingerCount(fingers); // At least one finger set? if (fingerCount > 0) { // Did this just begin? if (lastFingerCount == 0) { age = 0.0f; HighestFingerCount = fingerCount; } else if (fingerCount > HighestFingerCount) { HighestFingerCount = fingerCount; } } age += Time.unscaledDeltaTime; // Reset MultiTap = false; // Is a multi-tap still eligible? if (age <= LeanTouch.CurrentTapThreshold) { // All fingers released? if (fingerCount == 0 && lastFingerCount > 0) { MultiTapCount += 1; if (onTap != null) { onTap.Invoke(); } if (onCount != null) { onCount.Invoke(MultiTapCount); } if (onHighest != null) { onHighest.Invoke(HighestFingerCount); } if (onCountHighest != null) { onCountHighest.Invoke(MultiTapCount, HighestFingerCount); } } } // Reset else { MultiTapCount = 0; HighestFingerCount = 0; } lastFingerCount = fingerCount; }
public void Transfer() { resolveTransfer.Invoke(sliderUpdater.GetLeftValue(), sliderUpdater.GetRightValue()); gameObject.SetActive(false); }