public override bool Trigger(object sender, object arg) { if (!this.CanTrigger) { return(false); } var targ = this.ResolveTargetAnimator(arg); if (targ == null) { return(false); } var anim = this.TryPlay(targ); if (anim.IsNullOrDestroyed()) { if (_triggerCompleteIfNoAnim) { this.Invoke(() => { _onAnimComplete.ActivateTrigger(this, arg); }, 0f); } return(false); } if (_onAnimComplete.Count > 0) { AnimUtil.TrySchedule(anim, (a) => { _onAnimComplete.ActivateTrigger(this, arg); }); } return(false); }
public bool Trigger(object sender, object arg, BlockingTriggerYieldInstruction instruction) { if (!_useAsBlockingYieldInstruction || instruction == null) { return(this.Trigger(sender, arg)); } if (!this.CanTrigger) { return(false); } var targ = this.ResolveTargetAnimator(arg); if (targ == null) { return(false); } var anim = this.TryPlay(targ); if (anim == null) { if (_triggerCompleteIfNoAnim) { this.Invoke(() => { _onAnimComplete.ActivateTrigger(this, arg); }, 0f); } return(false); } instruction.BeginBlock(); AnimUtil.TrySchedule(anim, (a) => { if (_daisyChainBlockingYieldInstruction) { _onAnimComplete.DaisyChainTriggerYielding(this, arg, instruction); } else { _onAnimComplete.ActivateTrigger(this, arg); } instruction.EndBlock(); }); return(false); }