コード例 #1
0
        private int?LabelToOffset(ActorFrame frame)
        {
            ActorFlowControl flowControl = frame.FlowControl;
            ActorStateBranch type        = flowControl.FlowType;

            Debug.Assert(type == ActorStateBranch.Goto || type == ActorStateBranch.Loop, "Expected Goto or Loop label here only");

            int?        index;
            UpperString label = flowControl.Label.Value;

            if (type == ActorStateBranch.Goto && flowControl.Parent)
            {
                UpperString parent = flowControl.Parent.Value;
                index = GetSuperOrParent(parent, label);

                if (index == null)
                {
                    Log.Error($"Unable to find label: {parent}::{label}");
                    return(null);
                }
            }
            else
            {
                index = Labels[label];
                if (index == null)
                {
                    Log.Error($"Unable to find label: {label}");
                    return(null);
                }
            }

            // The offset to the label is the delta from our current position,
            // plus any extra offset that the flow control will have provided.
            return(index.Value - frame.FrameIndex + flowControl.Offset);
        }
コード例 #2
0
ファイル: ActorFrame.cs プロジェクト: WChrisK/HelionUnity
 public ActorFrame(ActorFrame other)
 {
     FrameIndex      = other.FrameIndex;
     Sprite          = other.Sprite;
     Ticks           = other.Ticks;
     Properties      = new ActorFrameProperties(other.Properties);
     ActionFunction  = other.ActionFunction.Map(af => new ActorActionFunction(af));
     FlowControl     = new ActorFlowControl(other.FlowControl);
     NextStateOffset = other.NextStateOffset;
 }
コード例 #3
0
        public ActorStates(ActorDefinition owner, ActorStates other, UpperString parentName) :
            this(owner)
        {
            foreach (ActorFrame frame in other.Frames)
            {
                ActorFrame newFrame = new ActorFrame(frame);
                Frames.Add(newFrame);
            }

            Labels = new ActorStateLabels(other.Labels, parentName);

            // Note: We are not copying flow overrides because they should be
            // specific to their object definition.
        }