Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public void PlayAnim(string animName, AnimWrapMode wrapMode)
 {
     animFlusher.Operate(opr =>
     {
         opr.SetValue(targetAnim, animName);
         opr.SetValue(animWrapMode, wrapMode);
     });
 }
Ejemplo n.º 3
0
 /// <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);
         });
     });
 }