Пример #1
0
    private void OnConditionChange(VisibilityCondition.Condition condition, bool state)
    {
        int num;

        if (this.GetConditionIndex(condition, out num))
        {
            this.lastStates[num] = ((!this.conditions[num].not) ? state : (!state));
            this.UpdateState(false);
        }
    }
Пример #2
0
 private bool GetConditionIndex(VisibilityCondition.Condition condition, out int index)
 {
     index = 0;
     for (int i = 0; i < this.conditions.Length; i++)
     {
         if (this.conditions[i].condition == condition)
         {
             index = i;
             return(true);
         }
     }
     return(false);
 }
Пример #3
0
 public void SubscribeToConditionChange(ConditionChange onChange, VisibilityCondition.Condition condition)
 {
     if (condition == VisibilityCondition.Condition.None)
     {
         throw new ArgumentException(string.Format("Invalid Condition '{0}'", condition));
     }
     if (this.m_levelManager == null)
     {
         this.m_levelManager = UnityEngine.Object.FindObjectOfType <LevelManager>();
     }
     this.InitializeConditions();
     ConditionChange[] array = this.events;
     array[(int)condition] = (ConditionChange)Delegate.Combine(array[(int)condition], onChange);
     this.previousConditions[(int)condition] = this.check[(int)condition]();
     onChange(condition, this.previousConditions[(int)condition]);
 }
Пример #4
0
 public void UnsubscribeToConditionChange(ConditionChange onChange, VisibilityCondition.Condition condition)
 {
     ConditionChange[] array = this.events;
     array[(int)condition] = (ConditionChange)Delegate.Remove(array[(int)condition], onChange);
 }
Пример #5
0
 public bool GetState(VisibilityCondition.Condition condition)
 {
     return(this.check[(int)condition]());
 }