void Start()
    {
        lookupRef = this.GetComponent <ImportLookup>();

        redInput.text   = "255";
        greenInput.text = "255";
        blueInput.text  = "255";
    }
Ejemplo n.º 2
0
    void Start()
    {
        // Create reference to ImportLookup.cs script -- reads lookup table csv files
        // ImportLookup.cs is placed on Main Camera in scene
        lookupRef = GameObject.Find("Main Camera").GetComponent <ImportLookup>();

        // Create reference to DKLConversion.cs script -- converts between RGB and DKL
        // DKLConversion.cs is placed on same gameobject as current script
        m_dklConversion = this.GetComponent <DKLConversion>();

        // Access lookup tables using ImportLookup.cs script for each Red, Green, and Blue
        redlookup   = lookupRef.reddict;
        greenlookup = lookupRef.greendict;
        bluelookup  = lookupRef.bluedict;

        // Access blue, red, and green gameobjects' materials
        targetMaterial = targetObject.GetComponent <Renderer>().material;
        dist1Material  = dist1Object.GetComponent <Renderer>().material;
        dist2Material  = dist2Object.GetComponent <Renderer>().material;

        // Set blue, red, and green object's material colors by inputing the unfiltered
        // starting values entered in the inspector to the lookup tables
        targetMaterial.color = new Color32(redlookup[targetRed], greenlookup[targetGreen], bluelookup[targetBlue], 255);
        dist1Material.color  = new Color32(redlookup[dist1Red], greenlookup[dist1Green], bluelookup[dist1Blue], 255);
        dist2Material.color  = new Color32(redlookup[dist2Red], greenlookup[dist2Green], bluelookup[dist2Blue], 255);

        // Get starting DKL values for blue, red, and green object's material
        GetStartingDKL();

        // Setup for save file containing RGB values for each blue, red, and green
        // objects' material colors
        // Create "ColorProperties" folder in game files if non-existant
        Directory.CreateDirectory(Application.dataPath + "/ColorProperties");

        // Collect all of the previous csv files in the "ColorProperties" and count them
        // to determine number of current file
        string filePath = string.Format("{0}/ColorProperties/", Application.dataPath);

        string[] fileArray = Directory.GetFiles(filePath, "*csv");
        int      num       = fileArray.Length + 1;

        // Create current save file's name and path
        expPath = string.Format("{0}/ColorProperties/ColorProperties_{1}.csv",
                                Application.dataPath, num);

        nextSceneNum = SceneManager.GetActiveScene().buildIndex + 1;
        callNum      = startCall;
    }
Ejemplo n.º 3
0
    void Start()
    {
        lookupRef   = GameObject.Find("Main Camera").GetComponent <ImportLookup>();
        redlookup   = lookupRef.reddict;
        greenlookup = lookupRef.greendict;
        bluelookup  = lookupRef.bluedict;

        m_dklConversion   = this.GetComponent <DKLConversion>();
        m_CalibrateColors = this.GetComponent <CalibrateColors>();

        // Create "ItemProperties" folder in game files if non-existant
        Directory.CreateDirectory(Application.dataPath + "/ItemProperties");

        // Collect all of the previous csv files in the "ColorProperties" and count them
        // to determine number of current file
        string filePath = string.Format("{0}/ItemProperties/", Application.dataPath);

        string[] fileArray = Directory.GetFiles(filePath, "*csv");
        int      num       = fileArray.Length + 1;

        // Create current save file's name and path
        expPath = string.Format("{0}/ItemProperties/ItemProperties_{1}.csv",
                                Application.dataPath, num);
    }
Ejemplo n.º 4
0
    void Start()
    {
        // Create reference to ImportLookup.cs script -- reads lookup table csv files
        // ImportLookup.cs is placed on Main Camera in scene
        lookupRef = GameObject.Find("Main Camera").GetComponent <ImportLookup>();

        // Create reference to ReadCSV_target.cs script -- get the azimuth of the target
        m_readCSVtarget = GameObject.Find("Main Camera").GetComponent <ReadCSV_target>();

        // Create reference to DKLConversion.cs script -- converts between RGB and DKL
        // DKLConversion.cs is placed on same gameobject as current script
        m_dklConversion = this.GetComponent <DKLConversion>();

        // Access lookup tables using ImportLookup.cs script for each Red, Green, and Blue
        bluelookup  = lookupRef.bluedict;
        redlookup   = lookupRef.reddict;
        greenlookup = lookupRef.greendict;

        // Access baseline blue (blue0), peripheral color gameobjects' materials,
        // and opposite peripheral color gameobjects' materials
        targetMaterial0 = targetObject0.GetComponent <Renderer>().material;
        for (int i = 0; i < peripheralObjects.Count; i++)
        {
            peripheralMaterials[i]    = peripheralObjects[i].GetComponent <InputMaterial>().targetColor;
            oppPeripheralMaterials[i] = peripheralObjects[i].GetComponent <InputMaterial>().oppositeColor;
        }

        // Get RGB values of baseline color's material color
        Color32 targetBlue = targetMaterial0.color;

        red   = targetBlue.r;
        green = targetBlue.g;
        blue  = targetBlue.b;

        // Get DKL values for baseline color's material color
        targetVectorLength = 1f;  // set starting luminance level
        targetAzimuth      = m_readCSVtarget.targetAzimuth;
        targetElevation    = 15f; // set starting saturation level

        // Set starting DKL hue for each peripheral color by inputing baseline blue0's DKL hue
        // and increase by the appropriate degrees
        for (int i = 0; i < peripheralObjects.Count; i++)
        {
            peripheralAzimuth[i]    = StartingColors(peripheralMaterials[i], deg[i], targetAzimuth);
            oppPeripheralAzimuth[i] = StartingColors(oppPeripheralMaterials[i], deg[i] + 180f, targetAzimuth);
        }

        // Set starting DKL saturation and DKL luminance for each peripheral color to equal
        // baseline color's respective values
        for (int i = 0; i < peripheralObjects.Count; i++)
        {
            peripheralVectorLength[i] = targetVectorLength;
            peripheralElevation[i]    = targetElevation;

            oppPeripheralVectorLength[i] = targetVectorLength;
            oppPeripheralElevation[i]    = targetElevation;
        }

        // Set scene by activating blue1 gameobject and hiding other gameobjects
        targetObject0.SetActive(false);
        peripheralObjects[0].SetActive(true);

        for (int i = 1; i < peripheralObjects.Count; i++)
        {
            peripheralObjects[i].SetActive(false);
        }

        // Setup for save file containing RGB values for each blue1, blue2, blue3, and blue4
        // objects' material colors
        // Create "PeripheralProperties" folder in game files if non-existant
        Directory.CreateDirectory(Application.dataPath + "/PeripheralProperties");

        // Collect all of the previous csv files in the "PeripheralProperties" and count them
        // to determine number of current file
        string filePath = string.Format("{0}/PeripheralProperties/", Application.dataPath);

        string[] fileArray = Directory.GetFiles(filePath, "*csv");
        int      num       = fileArray.Length + 1;

        // Create current save file's name and path
        expPath = string.Format("{0}/PeripheralProperties/PeripheralProperties_{1}.csv",
                                Application.dataPath, num);

        nextSceneNum = SceneManager.GetActiveScene().buildIndex + 1;
    }