예제 #1
0
 public void                         AddMember(BoolVar member)
 {
     if (!this._members.Contains(member))
     {
         this._members.Add(member);
         member.Register(this);
     }
 }
예제 #2
0
        public void                         OnEventRaised(bool param)
        {
            if (!this._togglingGroup)
            {
                this._togglingGroup = true;
                try
                {
                    this._prevToggledOnMember = this._toggledOnMember;

                    //switch off previous
                    if (this._toggledOnMember != null)
                    {
                        if (this._toggledOnMember != this._fallbackMember || param)
                        {
                            this._toggledOnMember.Value = false;
                            this._toggledOnMember       = null;
                        }
                    }
                    if (param)
                    {
                        foreach (var member in this._members)
                        {
                            if (member.Value)
                            {
                                this._toggledOnMember = member;
                                break;
                            }
                        }
                    }
                    if (this._toggledOnMember == null && this._fallbackMember != null)
                    {
                        this._toggledOnMember       = this._fallbackMember;
                        this._toggledOnMember.Value = true;
                    }
                    base.Value = this._toggledOnMember != null;
                }
                catch (System.Exception ex)
                {
                    Debug.LogException(ex);
                }
                this._togglingGroup = false;
            }
        }
예제 #3
0
 void                                OnEnable()
 {
     this._toggledOnMember = null;
     foreach (var member in this._members)
     {
         if (member.Value)
         {
             if (this._toggledOnMember == null)
             {
                 this._toggledOnMember = member;
             }
             else
             {
                 member.Value = false;
             }
         }
         member.Register(this);
     }
     if (this._toggledOnMember == null && this._fallbackMember != null)
     {
         this._fallbackMember.Value = true;
         this._toggledOnMember      = this._fallbackMember;
     }
 }
예제 #4
0
 public void                         RemoveMember(BoolVar member)
 {
     this._members.Remove(member);
     member.Unregister(this);
 }