public void 改值回调() { TriggerGroupElement <int> i = new TriggerGroupElement <int>(2); TriggerGroupElement <float> j = new TriggerGroupElement <float>(1.0f); int calledTimes = 0; TriggerGroup group = new TriggerGroup(() => { calledTimes++; }); group.AddTrigger(i); group.AddTrigger(j); group.Operate(opr => { opr.SetValue(i, 3); } ); Assert.AreEqual(calledTimes, 1); group.Operate(opr => { opr.SetValue(i, 5); opr.SetValue(j, 2f); } ); Assert.AreEqual(calledTimes, 2); group.Operate(value => { int TestResult = i.GetValue(); }); Assert.AreEqual(calledTimes, 2); }
public void PlayAnim(string animName, AnimWrapMode wrapMode) { animFlusher.Operate(opr => { opr.SetValue(targetAnim, animName); opr.SetValue(animWrapMode, wrapMode); }); }
/// <summary> /// 注册事件 /// </summary> /// <param name="eventer"></param> protected override void OnRegisteEvent(Eventer eventer) { eventer.RegisteEvent <IE_MovePos>(OnMoveToPos); eventer.RegisteEvent <IE_SpeedChange>((me) => { timeSpanCalculator.Operate(modifier => { modifier.SetValue(speed, me.targetSpeed); }); }); }