/// <summary>
 /// 移除观察者
 /// </summary>
 /// <param name="observer"></param>
 public void RemoveObserver(IMyObserver observer)
 {
     if (_observers.Contains(observer))
     {
         _observers.Remove(observer);
     }
 }
 public BaseCharacter(uint health, uint damage, IMyObserver observer)
 {
     _health   = health;
     _maxHelth = health;
     _damage   = damage;
     _observer = observer;
 }
Exemple #3
0
 //Also clients use this to unsubscribe themselves to no longer receive the messages.
 public Task UnSubscribe(IMyObserver observer)
 {
     if (_subsManager.IsSubscribed(observer))
     {
         _subsManager.Unsubscribe(observer);
     }
     return(Task.CompletedTask);
 }
Exemple #4
0
 public Elf(IMyObserver observer) : base(200, 9, observer)
 {
 }
 /// <summary>
 /// 注册观察者
 /// </summary>
 /// <param name="observer"></param>
 public void RegisterObserver(IMyObserver observer)
 {
     _observers.Add(observer);
 }
 public void RemoveObserver(IMyObserver observer)
 {
     _observers.Remove(observer);
 }
 public void RegisterObserver(IMyObserver observer)
 {
     _observers.Add(observer);
 }
 public void RemoveObserver(IMyObserver observer)
 {
     _observers.Remove(observer);
 }
Exemple #9
0
 public void RegisterObserver(IMyObserver o)
 {
     observers.Add(o);
 }
Exemple #10
0
 public void Detach(IMyObserver observer) => Observers.Remove(observer);
Exemple #11
0
 public void Attach(IMyObserver observer) => Observers.Add(observer);
 public void UnregisterObserver(IMyObserver i_DelObserver)
 {
     myObservers.Remove(i_DelObserver);
 }
 public void RegisterObserver(IMyObserver i_NewObserver)
 {
     myObservers.Add(i_NewObserver);
 }
 public Orc(IMyObserver observer) : base(120, 10, observer)
 {
 }
 public Human(IMyObserver observer) : base(100, 8, observer)
 {
 }
Exemple #16
0
 protected Warrior(uint health, uint damage, IMyObserver observer) : base(health, damage, observer)
 {
 }
Exemple #17
0
        public void RemoveObserver(IMyObserver o)
        {
            var index = Observers.IndexOf(Observers.Where(x => (x as TeamDTO).Id == (o as TeamDTO).Id).FirstOrDefault());

            Observers.RemoveAt(index);
        }
Exemple #18
0
 public void RemoveObserver(IMyObserver o)
 {
     observers.Remove(o);
 }