Exemple #1
0
 public List <PendulumSwing> GetSuccessors()
 {
     return(new List <PendulumSwing>()
     {
         new PendulumSwing((int)WatchVariableSpecialUtilities.GetPendulumAmplitude(Amplitude, 13), 13, this, PrimaryIndex, SecondaryIndex + 1),
         new PendulumSwing((int)WatchVariableSpecialUtilities.GetPendulumAmplitude(Amplitude, 42), 42, this, PrimaryIndex, SecondaryIndex + 1),
     });
 }
Exemple #2
0
 public int GetAmplitude()
 {
     return((int)WatchVariableSpecialUtilities.GetPendulumAmplitude(
                _accelerationDirection, _accelerationMagnitude, _angularVelocity, _angle));
 }
Exemple #3
0
        public (bool success, TtcSaveState saveState, int endFrame) FindIdealPendulumManipulation(uint pendulumAddress)
        {
            int?objectIndexNullable = ObjectUtilities.GetObjectIndex(pendulumAddress);

            if (!objectIndexNullable.HasValue)
            {
                return(false, null, 0);
            }
            int objectIndex = objectIndexNullable.Value;

            TtcPendulum pendulum = _rngObjects[objectIndex] as TtcPendulum;
            int         pendulumAmplitudeStart = (int)WatchVariableSpecialUtilities.GetPendulumAmplitude(
                pendulum._accelerationDirection, pendulum._accelerationMagnitude, pendulum._angularVelocity, pendulum._angle);
            int?pendulumSwingIndexStartNullable = TableConfig.PendulumSwings.GetPendulumSwingIndex(pendulumAmplitudeStart);

            if (!pendulumSwingIndexStartNullable.HasValue)
            {
                return(false, null, 0);
            }
            int pendulumSwingIndexStart = pendulumSwingIndexStartNullable.Value;

            //iterate through frames to update objects
            int frame   = _startingFrame;
            int counter = 0;

            while (frame < _startingFrame + 300)
            {
                frame++;
                counter++;
                foreach (TtcObject rngObject in _rngObjects)
                {
                    rngObject.SetFrame(frame);
                    rngObject.Update();
                }

                int pendulumAmplitude = (int)WatchVariableSpecialUtilities.GetPendulumAmplitude(
                    pendulum._accelerationDirection, pendulum._accelerationMagnitude, pendulum._angularVelocity, pendulum._angle);
                int?pendulumSwingIndexNullable = TableConfig.PendulumSwings.GetPendulumSwingIndex(pendulumAmplitude);
                if (!pendulumSwingIndexNullable.HasValue)
                {
                    return(false, null, 0);
                }
                int pendulumSwingIndex = pendulumSwingIndexNullable.Value;

                if (pendulumSwingIndex > pendulumSwingIndexStart)
                {
                    if (pendulum._waitingTimer == 0)
                    {
                        return(true, GetSaveState(), frame);
                    }
                    else
                    {
                        return(false, null, 0);
                    }
                }
                else if (pendulumSwingIndex < pendulumSwingIndexStart)
                {
                    return(false, null, 0);
                }
            }

            return(false, null, 0);
        }