コード例 #1
0
ファイル: InteractScript.cs プロジェクト: VFlyer/EmikModules
    private void CreateStartingSphere()
    {
        do
        {
            _breakCount    = 0;
            _inputs        = new List <Axis>();
            startingSphere = new Dictionary <Axis, bool>();
            _axesUsed      = new Dictionary <Axis, int>();

            for (int i = 0; i < Dimension; i++)
            {
                startingSphere.Add(allAxies.ElementAt(i),
                                   !Application.isEditor || _octadecayotton.ForceStartingSphere.IsNullOrEmpty()
                    ? Rnd.Range(0, 1f) > 0.5f
                    : _octadecayotton.ForceStartingSphere.Where(c => c == '-' || c == '+').ElementAtOrDefault(i) == '+');
                _axesUsed.Add(allAxies.ElementAt(i), 0);
            }
        } while (startingSphere.Select((a, n) => a.Value != AnchorSphere.ElementAt(n).Value).All(b => !b));

        _order = allAxies.Take(Dimension).ToArray().Shuffle().ToArray();
        Debug.LogFormat("[The Octadecayotton #{0}]: The axes (from 0 to {1}) for the last digits of the timer is {2}.",
                        _moduleId,
                        Dimension - 1,
                        _order.Join(""));
        Debug.LogFormat("[The Octadecayotton #{0}]: The starting sphere is in {1}. ({2}-ordered)",
                        _moduleId,
                        startingSphere.Select(a => a.Value ? "+" : "-").Join(""),
                        _allAxes.Substring(0, Dimension));
        _octadecayotton.souvenirRotations = Rotations.ToLog();
        _octadecayotton.souvenirSphere    = startingSphere.ToLog();
    }
コード例 #2
0
ファイル: InteractScript.cs プロジェクト: VFlyer/EmikModules
    internal KMSelectable.OnInteractHandler Init(TheOctadecayottonScript octadecayotton, bool checkForTP, int dimension)
    {
        return(() =>
        {
            if (isStarting || isActive || octadecayotton.IsSolved || (checkForTP && octadecayotton.TwitchPlaysActive))
            {
                return true;
            }

            isStarting = true;
            rotationProgress = 0;

            _octadecayotton = octadecayotton;
            _animate = new Animate(this, _octadecayotton);
            _moduleId = octadecayotton.moduleId;
            isUsingBounce = octadecayotton.isUsingBounce;

            if (octadecayotton.DimensionOverride != default(byte))
            {
                octadecayotton.dimensionOverride = octadecayotton.DimensionOverride;
            }

            if (Dimension == 0)
            {
                TheOctadecayottonScript.Activated++;
            }

            Dimension = _octadecayotton.dimensionOverride == 0 ? dimension + TheOctadecayottonScript.Activated : octadecayotton.dimensionOverride;

            StartCoroutine(_animate.CreateHypercube(Dimension));

            octadecayotton.PlaySound(Dimension > 9 ? Sounds.Oct.StartupHard : Sounds.Oct.Startup);
            octadecayotton.ModuleSelectable.AddInteractionPunch(Dimension > 9 ? 64 : 32);

            Rotations = !Application.isEditor || octadecayotton.ForceRotation.IsNullOrEmpty()
                      ? TheOctadecayottonExtensions.GetRandomRotations(new RotationOptions(dimension: Dimension, rotationCount: octadecayotton.RotationOverride != default(byte) ? octadecayotton.RotationOverride : octadecayotton.rotation))
                      : octadecayotton.ForceRotation.ToRotations();

            Debug.LogFormat("[The Octadecayotton #{0}]: Initializing with {1} dimensions and {2} rotation{3}.",
                            _moduleId,
                            Dimension,
                            octadecayotton.rotation,
                            octadecayotton.rotation == 1 ? "" : "s");
            Debug.LogFormat("[The Octadecayotton #{0}]: NOTE: Rotations are cyclic, meaning that +X-Y+Z is the same as -Y+Z+X and +Z+X-Y! Commas (,) separate different subrotations, and ampersands (&) separate different rotations.", _moduleId);
            Debug.LogFormat("[The Octadecayotton #{0}]: The rotation{1} {2}.",
                            _moduleId,
                            octadecayotton.rotation == 1 ? " is" : "s are",
                            Rotations.ToLog());

            AnchorSphere = Rotations.Get(Dimension, _moduleId);
            Debug.LogFormat("[The Octadecayotton #{0}]: The anchor sphere is in {1}. ({2}-ordered)",
                            _moduleId,
                            AnchorSphere.Select(a => a.Value ? "+" : "-").Join(""),
                            _allAxes.Substring(0, Dimension));

            CreateStartingSphere();
            Debug.LogFormat("[The Octadecayotton #{0}]: To solve this module, press anywhere to enter submission, submit the digits from left-to-right when the {1} matches the digit shown, then submit on every digit from {2} down to 0.",
                            _moduleId,
                            Dimension > 10 ? "timer modulo 20" : "last digit of the timer",
                            Dimension - 1);
            Debug.LogFormat("[The Octadecayotton #{0}]: Example full solution (not knowing axes) => {1}.",
                            _moduleId,
                            startingSphere.GetAnswer(AnchorSphere, _axesUsed, _order, true).Select(i => i.Join(Dimension > 9 ? " " : "")).Join(", "));
            Debug.LogFormat("[The Octadecayotton #{0}]: Quickest solution (knowing axes) => {1}.",
                            _moduleId,
                            startingSphere.GetAnswer(AnchorSphere, _axesUsed, _order, false).Select(i => i.Join(Dimension > 9 ? " " : "")).Join(", "));

            return true;
        });
    }