Example #1
0
    public void Setup()
    {
        //Initialize by clearing all preconfigured wires.
        ReColoredWires.Clear();

        //Generate new wire properties for each wire in the list.
        int wireIDCounter = 1;

        foreach (GameObject wire in AllWires)
        {
            WireProperties wireProp = new WireProperties();
            wireProp.wireName    = wire.name;
            wireProp.wireOBJ     = wire;
            wireProp.wireColor   = new Color(CryptoRandom.Between(1, 255) / 255f, CryptoRandom.Between(1, 255) / 255f, CryptoRandom.Between(1, 255) / 255f, 1.0f);
            wireProp.wireID      = wireIDCounter;
            wireProp.correctWire = false;
            if (_debug)
            {
                Debug.Log("WireName: " + wireProp.wireName + "\n" + "WireColor: " + wireProp.wireColor + "\n" + "WireID: " + wireProp.wireID);
            }
            ReColoredWires.Add(wireProp);

            wireIDCounter++;
        }
        //Assign colors to the wires generated.
        AssignColors();
    }
Example #2
0
    // This method picks a wire from the list to be the correct wire to cut.
    private void PickCorrectWire()
    {
        // Uses a random number generator to pick a wire by ID (integer).
        int chosenWireNum = CryptoRandom.Between(1, AllWires.Count);

        foreach (WireProperties wireProp in ReColoredWires)
        {
            if (wireProp.wireID == chosenWireNum)
            {
                wireProp.correctWire = true;

                if (modeManager.gameMode == ModeManager.GameMode.Practice)
                {
                    wireProp.wireOBJ.GetComponent <Renderer>().material.SetFloat("_Outline", 0.1f);
                }
                correctColorPanel.material.color = wireProp.wireColor;
                break;
            }
            else
            {
                wireProp.correctWire = false;
            }
        }
    }