Exemple #1
0
        public PropagationResult Update(ref PropagatedProperty <T> ioState, bool inbForce = false)
        {
            PropagationResult result = UpdateSelf(ref ioState, inbForce);

            if ((result & PropagationResult.UpdateSelf) == 0)
            {
                result |= UpdateChildren(ref ioState, inbForce);
            }
            return(result);
        }
Exemple #2
0
        public PropagationResult UpdateSelf(ref PropagatedProperty <T> ioState, bool inbForce = false)
        {
            T nextSelfValue = Combine(ioState.Self, ioState.m_LastFromParent);

            if (ioState.SelfMod.HasValue)
            {
                nextSelfValue = Combine(nextSelfValue, ioState.SelfMod.Value);
            }

            if (inbForce || !m_EqualityComparer.Equals(ioState.m_SelfState, nextSelfValue))
            {
                ioState.m_SelfState = nextSelfValue;
                return(PropagationResult.UpdateSelf | UpdateChildren(ref ioState, inbForce));
            }

            return(PropagationResult.None);
        }
Exemple #3
0
        public PropagationResult UpdateChildren(ref PropagatedProperty <T> ioState, bool inbForce = false)
        {
            T nextChildrenValue = Combine(ioState.m_SelfState, ioState.Children);

            if (ioState.ChildrenMod.HasValue)
            {
                nextChildrenValue = Combine(nextChildrenValue, ioState.ChildrenMod.Value);
            }

            if (inbForce || !m_EqualityComparer.Equals(ioState.m_ChildState, nextChildrenValue))
            {
                ioState.m_ChildState = nextChildrenValue;
                return(PropagationResult.UpdateChildren);
            }

            return(PropagationResult.None);
        }
Exemple #4
0
        public void Reset(ref PropagatedProperty <T> ioState, T inFromParent)
        {
            ioState.ChildrenMod = null;
            ioState.SelfMod     = null;
            Reset(ref ioState);

            ioState.m_LastFromParent = inFromParent;

            ioState.m_SelfState = Combine(ioState.Self, inFromParent);
            if (ioState.SelfMod.HasValue)
            {
                ioState.m_SelfState = Combine(ioState.m_SelfState, inFromParent);
            }

            ioState.m_ChildState = Combine(ioState.m_SelfState, ioState.Children);
            if (ioState.ChildrenMod.HasValue)
            {
                ioState.m_ChildState = Combine(ioState.m_ChildState, ioState.ChildrenMod.Value);
            }
        }
Exemple #5
0
 protected override void Reset(ref PropagatedProperty <bool> ioState)
 {
     ioState.Self     = DefaultSelf;
     ioState.Children = DefaultChildren;
 }
Exemple #6
0
 public PropagationResult Propagate(ref PropagatedProperty <T> ioState, T inFromParent, bool inbForce = false)
 {
     ioState.m_LastFromParent = inFromParent;
     return(UpdateSelf(ref ioState, inbForce));
 }
Exemple #7
0
 public PropagationResult Propagate(ref PropagatedProperty <T> ioState, in PropagatedProperty <T> inParent, bool inbForce = false)
Exemple #8
0
 protected abstract void Reset(ref PropagatedProperty <T> ioState);