Esempio n. 1
0
    public static void Test()
    {
        Listener listener = new Listener();
        ViSimpleProvider <ViVector3> provider0 = new ViSimpleProvider <ViVector3>();
        ViSimpleProvider <ViVector3> provider1 = new ViSimpleProvider <ViVector3>();

        provider0.SetValue(new ViVector3(0, 0, 0));
        provider0.SetValue(new ViVector3(0, 0, 0));
        ViDistNotifier distanceNotifier = new ViDistNotifier();

        distanceNotifier.SetRange(10.0f);
        distanceNotifier.SetTarget(provider0, provider1);
        distanceNotifier.AttachUpdate(listener.OnIn, listener.OnOut);
        ViDistNotifier.UpdateList();
        provider1.SetValue(new ViVector3(11, 0, 0));
        ViDistNotifier.UpdateList();
        provider1.SetValue(new ViVector3(9, 0, 0));
        ViDistNotifier.UpdateList();
    }
Esempio n. 2
0
 public static void UpdateList()
 {
     _listInner.BeginIterator();
     while (!_listInner.IsEnd())
     {
         ViRefNode2 <ViDistNotifier> iter = _listInner.CurrentNode;
         _listInner.Next();
         ViDistNotifier notifier = iter.Data;
         ViDebuger.AssertError(notifier);
         notifier._UpdateInside();
     }
     _listOutor.BeginIterator();
     while (!_listOutor.IsEnd())
     {
         ViRefNode2 <ViDistNotifier> iter = _listOutor.CurrentNode;
         _listOutor.Next();
         ViDistNotifier _this = iter.Data;
         ViDebuger.AssertError(_this);
         _this._UpdateOutside();
     }
     _listInner.PushBack(_listWaitingInner);
     _listOutor.PushBack(_listWaitingOutor);
 }