protected override IEnumerator CheckInputs() { for (; ;) { foreach (string key in keys) { if (Input.GetButtonDown(key)) { OnPressed.Invoke(); isUsed = false; isPressed = true; if (duration > 0) { StartTimer(); } } if (Input.GetButtonUp(key)) { isPressed = false; OnReleased.Invoke(); if (duration == 0) { OnUse.Invoke(); } StopTimer(); } } yield return(base.CheckInputs()); } }
public PluginCommand(string id, string text, OnUse use, OnCheckConditions checkConditions = null) { ID = id; Text = text; CheckConditions = checkConditions; Use = use; }
public void OnPointerClick(PointerEventData eventData) { if (!isEnabled) { return; } OnUse?.Invoke(type); }
public void Use() { if (WasUsedThisTurn) { throw new UpgradeWasAlreadyUsedThisTurnException(); } OnUse?.Invoke(this, new StartAttackEventArgs(Animal)); WasUsedThisTurn = true; }
public virtual void Use() { if (currentObject == null) { return; } OnUse.Invoke(currentObject.gameObject); currentObject.Use(this); }
public bool UseItem(ItemType item) { if (!inventory.TryGetValue(item, out int count) || count == 0) { return(false); } inventory[item] = count - 1; OnUse?.Invoke(this, item); return(true); }
protected override IEnumerator CheckInputs() { for (; ;) { foreach (string key in keys) { if (Input.GetButtonDown(key)) { OnUse.Invoke(); } } yield return(base.CheckInputs()); } }
private IEnumerator UseCoroutine() { float currentActiveTime = 0.0f; //check if the ability has a period, if so use the use frequency to use the ability multiple times till the period is over do { modifierHandler.ApplyPreActionModifiers(CharacterBase, CharacterBase); OnUse?.Invoke(); if (UseAnimator != null) { switch (ability.Ability) { case ScriptableMeleeAbility scriptableMeleeAbility: UseAnimator.SetBool(AnimationUseBoolName, true); break; case ScriptableProjectileAbility scriptableProjectileAbility: UseAnimator.SetBool(AnimationRangeUseBoolName, true); break; case ScriptableRaycastAbility scriptableRaycastAbility: UseAnimator.SetBool(AnimationRangeUseBoolName, true); break; default: throw new ArgumentOutOfRangeException(); } } ability.Use(); CharacterBase.LoseEnergy(ScriptableAbility.EnergyCost); modifierHandler.ApplyPostActionModifiers(CharacterBase, CharacterBase); if (ability.Ability.ActivePeriod <= 0.0f) { break; } yield return(new WaitForSeconds(ability.Ability.UseFrequency)); currentActiveTime += ability.Ability.UseFrequency; }while (currentActiveTime < ability.Ability.ActivePeriod); }
public void UnSubscribe(OnUse _onUse) { onUse -= _onUse; }
public void Subscribe(OnUse _onUse) { onUse += _onUse; }
public void Use() { OnUse?.Invoke(this, new TailLossEventArgs(Animal)); }
internal void InvokeOnUse(int slot) { OnUse?.Invoke(slot); }
public Item(ItemID item, OnUse onUse = null) { this.item = item; this.Use = onUse; }
public static void PressUse(GameObject target) { OnUse?.Invoke(target); }
private void buttonUse_Click(object sender, EventArgs e) { int TagIdx = (int)Tag; OnUse?.Invoke(TagIdx); }
public void Use(VRHand hand) { OnUse.Invoke(hand.gameObject); }
void HandleOnFinished() { isUsed = true; OnUse.Invoke(); }