Beispiel #1
0
        public void Pending(string pending)
        {
            Require.Instance.IsTrue(!string.IsNullOrEmpty(pending), "pending checkpoint cannot be null or empty");

            var current = new CheckpointEntry(pending);

            // No need to lock, given that this is expected to be called from a single thread,
            // and that the state is inserted at the other end of the queue.
            this.checkpointsInOrder.Enqueue(current);
            this.checkpointsSet.Add(current);
        }
Beispiel #2
0
        public static CheckpointEntry Deserialize(FZReader reader)
        {
            var entry = new CheckpointEntry();

            entry.address       = (int)reader.BaseStream.Position;
            entry.unknown1      = reader.ReadInt32();
            entry.offset        = reader.ReadInt32();
            entry.checkpoint    = reader.ReadAtOffset(entry.offset, CheckpointData.Deserialize);
            entry.unknownOffset = reader.ReadInt32();

            return(entry);
        }
            public static bool IsConvex(CheckpointEntry prev, CheckpointEntry next)
            {
                Vector2 prevLeft  = new Vector2(prev.LeftPointX, prev.LeftPointZ);
                Vector2 prevRight = new Vector2(prev.RightPointX, prev.RightPointZ);
                Vector2 nextLeft  = new Vector2(next.LeftPointX, next.LeftPointZ);
                Vector2 nextRight = new Vector2(next.RightPointX, next.RightPointZ);

                return(IsBigger180(prevLeft, nextLeft, prevRight) &&
                       IsBigger180(prevRight, prevLeft, nextRight) &&
                       IsBigger180(nextRight, prevRight, nextLeft) &&
                       IsBigger180(nextLeft, nextRight, prevLeft));
            }