示例#1
0
            public TumblerFindingStage(string label, Toolkit toolkit, Tumbler tgtTumbler, AngleAxisProvider provider) : base(label)
            {
                Kit           = toolkit;
                targetTumbler = tgtTumbler;

                AttitudeProvider = provider;
                SetUpProvider(AttitudeProvider, allowProviderToPersist: true);

                LastAngle = Angle = AttitudeProvider.Angle;
                Log.Debug("TumblerStage|Ctor", $"Initial angle: {Angle}");
                TargetAngle       = tgtTumbler.Angle;
                RequiredDirection = tgtTumbler.Direction;
                // Certain special tumblers - like ResetToZero - have a designated direction of zero, meaning "opposite to current setting."
                if (tgtTumbler.Direction == 0)
                {
                    RequiredDirection = -1 * Math.Sign(provider.Angle);
                }

                // CurrentDirection is based on AngleTrend.
                AngleTrend = new RollingAverage <double>(5);

                InterimInterval = TimeSpan.FromMilliseconds(20);

                Activate();
            }
示例#2
0
 public LockTumblerLiftingStage(string label, Toolkit toolkit, Tumbler tgtTumbler, AngleAxisProvider oProvider = null)
     : base(label, toolkit, Tumbler.PinMoveTarget, oProvider)
 {
     Log.Debug("Lockpicking|TumblerLifting", $"Lifting {label}");
     AngleRateOfChange = new RollingAverage <float>(5, 0f);
     tumblerUnderway   = tgtTumbler;
 }
示例#3
0
 public void AddTumbler(Tumbler newTumbler)
 {
     if (Tumblers.Count > 0)
     {
         Tumblers.Last().NextTumbler = newTumbler;
     }
     Tumblers.Add(newTumbler);
 }
示例#4
0
 public VaultTumblerFindingStage(string label, Toolkit toolkit, Tumbler tgtTumbler, AngleAxisProvider oProvider)
     : base(label, toolkit, tgtTumbler, oProvider)
 {
     DegreesBetweenClicks = Current.LockBeingOpened.DegreesBetweenClicks;
     TotalClicks          = (int)(360 / DegreesBetweenClicks);
     LastClicks           = CurrentClicks = Clicks(oProvider.Angle);
     TargetClicks         = Clicks(tgtTumbler.Angle);
     Log.Debug("Safecracking|TumblerFinding", $"Starting to search for {label}");
 }
示例#5
0
        //public double SteadinessScoreWhenDefined { get; set; }
        //public double OrientationSigma { get; set; }
        //public double MaxRotationRate { get; set; } // Only relevant for key locks, not safes

        //public Tumbler(Quaternion orientation, double maxRotationRate, double steadinessBase, double orientationSigma)
        public Tumbler(double angle, int?direction = null)
        {
            //Orientation = orientation;
            Angle     = angle;
            Direction = Math.Sign(direction ?? angle);
            //MaxRotationRate = maxRotationRate;
            //SteadinessScoreWhenDefined = steadinessBase;
            //OrientationSigma = orientationSigma;
            NextTumbler = EndOfLock;
        }
示例#6
0
        public static Lock FromString(string inputStr)
        {
            var subStrings = inputStr.Split(';');

            Lock resultLock = new Lock(subStrings[0],
                                       (LType)Enum.Parse(typeof(LType), subStrings[1], true),
                                       new Quaternion().Parse(subStrings[3]),
                                       subStrings[4],
                                       subStrings[5]);

            var TumblerStrings = subStrings[2].Split(':');

            foreach (var TumblerStr in TumblerStrings)
            {
                resultLock.AddTumbler(Tumbler.FromString(TumblerStr));
            }
            return(resultLock);
        }
示例#7
0
 public LockTumblerFindingStage(string label, Toolkit toolkit, Tumbler tgtTumbler, AngleAxisProvider oProvider = null)
     : base(label, toolkit, tgtTumbler, oProvider)
 {
     Log.Debug("Lockpicking|TumblerFinding", $"Starting to search for {label}");
 }