Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     if (this.name == "barA")
     {
         //haptic = GameObject.Find("HapticSquareA").GetComponent<HapticSquare>();
         //haptic.UpdateHaptics(HapticSquare.HapticType.BAR01);
     }
     //else if (this.name == "barB")
     //{
     //    haptic = GameObject.Find("HapticSquareB").GetComponent<HapticSquare>();
     //    haptic.UpdateHaptics(HapticSquare.HapticType.BAR02);
     //}
     //else if (this.name == "barC")
     //{
     //    haptic = GameObject.Find("HapticSquareC").GetComponent<HapticSquare>();
     //    haptic.UpdateHaptics(HapticSquare.HapticType.BAR03);
     //}
     //else if (this.name == "barD")
     //{
     //    haptic = GameObject.Find("HapticSquareD").GetComponent<HapticSquare>();
     //    haptic.UpdateHaptics(HapticSquare.HapticType.BAR04);
     //}
     //else if (this.name == "barE")
     //{
     //    haptic = GameObject.Find("HapticSquareE").GetComponent<HapticSquare>();
     //    haptic.UpdateHaptics(HapticSquare.HapticType.BAR11);
     //}
     //else if (this.name == "barF")
     //{
     //    haptic = GameObject.Find("HapticSquareF").GetComponent<HapticSquare>();
     //    haptic.UpdateHaptics(HapticSquare.HapticType.BAR13);
     //}
     //else if (this.name == "barG")
     //{
     //    haptic = GameObject.Find("HapticSquareG").GetComponent<HapticSquare>();
     //    haptic.UpdateHaptics(HapticSquare.HapticType.BAR33);
     //}
     else if (this.name == "barOnHigh")
     {
         haptic = GameObject.Find("HapticSquareX").GetComponent <HapticSquare>();
         haptic.UpdateHaptics(HapticSquare.HapticType.BARA);
     }
     else if (this.name == "barOnMed")
     {
         haptic = GameObject.Find("HapticSquareY").GetComponent <HapticSquare>();
         haptic.UpdateHaptics(HapticSquare.HapticType.BARB);
     }
     else if (this.name == "barOnLow")
     {
         haptic = GameObject.Find("HapticSquareZ").GetComponent <HapticSquare>();
         haptic.UpdateHaptics(HapticSquare.HapticType.BARC);
     }
 }
Exemplo n.º 2
0
    private void StartFormative()
    {
        Debug.Log("start circuit.cs for formative");
        // circuits for testing different circuits with high, med, low current
        circuitSprite1 = Resources.Load <Sprite>("Sprites/Circuits/circuitA");
        circuitSprite2 = Resources.Load <Sprite>("Sprites/Circuits/circuitA2");
        circuitSprite3 = Resources.Load <Sprite>("Sprites/Circuits/circuitA3");

        haptic = GameObject.Find("HapticSquare").GetComponent <HapticSquare>();

        currentHapticType = HapticSquare.HapticType.NOISEHIGH;
        haptic.UpdateHaptics(currentHapticType);
    }
Exemplo n.º 3
0
    private void StartTasks()
    {
        thisPlayerLog = GameObject.Find("EventSystem").GetComponent <PlayerLog>();

        hint = GameObject.Find("Hint");
        hint.SetActive(false);

        confirmPage = GameObject.Find("Confirm Finish");
        confirmPage.SetActive(false);

        Debug.Log("this circuit: " + GlobalVariables.thisTask);
        haptic = GameObject.Find("HapticSquare").GetComponent <HapticSquare>();

        nextButton   = GameObject.Find("Next Button");
        finishButton = GameObject.Find("Finish Button");

        buttonC1 = GameObject.Find("Circuit1 Button");
        buttonC2 = GameObject.Find("Circuit2 Button");
        buttonC3 = GameObject.Find("Circuit3 Button");

        sliderR = GameObject.Find("SliderR");

        finishButton.SetActive(false);
        buttonC1.SetActive(false);
        buttonC2.SetActive(false);
        buttonC3.SetActive(false);
        sliderR.SetActive(false);

        //set button sprites
        buttonC1Sprite        = Resources.Load <Sprite>("Sprites/Buttons/circuit1");
        buttonC1ClickedSprite = Resources.Load <Sprite>("Sprites/Buttons/circuit1clicked");
        buttonC2Sprite        = Resources.Load <Sprite>("Sprites/Buttons/circuit2");
        buttonC2ClickedSprite = Resources.Load <Sprite>("Sprites/Buttons/circuit2clicked");
        buttonC3Sprite        = Resources.Load <Sprite>("Sprites/Buttons/circuit3");
        buttonC3ClickedSprite = Resources.Load <Sprite>("Sprites/Buttons/circuit3clicked");

        buttonReadSprite        = Resources.Load <Sprite>("Sprites/Buttons/read");
        buttonReadClickedSprite = Resources.Load <Sprite>("Sprites/Buttons/readclicked");

        GlobalVariables.hintOn = false;

        switch (GlobalVariables.thisTask)
        {
        case 1:
            circuitSprite1    = Resources.Load <Sprite>("Sprites/Circuits/bg-circuit1");
            taskSprite        = Resources.Load <Sprite>("Sprites/Buttons/task1");
            currentHapticType = HapticSquare.HapticType.STRIPEHIGHH;     //quick solution for fixing a bug
            haptic.UpdateHaptics(currentHapticType);
            currentHapticType = HapticSquare.HapticType.STRIPEHIGHV;
            haptic.UpdateHaptics(currentHapticType);
            thisPlayerLog.AddEvent("=============================================\n"
                                   + "t = " + Time.time.ToString() + ", Start Task 1"
                                   + "\n=============================================");
            break;

        case 2:
            circuitSprite1    = Resources.Load <Sprite>("Sprites/Circuits/bg-circuit2");
            taskSprite        = Resources.Load <Sprite>("Sprites/Buttons/task2");
            currentHapticType = HapticSquare.HapticType.STRIPEMEDH;     //quick solution for fixing a bug
            haptic.UpdateHaptics(currentHapticType);
            currentHapticType = HapticSquare.HapticType.STRIPEMEDV;
            haptic.UpdateHaptics(currentHapticType);
            thisPlayerLog.AddEvent("=============================================\n"
                                   + "t = " + Time.time.ToString() + ", Start Task 2"
                                   + "\n=============================================");
            break;

        case 3:
            circuitSprite1    = Resources.Load <Sprite>("Sprites/Circuits/bg-circuit1");
            taskSprite        = Resources.Load <Sprite>("Sprites/Buttons/task3");
            currentHapticType = HapticSquare.HapticType.STRIPEHIGHV;
            haptic.UpdateHaptics(currentHapticType);

            //activate C1 and C2 buttons
            buttonC1.SetActive(true);
            buttonC2.SetActive(true);

            thisPlayerLog.AddEvent("=============================================\n"
                                   + "t = " + Time.time.ToString() + ", Start Task 3"
                                   + "\n=============================================");
            break;

        case 4:
            circuitSprite1    = Resources.Load <Sprite>("Sprites/Circuits/bg-circuit1");
            taskSprite        = Resources.Load <Sprite>("Sprites/Buttons/task4");
            currentHapticType = HapticSquare.HapticType.STRIPELOWH;     //quick solution for fixing a bug
            haptic.UpdateHaptics(currentHapticType);
            currentHapticType = HapticSquare.HapticType.STRIPEHIGHV;
            haptic.UpdateHaptics(currentHapticType);
            //activate C1 and C2 buttons
            buttonC1.SetActive(true);
            buttonC2.SetActive(true);
            buttonC3.SetActive(true);

            thisPlayerLog.AddEvent("=============================================\n"
                                   + "t = " + Time.time.ToString() + ", Start Task 4"
                                   + "\n=============================================");
            break;

        case 5:
            circuitSprite1    = Resources.Load <Sprite>("Sprites/Circuits/bg-circuit4R1");
            taskSprite        = Resources.Load <Sprite>("Sprites/Buttons/task5");
            currentHapticType = HapticSquare.HapticType.STRIPEMEDV;
            haptic.UpdateHaptics(currentHapticType);

            //activate slider
            sliderR.SetActive(true);

            //deactivate the back button
            nextButton.SetActive(false);
            finishButton.SetActive(true);


            thisPlayerLog.AddEvent("=============================================\n"
                                   + "t = " + Time.time.ToString() + ", Start Task 5"
                                   + "\n=============================================");
            break;
        }

        GlobalVariables.currentHapticType = currentHapticType;

        haptic.DeactivateHaptic();

        GameObject bg = GameObject.Find("Background");

        bg.GetComponent <Image>().sprite = circuitSprite1;
        //spriteR = bg.GetComponent<SpriteRenderer>();
        //spriteR.sprite = circuitSprite1;

        GameObject taskLabel = GameObject.Find("Task Label");

        taskLabel.GetComponent <Image>().sprite = taskSprite;
        //spriteR = taskLabel.GetComponent<SpriteRenderer>();
        //spriteR.sprite = taskSprite;
    }
Exemplo n.º 4
0
    // formative function
    public void ChangeHaptic(int option)
    {
        //thisHaptic.DeactivateHaptic();
        //haptic.DeactivateHaptic();
        //haptic.SetEnabled(false);

        switch (option)
        {
        case 1:
            currentHapticType = HapticSquare.HapticType.NOISEHIGH;
            haptic.UpdateHaptics(currentHapticType);
            //haptic.SetEnabled(true);
            Debug.Log(currentHapticType);
            //haptic.ActivateHaptic();
            break;

        case 2:
            currentHapticType = HapticSquare.HapticType.DOTS;
            haptic.UpdateHaptics(currentHapticType);
            //haptic.SetEnabled(true);
            Debug.Log(currentHapticType);
            //haptic.ActivateHaptic();
            break;

        case 3:
            currentHapticType = HapticSquare.HapticType.CHECKERS;
            haptic.UpdateHaptics(currentHapticType);
            //haptic.SetEnabled(true);
            Debug.Log(currentHapticType);
            //haptic.ActivateHaptic();
            break;

        case 4:
            currentHapticType = HapticSquare.HapticType.STRIPEHIGH;
            haptic.UpdateHaptics(currentHapticType);
            //haptic.SetEnabled(true);
            Debug.Log(currentHapticType);
            //haptic.ActivateHaptic();
            break;
        }
    }
Exemplo n.º 5
0
    private void FlowCurrent(string dir, string zoneName)
    {
        string newCurrentHapticType;
        String thisFeel = FeelStripe(touchPosWorldPrev, touchPosWorld, dir);

        if (thisFeel.StartsWith("vertical"))
        {
            if (GlobalVariables.hapticOn)
            {
                haptic.ActivateHaptic();
            }
            newCurrentHapticType = GlobalVariables.currentHapticType;
            haptic.UpdateHaptics(newCurrentHapticType);
            if (!GlobalVariables.hintOn)
            {
                if (thisFeel.EndsWith("clockwise"))
                {
                    thisPlayerLog.AddTouchEvent("Touch Move Clockwise " + zoneName + ", " + dir, touchPosWorld);
                }
                else
                {
                    thisPlayerLog.AddTouchEvent("Touch Move Counter-Clockwise " + zoneName + ", " + dir, touchPosWorld);
                }
            }
        }
        else if (thisFeel.StartsWith("horizontal"))
        {
            if (GlobalVariables.hapticOn)
            {
                haptic.ActivateHaptic();
            }
            newCurrentHapticType = GlobalVariables.currentHapticType + "-horizontal";
            haptic.UpdateHaptics(newCurrentHapticType);
            if (!GlobalVariables.hintOn)
            {
                if (thisFeel.EndsWith("clockwise"))
                {
                    thisPlayerLog.AddTouchEvent("Touch Move Clockwise " + zoneName + ", " + dir, touchPosWorld);
                }
                else
                {
                    thisPlayerLog.AddTouchEvent("Touch Move Counter-Clockwise " + zoneName + ", " + dir, touchPosWorld);
                }
            }
        }
        else //don't feel any texture
        {
            if (!GlobalVariables.formative)
            {
                haptic.DeactivateHaptic();
            }
            else if (GlobalVariables.hapticOn)
            {
                haptic.ActivateHaptic();
            }
            if (!GlobalVariables.hintOn)
            {
                thisPlayerLog.AddTouchEvent("Error Touch Move Clockwise " + zoneName + ", " + dir, touchPosWorld);
            }
            //Debug.Log("moving opposite direction!");
        }
    }