示例#1
0
    public void SetupBoard(int boardSize)
    {
        Collider[] temporaryInstances = { Instantiate(DarkSquare.GetComponent <Collider>()), Instantiate(DarkSquare.GetComponent <Collider>()) };
        Bounds[]   squareBounds       = { temporaryInstances[0].bounds, temporaryInstances[1].bounds };
        Vector3    extentDiff         = squareBounds[0].size - squareBounds[1].size;

        if (Mathf.Abs(extentDiff.x) > Mathf.Epsilon || Mathf.Abs(extentDiff.z) > Mathf.Epsilon)
        {
            throw new System.Exception("Given board squares colliders differ too much in size.");
        }
        Vector2 squareSize = new Vector3(Mathf.Min(squareBounds[0].size.x, squareBounds[1].size.x),
                                         Mathf.Min(squareBounds[0].size.z, squareBounds[1].size.z));

        float[] squareHeightOffset = { -squareBounds[0].min.y, -squareBounds[1].min.y };

        Debug.Log($"Square size: {squareSize}, from min({squareBounds[0].size.x}, {squareBounds[1].size.x})");
        Debug.Log($"Dark collider: {squareBounds[0]}");


        Fields = new StoneStackHandle[boardSize, boardSize];
        for (int y = 0; y < boardSize; ++y)
        {
            for (int x = 0; x < boardSize; ++x)
            {
                int          squareId  = (x + y) % 2;
                MeshRenderer newSquare = Instantiate(squareId > 0 ? DarkSquare : LightSquare);
                newSquare.transform.parent        = this.transform;
                newSquare.transform.localPosition = new Vector3(squareSize.x * (-0.5f * boardSize + x + 0.5f),
                                                                squareHeightOffset[squareId],
                                                                squareSize.y * (-0.5f * boardSize + y + 0.5f));
                Fields[x, y] = newSquare.GetComponentInChildren <StoneStackHandle>();
            }
        }
    }
示例#2
0
    /// <summary>
    /// Sets a model for the class
    /// In addition to the army movement order itself it needs to know where does the movement arrow start and end
    /// </summary>
    /// <param name="order">Army movement order</param>
    /// <param name="start">Start point of the movement arrow</param>
    /// <param name="end">End point of the movement arrow</param>
    public void SetModel(ArmyMovementOrder order, Vector3 start, Vector3 end)
    {
        // set the model proper
        _model          = order;
        _model.Updated += OnModelUpdated;

        // place the head of the movement arrow
        _arrowheadImage.transform.position = new Vector3((1 + _arrowHeadShift) * end.x - _arrowHeadShift * start.x,
                                                         (1 + _arrowHeadShift) * end.y - _arrowHeadShift * start.y,
                                                         end.z);
        _arrowheadImage.transform.rotation = Quaternion.FromToRotation(Vector3.down, end - start);

        // select army image and update the number of units field
        Update();

        // place the army image on the screen
        _armyImage.transform.position = new Vector3(0.5f * (start.x + end.x) - 1f, 0.5f * (start.y + end.y) + 1f, 0.5f * (start.z + end.z));

        // the player can edit an army movement order by clicking on the army image
        _armyImage.GetComponentInChildren <MouseClickListener>().MouseClickDetected += OnArmyImageClicked;

        // place the number of units info on the screen
        _quantityField.transform.position = new Vector3(0.5f * (start.x + end.x) - 1f, 0.5f * (start.y + end.y) + 3.5f, 0.5f * (start.z + end.z));

        // set line renderer parameters (for the movement arrow)
        //_lineRenderer.SetWidth(_startWidth, _endWidth);
        _lineRenderer.startWidth = _startWidth;
        _lineRenderer.endWidth   = _endWidth;
        //_lineRenderer.SetVertexCount(2);
        _lineRenderer.positionCount = 2;
        _lineRenderer.SetPosition(0, start);
        _lineRenderer.SetPosition(1, end);
    }
示例#3
0

        
示例#4
0
    void doStageChange()
    {
        var stringX = "Used are F ";

        for (int i = 0; i < 6; i++)
        {
            stringX = stringX + fizzPositions[i] + " ";
        }
        stringX = stringX + "B ";
        for (int i = 0; i < 4; i++)
        {
            stringX = stringX + buzzPositions[i] + " ";
        }
        //Debug.Log(stringX);
        curStage++;
        if (curStage > startNumber)
        {
            timeLeft = stageTiming;
        }
        //Debug.Log("CurStage is " + curStage + " and StartStage is " + startNumber + ".");
        doClear();
        fizzNumber = UnityEngine.Random.Range(0, 19);
        buzzNumber = (UnityEngine.Random.Range(1, 19) + fizzNumber) % 19;
        fizzDisplay.GetComponentInChildren <TextMesh>().text = theModules[fizzNumber];
        buzzDisplay.GetComponentInChildren <TextMesh>().text = theModules[buzzNumber];
    }
    void GenerateSolution()
    {
        //Visual Setup
        PenColorIndex            = Random.Range(0, Colors.Length);
        PenRender.material.color = Colors[PenColorIndex];

        MessageColorIndex = Random.Range(0, Colors.Length);
        NotepadRender.GetComponentInChildren <TextMesh>().color = Colors[MessageColorIndex];

        MessageTextIndex = Random.Range(0, MessageText.Length);
        NotepadRender.GetComponentInChildren <TextMesh>().text = MessageText[MessageTextIndex];

        //Visual Setup Logging
        Debug.LogFormat("[The Exploding Pen #{0}] The pen color is {1}.", moduleId, ColorsNames[PenColorIndex]);
        Debug.LogFormat("[The Exploding Pen #{0}] The ink color is {1}.", moduleId, ColorsNames[MessageColorIndex]);
        Debug.LogFormat("[The Exploding Pen #{0}] The person who left you the voice message was {1}.", moduleId, MessageText[MessageTextIndex]);

        //Submit Time Setup
        if (MessageText[MessageTextIndex] == "Danielstigman")
        {
            AllowedTime = DanielstigmanTable[PenColorIndex, MessageColorIndex];
            //Debug.LogFormat("[The Exploding Pen #{0}] DEBUG: Danielstigman AllowedTime XX:" + AllowedTime + " .", moduleId); //Debug Code.
        }

        if (MessageText[MessageTextIndex] == "DJHero2903")
        {
            AllowedTime = DJHero2903Table[PenColorIndex, MessageColorIndex];
            //Debug.LogFormat("[The Exploding Pen #{0}] DEBUG: DJHero2903 AllowedTime XX:" + AllowedTime + " .", moduleId); //Debug Code.
        }

        if (MessageText[MessageTextIndex] == "OEGamer")
        {
            AllowedTime = OEGamerTable[PenColorIndex, MessageColorIndex];
            //Debug.LogFormat("[The Exploding Pen #{0}] DEBUG: OEGamer AllowedTime XX:" + AllowedTime + " .", moduleId); //Debug Code.
        }

        if (MessageText[MessageTextIndex] == "Riddick")
        {
            AllowedTime = RiddickTable[PenColorIndex, MessageColorIndex];
            //Debug.LogFormat("[The Exploding Pen #{0}] DEBUG: Riddick AllowedTime XX:" + AllowedTime + " .", moduleId); //Debug Code.
        }

        if (MessageText[MessageTextIndex] == "Tathra")
        {
            AllowedTime = TathraTable[PenColorIndex, MessageColorIndex];
            //Debug.LogFormat("[The Exploding Pen #{0}] DEBUG: Tathra AllowedTime XX:" + AllowedTime + " .", moduleId); //Debug Code.
        }

        if (MessageText[MessageTextIndex] == "Trigger")
        {
            AllowedTime = TriggerTable[PenColorIndex, MessageColorIndex];
            //Debug.LogFormat("[The Exploding Pen #{0}] DEBUG: Trigger AllowedTime XX:" + AllowedTime + " .", moduleId); //Debug Code.
        }

        ColorblindOn();
        Waiting = false;
    }
示例#6
0
            static void Postfix(TVBenchUnitViewer __instance, GameObject ___placeHolder, ref TVCtr ___tVCtr)
            {
                if (!enabled || __instance.GetComponentInParent <PhotoFrameCtr>() == null)
                {
                    return;
                }
                Dbgl($"Fresh Items");
                ItemObject item     = ItemObject.CreateItem(4030001);
                GameObject tvObject = GameUtils.AddChild(___placeHolder, item.ItemBase.DropModelPath, false, AssetType.ItemSystem);

                MeshRenderer[] tvms = tvObject.GetComponentsInChildren <MeshRenderer>();

                for (int i = 0; i < tvms.Length; i++)
                {
                    MeshRenderer m = tvms[i];
                    m.gameObject.SetActive(false);
                }

                ___tVCtr = tvObject.GetComponentInChildren <TVCtr>(true);
                AudioSource audioSource = typeof(TVCtr).GetField("audioSource", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(___tVCtr) as AudioSource;

                audioSource.spatialBlend = settings.Spatiality;
                audioSource.volume       = 1f;
                typeof(TVCtr).GetField("audioSource", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(___tVCtr, audioSource);
                //VideoPlayer videoPlayer = typeof(TVCtr).GetField("videoPlayer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(___tVCtr) as VideoPlayer;
                //typeof(TVCtr).GetField("videoPlayer", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(___tVCtr, videoPlayer);
                GameObject newObj = Singleton <ResMgr> .Instance.LoadSyncByType <GameObject>(AssetType.Home, "HomeItem_ADBoard");

                GameObject screen = typeof(TVCtr).GetField("screen", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(___tVCtr) as GameObject;

                MeshRenderer[] bbms = newObj.GetComponentsInChildren <MeshRenderer>();

                foreach (MeshRenderer m in bbms)
                {
                    //Dbgl($"mesh: {m.name}");
                    if (m.name == "Item_Billboard_2")
                    {
                        screen.GetComponentInChildren <MeshFilter>().mesh        = m.GetComponentInChildren <MeshFilter>().mesh;
                        screen.GetComponentInChildren <MeshRenderer>().materials = m.materials;
                        //screen.GetComponentInChildren<Transform>().position = m.gameObject.GetComponentInChildren<Transform>().position;
                        break;
                    }
                }

                /*
                 * Component[] components = screen.GetComponents(typeof(Component));
                 * foreach (Component component in components)
                 * {
                 *  Dbgl($"component: {component.ToString()}");
                 * }
                 */
                //Vector3 scale = screen.GetComponentInChildren<MeshFilter>().transform.localScale;
                //screen.GetComponentInChildren<MeshFilter>().transform.localScale = new Vector3(scale.x, 1.6f, scale.z);
                //Dbgl($"local scale: {screen.transform.localScale}");
                //screen.GetComponentInChildren<VideoPlayer>().aspectRatio = VideoAspectRatio.NoScaling;
                Vector3 pos = screen.GetComponentInChildren <MeshFilter>().transform.position;

                screen.transform.position = new Vector3(pos.x, pos.y - 0.84f, pos.z) - screen.GetComponentInChildren <MeshFilter>().transform.forward * 0.02f;
            }
示例#7
0

        
示例#8
0
            static bool Prefix(TVBenchUnitViewer __instance, ActionType obj)
            {
                if (!enabled || obj != ActionType.ActionRoll)
                {
                    return(true);
                }
                Dbgl($"Handler");

                GameObject tv     = __instance.gameObject;
                TVCtr      tvc    = tv.GetComponentInChildren <TVCtr>(true);
                GameObject screen = typeof(TVCtr).GetField("screen", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tvc) as GameObject;

                GameObject newObj;

                if (screen.name == "BigScreen")
                {
                    newObj = Singleton <ResMgr> .Instance.LoadSyncByType <GameObject>(AssetType.Home, "HomeItemTV");
                }
                else
                {
                    newObj = Singleton <ResMgr> .Instance.LoadSyncByType <GameObject>(AssetType.Home, "HomeItem_ADBoard");
                }

                MeshRenderer[] newMs = newObj.GetComponentsInChildren <MeshRenderer>();
                MeshRenderer[] tvms  = tv.GetComponentsInChildren <MeshRenderer>();

                Dictionary <string, MeshRenderer> objDic = new Dictionary <string, MeshRenderer>();

                foreach (MeshRenderer m in newMs)
                {
                    //Dbgl($"mesh: {m.name}");
                    objDic.Add(m.name, m);
                }

                for (int i = 0; i < tvms.Length; i++)
                {
                    MeshRenderer m = tvms[i];
                    //Dbgl($"mesh: {m.name}");
                    m.GetComponentInChildren <MeshFilter>().mesh = newMs[i].GetComponentInChildren <MeshFilter>().mesh;
                    m.materials = newMs[i].materials;
                    m.bounds.SetMinMax(newMs[i].bounds.min, newMs[i].bounds.max);
                }


                if (screen.name == "BigScreen")
                {
                    screen.GetComponentInChildren <MeshFilter>().mesh = objDic["Item_TV_b"].GetComponentInChildren <MeshFilter>().mesh;
                    screen.name = "Screen";
                }
                else
                {
                    screen.GetComponentInChildren <MeshFilter>().mesh = objDic["Item_Billboard_2"].GetComponentInChildren <MeshFilter>().mesh;
                    screen.name = "BigScreen";
                }
                return(false);
            }
示例#9
0
    void doUp()
    {
        if (canSolve)
        {
            curAnswer++;
            if (curAnswer > 35)
            {
                curAnswer -= 36;
            }
            inputDisplay.GetComponentInChildren <TextMesh>().text = theValues[curAnswer];
        }
        else if (justAfterStrike)
        {
            doRotate = false;
            curRotation++;
            if (curRotation > numSolvables)
            {
                curRotation = curRotation - numSolvables;
            }
            LED.material.color = colory[stageColors[curRotation - 1]];
            theLight.color     = colory[stageColors[curRotation - 1]];
            if (colorblindModeEnabled)
            {
                cbmColor.GetComponentInChildren <TextMesh>().text = lightColors[stageColors[curRotation - 1]].Substring(0, 1);
            }
            if (curRotation < 10)
            {
                stageDisplay[0].GetComponentInChildren <TextMesh>().text = "00" + curRotation;
            }
            else if (curRotation < 100)
            {
                stageDisplay[0].GetComponentInChildren <TextMesh>().text = "0" + curRotation;
            }
            else
            {
                stageDisplay[0].GetComponentInChildren <TextMesh>().text = "" + curRotation;
            }


            stageDisplay[4].GetComponentInChildren <TextMesh>().text = " " + theValues[stageNumbers[curRotation - 1]] + " ";
        }
    }
    void Init()
    {
        delegationZone();
        //Module.OnActivate += delegate { inputResult.GetComponentInChildren<TextMesh>().text = ""; };

        button.transform.localPosition = new Vector3(button.transform.localPosition.x, button.transform.localPosition.y, 2f);
        rLevel        = 0.8f;
        gLevel        = 0.8f;
        bLevel        = 1.0f;
        rUp           = true;
        gUp           = false;
        bUp           = false;
        altColorFalls = false;
        foundGreen    = false;
        shownDigit    = UnityEngine.Random.Range(1, 9);
        labelNumber   = UnityEngine.Random.Range(0, words.Length);
        rotations     = UnityEngine.Random.Range(0, 8);
        colorNumber   = UnityEngine.Random.Range(0, 9);
        //colorNumber = 6; //debug

        buttonColorZone.material.color = colory[colorNumber];
        if (colorNumber == 0 || colorNumber == 2 || colorNumber == 3 || colorNumber == 5)
        {
            dispDigit.GetComponentInChildren <TextMesh>().color = colory[8];
            dispLabel.GetComponentInChildren <TextMesh>().color = colory[8];
        }
        fullButton.transform.Rotate(Vector3.forward, 45 * rotations);
        //Debug.Log(actions[1, 1] + " then " + actions[0, 2]);
        dispDigit.GetComponentInChildren <TextMesh>().text = shownDigit.ToString();
        dispLabel.GetComponentInChildren <TextMesh>().text = words[labelNumber];

        Debug.LogFormat("[The Triangle Button #{0}] The button is pointing {1} and is colored {2}. Its label is '{3}' and the digit is {4}.", _moduleId, rotationNames[rotations], colorNames[colorNumber],
                        words[labelNumber], shownDigit);
        if (colorblindModeEnabled)
        {
            colorblindLabel.GetComponentInChildren <TextMesh>().text = colorNames[colorNumber];
        }
        figureAnswer();
        pressedAllowed = true;
    }
示例#12
0
    IEnumerator _Fade(float time, float start, float target)
    {
        float timer = 0;

        while (timer <= time)
        {
            timer += Time.deltaTime;
            meshRenderer.material.SetColor("_EmissionColor", emissiveColor * Mathf.Lerp(start, target, timer / time));
            meshRenderer.GetComponentInChildren <Light>().intensity = Mathf.Lerp(start, target, timer / time);

            yield return(null);
        }
    }
示例#13
0
    void SetCubeText(int x, int y, string text)
    {
        int          index = x + y * Width;
        MeshRenderer mr    = null;

        if (cubes.TryGetValue(index, out mr))
        {
            mr.GetComponentInChildren <TextMesh>().text = text;
        }
        else
        {
            Debug.LogError("can not find cube");
        }
    }
示例#14
0
        void DrawRenderer(MeshRenderer renderer, bool containSubMesh)
        {
            if (containSubMesh)
            {
                var filter = renderer.GetComponentInChildren <MeshFilter>();

                for (int i = 0, iMax = filter.sharedMesh.subMeshCount; i < iMax; i++)
                {
                    DrawRenderer_Imple(renderer, i);
                }
            }
            else
            {
                DrawRenderer_Imple(renderer);
            }
        }
示例#15
0
    private void ClearDistanceAlarm(PlaneTrasponder plane, PlaneTrasponder otherPlane)
    {
        MeshRenderer firstPlaneMeshRend  = plane.gameObject.GetComponent <MeshRenderer>();
        MeshRenderer secondPlaneMeshRend = otherPlane.gameObject.GetComponent <MeshRenderer>();

        firstPlaneMeshRend.material  = defaultMat;
        secondPlaneMeshRend.material = defaultMat;

        firstPlaneMeshRend.GetComponentInChildren <Text>().color  = Color.white;
        secondPlaneMeshRend.GetComponentInChildren <Text>().color = Color.white;

        firstPlaneMeshRend.GetComponent <LineRenderer>().startColor = Color.white;
        firstPlaneMeshRend.GetComponent <LineRenderer>().endColor   = Color.white;


        alertInfo.text = " ";
    }
示例#16
0
    private void DistanceAlarm(PlaneTrasponder plane, PlaneTrasponder otherPlane, float dist)
    {
        MeshRenderer firstPlaneMeshRend  = plane.gameObject.GetComponent <MeshRenderer>();
        MeshRenderer secondPlaneMeshRend = otherPlane.gameObject.GetComponent <MeshRenderer>();

        firstPlaneMeshRend.material  = alarmMat;
        secondPlaneMeshRend.material = alarmMat;

        firstPlaneMeshRend.GetComponentInChildren <Text>().color  = Color.red;
        secondPlaneMeshRend.GetComponentInChildren <Text>().color = Color.red;

        firstPlaneMeshRend.GetComponent <LineRenderer>().startColor = Color.red;
        firstPlaneMeshRend.GetComponent <LineRenderer>().endColor   = Color.red;

        alertTitle.text = "Alert System";
        alertInfo.text  = plane.name + " " + otherPlane.name + "\r\n" + "Traffic Alert less than" + " " + Mathf.Round(dist).ToString() + " " + "miles";
    }
示例#17
0
 void AddStuffToObject(MeshRenderer mesh)
 {
     if (mesh.GetComponentInChildren <Collider>() == null)
     {
         if (level == 0)
         {
             mesh.gameObject.tag = "Bottom";
         }
         if (level == 1)
         {
             mesh.gameObject.tag = "Middle";
         }
         if (level == 2)
         {
             mesh.gameObject.tag = "High";
         }
         BoxCollider boxColl = mesh.gameObject.AddComponent <BoxCollider>();
         boxColl.size = mesh.bounds.size * 10f;
         mesh.gameObject.AddComponent <AudioSource>();
         mesh.gameObject.AddComponent <FloorScript>();
     }
 }
示例#18
0
    void Init()
    {
        delegationZone();
        currentBird = UnityEngine.Random.Range(0, 6);
        birdPart.material.mainTexture = birdImages[currentBird];
        currentCat = UnityEngine.Random.Range(0, 6);
        catPart.material.mainTexture       = catImages[currentCat];
        currentAccessory                   = UnityEngine.Random.Range(0, 6);
        accessoryPart.material.mainTexture = accessoryImages[currentAccessory];
        pickedName = UnityEngine.Random.Range(0, gryphNames.Count());
        theirName  = gryphNames[pickedName];
        age        = UnityEngine.Random.Range(23, 35);
        IDBox.GetComponentInChildren <TextMesh>().text        = gryphNames[pickedName] + " (" + age + ")";
        typeBox.GetComponentInChildren <TextMesh>().text      = birds[currentBird] + "/" + cats[currentCat];
        accessoryBox.GetComponentInChildren <TextMesh>().text = accessories[currentAccessory];
        var spaceNum      = age - 1;
        var getCharA      = "";
        var getCharB      = "";
        var advanceValueA = 0;
        var advanceValueB = 0;

        tableColumn = spaceNum % 6;
        tableRow    = spaceNum / 6;


        if (gryphNames[pickedName].Length % 4 == 0)
        {
            getCharA = Bomb.GetSerialNumber().Substring(0, 1);
            Debug.LogFormat("[Gryphons #{0}] The name, {1}, has a length divisible by four, so using the first SN character, which is {2}.", _moduleId, gryphNames[pickedName], getCharA);
        }
        else if (gryphNames[pickedName].Where(x => "i".Contains(x)).Count() == 0 && gryphNames[pickedName].Where(x => "e".Contains(x)).Count() == 0)
        {
            getCharA = Bomb.GetSerialNumber().Substring(0, 1);
            Debug.LogFormat("[Gryphons #{0}] The name, {1}, does not contain an 'I' or an 'E', so using the first SN character, which is {2}.", _moduleId, gryphNames[pickedName], getCharA);
        }
        else
        {
            getCharA = Bomb.GetSerialNumber().Substring(4, 1);
            Debug.LogFormat("[Gryphons #{0}] The name, {1}, has a length that is not divisible by four, and contains either an 'I' or an 'E', so using the fifth SN character, which is {2}."
                            , _moduleId, gryphNames[pickedName], getCharA);
        }
        if (getCharA.TryParseInt() >= 0 && getCharA.TryParseInt() <= 9)
        {
            advanceValueA = Int16.Parse(getCharA);
            Debug.LogFormat("[Gryphons #{0}] This is a digit.", _moduleId);
        }
        else
        {
            for (int cn = 0; cn < 26; cn++)
            {
                if (alphabet[cn] == getCharA)
                {
                    advanceValueA = cn + 1;
                    Debug.LogFormat("[Gryphons #{0}] This is a letter, position {1} in the alphabet.", _moduleId, advanceValueA);
                    cn = 26;
                }
            }
        }
        spaceNum    = spaceNum + advanceValueA;
        tableColumn = (spaceNum) % 6;
        tableRow    = (spaceNum / 6) % 6;
        Debug.LogFormat("[Gryphons #{0}] Starting in cell number {7} ({1}/{2}) and advancing {3} cell{6} in reading order. This brings us to {4}/{5}",
                        _moduleId, birds[(age - 1) % 6], cats[(age - 1) / 6], advanceValueA, birds[tableColumn], cats[tableRow], advanceValueA == 1 ? "" : "s", age);

        if (gryphNames[pickedName].Length < 6)
        {
            getCharB = Bomb.GetSerialNumber().Substring(1, 1);
            Debug.LogFormat("[Gryphons #{0}] The name has a length that's shorter than six letters, so using the second SN character, which is {2}.", _moduleId, gryphNames[pickedName], getCharB);
        }
        else if (gryphNames[pickedName].Where(x => "z".Contains(x)).Count() != 0 || gryphNames[pickedName].Where(x => "u".Contains(x)).Count() != 0)
        {
            getCharB = Bomb.GetSerialNumber().Substring(1, 1);
            Debug.LogFormat("[Gryphons #{0}] The name contains a 'Z' or a 'U', so using the second SN character, which is {2}.", _moduleId, gryphNames[pickedName], getCharB);
        }
        else
        {
            getCharB = Bomb.GetSerialNumber().Substring(3, 1);
            Debug.LogFormat("[Gryphons #{0}] The name has a length that's at least six letters, and does not contain a 'Z' or a 'U', so using the fourth SN character, which is {2}.",
                            _moduleId, gryphNames[pickedName], getCharB);
        }
        if (getCharB.TryParseInt() >= 0 && getCharB.TryParseInt() <= 9)
        {
            advanceValueB = Int16.Parse(getCharB);
            Debug.LogFormat("[Gryphons #{0}] This is a digit.", _moduleId);
        }
        else
        {
            for (int cn = 0; cn < 26; cn++)
            {
                if (alphabet[cn] == getCharB)
                {
                    advanceValueB = cn + 1;
                    Debug.LogFormat("[Gryphons #{0}] This is a letter, position {1} in the alphabet.", _moduleId, advanceValueB);
                    cn = 26;
                }
            }
        }
        var nextStep = "Resuming from " + birds[tableColumn] + "/" + cats[tableRow];

        tableRow = (tableRow + advanceValueB) % 6;
        Debug.LogFormat("[Gryphons #{0}] {1} and going down {2} row{5}. This brings us to our final gryphon type: {3}/{4}.",
                        _moduleId, nextStep, advanceValueB, birds[tableColumn], cats[tableRow], advanceValueB == 1 ? "" : "s");

        var accessoryTotal = extraValues[tableRow, tableColumn] + age;
        var snThree        = 0;
        var snSix          = 0;

        if (Bomb.GetSerialNumber().Substring(2, 1).TryParseInt() >= 0 && Bomb.GetSerialNumber().Substring(2, 1).TryParseInt() <= 9)
        {
            snThree = Int16.Parse(Bomb.GetSerialNumber().Substring(2, 1));
        }
        else
        {
            for (int cn = 0; cn < 26; cn++)
            {
                if (alphabet[cn] == Bomb.GetSerialNumber().Substring(2, 1))
                {
                    snThree = cn + 1;
                    cn      = 26;
                }
            }
        }
        if (Bomb.GetSerialNumber().Substring(5, 1).TryParseInt() >= 0 && Bomb.GetSerialNumber().Substring(5, 1).TryParseInt() <= 9)
        {
            snSix = Int16.Parse(Bomb.GetSerialNumber().Substring(5, 1));
        }
        else
        {
            for (int cn = 0; cn < 26; cn++)
            {
                if (alphabet[cn] == Bomb.GetSerialNumber().Substring(5, 1))
                {
                    snSix = cn + 1;
                    cn    = 26;
                }
            }
        }
        accessoryTotal = accessoryTotal + snThree + snSix;
        Debug.LogFormat("[Gryphons #{0}] The number in this cell is {1}. Add the age ({2}), and the third and sixth SN digits, {3} and {4}, gives us a total of {5}. That modulo 6 is {6}, which gives us the accessory {7}.",
                        _moduleId, extraValues[tableRow, tableColumn], age, Bomb.GetSerialNumber().Substring(2, 1), Bomb.GetSerialNumber().Substring(5, 1), accessoryTotal, accessoryTotal % 6, accessories[accessoryTotal % 6]);
        correctAccessory = accessoryTotal % 6;
        correctBird      = tableColumn;
        correctCat       = tableRow;
        pressedAllowed   = true;
    }
示例#19
0
 void doClear()
 {
     currentInput = "";
     inputPlace.GetComponentInChildren <TextMesh>().text = "";
 }
示例#20
0
            static void Postfix(PhotoFrameCtr __instance)
            {
                if (!enabled)
                {
                    return;
                }
                Dbgl($"starting photoframectr");

                MeshRenderer[] bbms = __instance.gameObject.GetComponentsInChildren <MeshRenderer>();

                MeshRenderer screenMr = null;

                foreach (MeshRenderer m in bbms)
                {
                    //Dbgl($"mesh: {m.name}");
                    if (m.name == "Item_Billboard_2")
                    {
                        screenMr = m;
                        break;
                    }
                }

                if (screenMr == null)
                {
                    return;
                }

                GameObject tvt = Singleton <ResMgr> .Instance.LoadSyncByType <GameObject>(AssetType.Home, "HomeItem_TVTable");

                TVBenchUnitViewer tvtv = tvt.GetComponentInChildren <TVBenchUnitViewer>(true);

                /*
                 * CabinetUnit unit = new CabinetUnit(3031001);
                 * unit.PutCabinet(4030001, 1, out ItemObject item);
                 * typeof(TVBenchUnitViewer).GetMethod("SetUnitInternal", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(tvtv, new object[] { unit });
                 * Dbgl($"Set Unit");
                 */

                GameObject tvtr = UnityEngine.Object.Instantiate(tvt, __instance.gameObject.transform);
                //Dbgl($"Instantiated");


                ItemObject item = ItemObject.CreateItem(4030001);

                //Dbgl($"got item {item.ItemBase.Name}");

                GameUtils.ClearChildren(typeof(TVBenchUnitViewer).GetField("placeHolder", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tvtv) as GameObject, false);
                GameObject tvObject = GameUtils.AddChild(typeof(TVBenchUnitViewer).GetField("placeHolder", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tvtv) as GameObject, item.ItemBase.DropModelPath, false, AssetType.ItemSystem);
                TVCtr      tvc      = tvObject.GetComponentInChildren <TVCtr>(true);

                //Dbgl($"tvc is null? {tvc == null}");

                typeof(TVBenchUnitViewer).GetField("tVCtr", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(tvtv, tvc);

                MeshRenderer[] tvtms = tvtr.GetComponentsInChildren <MeshRenderer>();

                for (int i = 0; i < tvtms.Length; i++)
                {
                    MeshRenderer m = tvtms[i];
                    m.gameObject.SetActive(false);
                }

                MeshRenderer[] tvms = tvObject.GetComponentsInChildren <MeshRenderer>();

                for (int i = 0; i < tvms.Length; i++)
                {
                    MeshRenderer m = tvms[i];
                    m.gameObject.SetActive(false);
                }

                GameObject screen = typeof(TVCtr).GetField("screen", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tvc) as GameObject;

                screen.GetComponentInChildren <MeshFilter>().mesh = screenMr.GetComponentInChildren <MeshFilter>().mesh;

                //screen.transform.localScale = new Vector3(32f, 18f, 1f);

                PlayerTargetMultiAction CurPlayerTarget = (PlayerTargetMultiAction)typeof(UnitViewer).GetProperty("CurPlayerTarget", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance, null);

                CurPlayerTarget.SetAction(ActionType.ActionRoll, 103809, ActionTriggerMode.Normal);
            }
示例#21
0
 void determineStartNumber()
 {
     startNumber = 15 * UnityEngine.Random.Range(1, 6);           //generates a random number from 1-5 then multiplies it by 15
     startNumber = startNumber - UnityEngine.Random.Range(1, 10); //subtracts a number from 1-9 from the start number, guaranteeing a fizzbuzz number
     curStage    = startNumber - 1;                               //curStage is incremented by 1 in the stage change function
     timerDisplay.GetComponentInChildren <TextMesh>().text = "-" + startNumber + "-";
     Debug.LogFormat("[Quiz Buzz #{0}] The starting stage for this run is {1}.", _moduleId, startNumber);
 }
示例#22
0
    void Init()
    {
        initialString.GetComponentInChildren <TextMesh>().text = "";
        delegationZone();
        Module.OnActivate += delegate { inputResult.GetComponentInChildren <TextMesh>().text = ""; };

        shownString = "";
        shownString = UnityEngine.Random.Range(1, 10).ToString();
        while (shownString.Length < 7)
        {
            shownString = shownString + UnityEngine.Random.Range(0, 10).ToString();
        }
        shownString = shownString + UnityEngine.Random.Range(1, 10).ToString();
        inputResult.GetComponentInChildren <TextMesh>().text = "";
        //shownString = "54204717"; //debug
        initialString.GetComponentInChildren <TextMesh>().text = shownString;

        doClear();
        bombSerial = Bomb.GetSerialNumber();
        //bombSerial = "HT2GZ6"; //debug

        Debug.LogFormat("[Digit String #{0}] The bomb's serial number is {1}. The eight-digit number is {2}.", _moduleId, bombSerial, shownString);
        currentInput = "";
        for (int cn = 0; cn < 6; cn++)
        {
            currentRound = cn + 1;
            isRepeat[cn] = false;
            for (int ck = 0; ck < 6; ck++)
            {
                if (cn != ck)
                {
                    if (bombSerial.Substring(cn, 1) == bombSerial.Substring(ck, 1))
                    {
                        isRepeat[cn] = true;
                        ck           = 5;
                    }
                }
            }
            if (isRepeat[cn])
            {
                if (cn == 0 || cn == 4)
                {
                    theSign = "x";
                }
                else if (cn == 1)
                {
                    theSign = ">";
                }
                else if (cn == 3)
                {
                    theSign = "<";
                }
                else
                {
                    theSign = "+";
                }
                Debug.LogFormat("[Digit String #{0}] Trying serial number character #{1}, which is '{2}'{3}. The sign will be {4} if there is a match on rule {5}"
                                , _moduleId, cn + 1, bombSerial.Substring(cn, 1), isRepeat[cn] ? ", a repeat" : "", theSign, letterRules[36]);
                characterZone(36);
            }
            else
            {
                for (int ln = 0; ln < 36; ln++)
                {
                    if (bombSerial.Substring(cn, 1) == theCharacters[ln])
                    {
                        if (cn == 0 || cn == 4)
                        {
                            theSign = "x";
                        }
                        else if (cn == 1)
                        {
                            theSign = ">";
                        }
                        else if (cn == 3)
                        {
                            theSign = "<";
                        }
                        else
                        {
                            theSign = "+";
                        }
                        Debug.LogFormat("[Digit String #{0}] Trying serial number character #{1}, which is '{2}'{3}. The sign will be {4} if there is a match on rule {5}"
                                        , _moduleId, cn + 1, bombSerial.Substring(cn, 1), isRepeat[cn] ? ", a repeat" : "", theSign, letterRules[ln]);
                        characterZone(ln);
                        ln = 99;
                    }
                }
            }

            if (foundAnswer)
            {
                Debug.LogFormat("[Digit String #{0}] Found a match. First number is {1}, sign is {2}, and second number is {3}.", _moduleId, firstNumber, theSign, secondNumber);

                cn = 5;
            }
        }
        if (!foundAnswer)
        {
            var hasMatch = false;
            uniques = 1;
            for (int snn = 1; snn < 6; snn++)
            {
                for (int rnn = 0; rnn < snn; rnn++)
                {
                    if (bombSerial.Substring(rnn, 1) == bombSerial.Substring(snn, 1))
                    {
                        hasMatch = true;
                        rnn      = snn;
                    }
                }

                if (!hasMatch)
                {
                    uniques++;
                }
                hasMatch = false;
            }
            theSign      = "+";
            foundAnswer  = true;
            firstNumber  = Int32.Parse(shownString.Substring(0, uniques));
            secondNumber = Int32.Parse(shownString.Substring(uniques + 1, 7 - uniques));
            Debug.LogFormat("[Digit String #{0}] No match found using serial number characters, replacing digit number {1} + 1, or {2}, with a plus sign. First number is {3}, sign is +, and second number is {4}."
                            , _moduleId, uniques, uniques + 1, firstNumber, secondNumber);
        }
        if (theSign == ">")
        {
            if (firstNumber > secondNumber)
            {
                moduleSolution = 1;
            }
            else
            {
                moduleSolution = 0;
            }
            Debug.LogFormat("[Digit String #{0}] {1} {2} {3}. This is {4}, so the answer is {5}.", _moduleId, firstNumber, theSign, secondNumber,
                            firstNumber > secondNumber ? "true" : "false", moduleSolution);
        }
        else if (theSign == "<")
        {
            if (firstNumber < secondNumber)
            {
                moduleSolution = 1;
            }
            else
            {
                moduleSolution = 0;
            }
            Debug.LogFormat("[Digit String #{0}] {1} {2} {3}. This is {4}, so the answer is {5}.", _moduleId, firstNumber, theSign, secondNumber,
                            firstNumber < secondNumber ? "true" : "false", moduleSolution);
        }
        else if (theSign == "+")
        {
            moduleSolution = firstNumber + secondNumber;
            Debug.LogFormat("[Digit String #{0}] {1} {2} {3} = {4}", _moduleId, firstNumber, theSign, secondNumber, moduleSolution);
        }
        else
        {
            moduleSolution = firstNumber * secondNumber;
            Debug.LogFormat("[Digit String #{0}] {1} {2} {3} = {4}", _moduleId, firstNumber, theSign, secondNumber, moduleSolution);
        }
        pressedAllowed = true;
    }
示例#23
0

        
示例#24
0
    void Init()
    {
        for (int i = 0; i < 5; i++)
        {
            stageDisplay[i].GetComponentInChildren <TextMesh>().text = "";
        }
        inputDisplay.GetComponentInChildren <TextMesh>().text = "";
        curSolved    = 0;
        numSolvables = Bomb.GetSolvableModuleNames().Where(x => !listF.Contains(x)).Count() + extraz;
        //Debug.Log(Bomb.GetSolvableModuleNames().Where(x => !listF.Contains(x)).ToString());
        //Debug.Log(Bomb.GetSolvableModuleNames());
        //var xxxxx = String.Join(", ", Bomb.GetSolvableModuleNames());
        //Debug.Log("Solviez " + String.Join(", ", Bomb.GetSolvableModuleNames().ToArray()));


        //numSolvables = 57; //debug
        if (numSolvables < 2)
        {
            Debug.LogFormat("[Forget This #{0}] Auto-solving, not enough non-List F modules exist (need 2 or more)", _moduleId);
            autoSolved = true;
            isSolved   = true;
        }
        else
        {
            Debug.LogFormat("[Forget This #{0}] {1} (Row C is the first letter of the stage's color, V is the stage's value)", _moduleId, coolString);
            for (int i = 1; i <= numSolvables; i++)
            {
                //var iZero = i - 1;
                stageNumbers.Add(UnityEngine.Random.Range(0, 36));
                stageColors.Add(UnityEngine.Random.Range(0, 5));
                if (numSolvables == i)
                {
                    //coolString = coolString + "and " + i + " is " + lightColors[(int)stageColors[iZero]] + " " + theValues[(int)stageNumbers[iZero]] + " (worth " + stageNumbers[iZero] + ").";
                }
                else
                {
                    //coolString = coolString + i + " is " + lightColors[(int)stageColors[iZero]] + " " + theValues[(int)stageNumbers[iZero]] + " (worth " + stageNumbers[iZero] + "), ";
                }
            }
            //numSolvables = 7;
            if (numSolvables > 5)
            {
                finalStage[0] = UnityEngine.Random.Range(2, numSolvables);
                finalStage[1] = finalStage[0];
                finalStage[2] = finalStage[0];
                finalStage[3] = finalStage[0];
                finalStage[4] = finalStage[0];
                while (finalStage[1] == finalStage[0])
                {
                    finalStage[1] = UnityEngine.Random.Range(2, numSolvables + 1);
                }
                while (finalStage[2] == finalStage[0] || finalStage[2] == finalStage[1])
                {
                    finalStage[2] = UnityEngine.Random.Range(2, numSolvables + 1);
                }
                while (finalStage[3] == finalStage[0] || finalStage[3] == finalStage[1] || finalStage[3] == finalStage[2])
                {
                    finalStage[3] = UnityEngine.Random.Range(2, numSolvables + 1);
                }
                while (finalStage[4] == finalStage[0] || finalStage[4] == finalStage[1] || finalStage[4] == finalStage[2] || finalStage[4] == finalStage[3])
                {
                    finalStage[4] = UnityEngine.Random.Range(2, numSolvables + 1);
                }
            }
            else
            {
                finalStage[0] = UnityEngine.Random.Range(2, 1 + numSolvables);
                finalStage[1] = UnityEngine.Random.Range(2, 1 + numSolvables);
                finalStage[2] = UnityEngine.Random.Range(2, 1 + numSolvables);
                finalStage[3] = UnityEngine.Random.Range(2, 1 + numSolvables);
                finalStage[4] = UnityEngine.Random.Range(2, 1 + numSolvables);
            }
            var twenties    = (int)(numSolvables / 20);
            var numberGroup = "";
            var colorGroup  = "";
            var tN          = 0;
            var unitNum     = 0;

            for (tN = 0; tN < twenties; tN++)
            {
                for (unitNum = 0; unitNum < 20; unitNum++)
                {
                    numberGroup = numberGroup + theValues[stageNumbers[(tN * 20) + unitNum]];
                    colorGroup  = colorGroup + lightColors[stageColors[(tN * 20) + unitNum]].Substring(0, 1);
                    if (unitNum > 0 && unitNum % 5 == 4)
                    {
                        numberGroup = numberGroup + " ";
                        colorGroup  = colorGroup + " ";
                    }
                }

                //Debug.LogFormat("{1}", _moduleId, colorGroup);

                Debug.LogFormat("[Forget This #{0}] Stages {1} to {2}", _moduleId, 1 + (20 * tN), 20 + (20 * tN));
                Debug.LogFormat("[Forget This #{0}] C: {1}", _moduleId, colorGroup);
                Debug.LogFormat("[Forget This #{0}] V: {1}", _moduleId, numberGroup);
                Debug.LogFormat("[Forget This #{0}]", _moduleId);
                numberGroup = "";
                colorGroup  = "";
            }
            for (unitNum = 0; unitNum < (numSolvables - (20 * (int)(numSolvables / 20))); unitNum++)
            {
                numberGroup = numberGroup + theValues[stageNumbers[(tN * 20) + unitNum]];
                colorGroup  = colorGroup + lightColors[stageColors[(tN * 20) + unitNum]].Substring(0, 1);
                if (unitNum > 0 && unitNum % 5 == 4)
                {
                    numberGroup = numberGroup + " ";
                    colorGroup  = colorGroup + " ";
                }
            }

            Debug.LogFormat("[Forget This #{0}] Stages {1} to {2}", _moduleId, 1 + (20 * tN), unitNum + (20 * tN));
            Debug.LogFormat("[Forget This #{0}] C: {1}", _moduleId, colorGroup);
            Debug.LogFormat("[Forget This #{0}] V: {1}", _moduleId, numberGroup);
            Debug.LogFormat("[Forget This #{0}]", _moduleId);
            numberGroup = "";
            colorGroup  = "";
            Debug.LogFormat("[Forget This #{0}] Stages to implement, in the order in which they should be implemented: {1}, {2}, {3}, {4}, and {5}.", _moduleId, finalStage[0], finalStage[1],
                            finalStage[2], finalStage[3], finalStage[4]);
            doSolution();
        }


        upButton.OnInteract     += delegate() { OnPress(); doUp(); upButton.AddInteractionPunch(0.2f); return(false); };
        downButton.OnInteract   += delegate() { OnPress(); doDown();  downButton.AddInteractionPunch(0.2f); return(false); };
        centerButton.OnInteract += delegate() { OnPress(); doSubmit();  downButton.AddInteractionPunch(0.2f); return(false); };

        upButton.OnInteractEnded     += delegate() { OnRelease(); };
        downButton.OnInteractEnded   += delegate() { OnRelease(); };
        centerButton.OnInteractEnded += delegate() { OnRelease(); };
        Module.OnActivate            += delegate { doActivationStuff(); };
    }
示例#25
0
        public void DrawOneHint(int numberFromAxis, int number, Color c, MarchDirections drawDir, Triangle initialEdge)
        {
            MeshRenderer filledMesh = GameObject.Instantiate(hintMeshMaker, Vector3.zero, Quaternion.identity, transform).GetComponent <MeshRenderer>();
            Mesh         mesh       = new Mesh();

            numberFromAxis--;//
            Vector2Int drawPosition = new Triangle(initialEdge.position.x, initialEdge.position.y, initialEdge.edgeLength).position;

            drawPosition = Triangle.March(drawPosition, drawDir);
            for (int i = 0; i < numberFromAxis; i++)
            {
                //Skip over x times, to get to the right triangle (rhombus) place to darw
                drawPosition = Triangle.March(drawPosition, drawDir);
                drawPosition = Triangle.March(drawPosition, drawDir);
            }

            Vector2Int drawPosition2 = Triangle.March(drawPosition, drawDir);

            //A rhombus is made of two triangles that share  an edge. These are those two triangles.
            Triangle rh1 = new Triangle(drawPosition);
            Triangle rh2 = new Triangle(drawPosition2);

            //Get verts of our triangles.
            Vector2[] vertsrh1 = rh1.GetVertsInWorldSpace();
            Vector2[] vertsrh2 = rh2.GetVertsInWorldSpace();


            //Ah, a nice neat array of our verts.
            Vector2[] verts2 = new Vector2[vertsrh1.Length + vertsrh2.Length];
            vertsrh1.CopyTo(verts2, 0);
            vertsrh2.CopyTo(verts2, vertsrh1.Length);

            //Great! Verts 2 is our nice neat array of two triangles now.
            ///It has duplicate vertices buuuuut is that actually a problem?

            Vector2[] verts2Local = new Vector2[verts2.Length]; //4
            Vector3[] verts3      = new Vector3[verts2.Length]; //4

            Vector3 offset = Vector3.Lerp(rh1.GetCentroidInWorldSpace(), rh2.GetCentroidInWorldSpace(), 0.5f);

            for (int i = 0; i < verts2.Length; i++)
            {
                verts2Local[i] = verts2[i] - (Vector2)offset; //same but Vector2 cus why bother casting a whole array later for the polygon collider2d.
                verts3[i]      = (Vector3)verts2[i] - offset; //offset by vertex 0...
            }

            int[] tris = new int[] { 2, 1, 0, 5, 4, 3 };//simple enough.

            mesh.vertices  = verts3;
            mesh.triangles = tris;
            //
            filledMesh.transform.position = transform.position + offset;//un-offset. By this offset so the position is the centroid, and by the parent, for moving the grid around. Now our triangles are positioned sensibly.

            //and we can do sorting/filtering by world positions or transforms, which is easier than just naked data because unity has a lot of features for it
            //already built it. I THINK.
            //
            filledMesh.GetComponent <MeshFilter>().mesh = mesh;

            filledMesh.material.color = c;
            filledMesh.enabled        = true;
            //Set our text to be the right hint.
            filledMesh.GetComponentInChildren <TMPro.TextMeshPro>().text = number.ToString();
            //Center the textMesh
            //offset set in the chid object of prefab. IDK, its fine.
            // filledMesh.transform.GetChild(0).transform.position = filledMesh.transform.position;
        }
示例#26
0
    void Init()
    {
        for (int i = 0; i < 5; i++)
        {
            stageDisplay[i].GetComponentInChildren <TextMesh>().text = "";
        }
        inputDisplay.GetComponentInChildren <TextMesh>().text = "";

        numSolvables = Bomb.GetSolvableModuleNames().Where(x => !listF.Contains(x)).Count() + extraz;
        // debug numSolvables = 7;
        if (numSolvables < 2)
        {
            Debug.LogFormat("[Forget This #{0}] Auto-solving, not enough non-List F modules exist (need 2 or more)", _moduleId);
            autoSolved = true;
            isSolved   = true;
        }
        else
        {
            for (int i = 1; i <= numSolvables; i++)
            {
                var iZero = i - 1;
                stageNumbers.Add(UnityEngine.Random.Range(0, 36));
                stageColors.Add(UnityEngine.Random.Range(0, 5));
                if (numSolvables == i)
                {
                    coolString = coolString + "and " + i + " is " + lightColors[(int)stageColors[iZero]] + " " + theValues[(int)stageNumbers[iZero]] + " (worth " + stageNumbers[iZero] + ").";
                }
                else
                {
                    coolString = coolString + i + " is " + lightColors[(int)stageColors[iZero]] + " " + theValues[(int)stageNumbers[iZero]] + " (worth " + stageNumbers[iZero] + "), ";
                }
            }
            //numSolvables = 7;
            if (numSolvables > 5)
            {
                finalStage[0] = UnityEngine.Random.Range(2, numSolvables);
                finalStage[1] = finalStage[0];
                finalStage[2] = finalStage[0];
                finalStage[3] = finalStage[0];
                finalStage[4] = finalStage[0];
                while (finalStage[1] == finalStage[0])
                {
                    finalStage[1] = UnityEngine.Random.Range(2, numSolvables);
                }
                while (finalStage[2] == finalStage[0] || finalStage[2] == finalStage[1])
                {
                    finalStage[2] = UnityEngine.Random.Range(2, numSolvables);
                }
                while (finalStage[3] == finalStage[0] || finalStage[3] == finalStage[1] || finalStage[3] == finalStage[2])
                {
                    finalStage[3] = UnityEngine.Random.Range(2, numSolvables);
                }
                while (finalStage[4] == finalStage[0] || finalStage[4] == finalStage[1] || finalStage[4] == finalStage[2] || finalStage[4] == finalStage[3])
                {
                    finalStage[4] = UnityEngine.Random.Range(2, numSolvables);
                }
            }
            else
            {
                finalStage[0] = UnityEngine.Random.Range(2, 1 + numSolvables);
                finalStage[1] = UnityEngine.Random.Range(2, 1 + numSolvables);
                finalStage[2] = UnityEngine.Random.Range(2, 1 + numSolvables);
                finalStage[3] = UnityEngine.Random.Range(2, 1 + numSolvables);
                finalStage[4] = UnityEngine.Random.Range(2, 1 + numSolvables);
            }
            Debug.LogFormat("[Forget This #{0}] {1}", _moduleId, coolString);
            Debug.LogFormat("[Forget This #{0}] Final stages, in order: {1}, {2}, {3}, {4}, and {5}.", _moduleId, finalStage[0], finalStage[1],
                            finalStage[2], finalStage[3], finalStage[4]);
            doSolution();
        }


        upButton.OnInteract     += delegate() { OnPress(); doUp(); upButton.AddInteractionPunch(0.2f); return(false); };
        downButton.OnInteract   += delegate() { OnPress(); doDown();  downButton.AddInteractionPunch(0.2f); return(false); };
        centerButton.OnInteract += delegate() { OnPress(); doSubmit();  downButton.AddInteractionPunch(0.2f); return(false); };

        upButton.OnInteractEnded     += delegate() { OnRelease(); };
        downButton.OnInteractEnded   += delegate() { OnRelease(); };
        centerButton.OnInteractEnded += delegate() { OnRelease(); };
        Module.OnActivate            += delegate { doActivationStuff(); };
    }