예제 #1
0
    public override void TASK_START()
    {
        if (!manager)
        {
            Start();
        }
        base.startTask();

        hud.showEverything();
        hud.showScore = showScoring;
        current       = destinations.currentObject();
        Debug.Log("Find " + destinations.currentObject().name);


        if (NavigationInstruction)
        {
            string msg = NavigationInstruction.text;
            if (destinations != null)
            {
                msg = string.Format(msg, current.name);
            }
            hud.setMessage(msg);
        }
        else
        {
            hud.SecondsToShow = 0;
            hud.setMessage("Please find the " + current.name);
        }



        //// MJS 2019 - Move HUD to top left corner
        //hud.hudPanel.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 1);
        //hud.hudPanel.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0.9f);
    }
예제 #2
0
    public override void TASK_START()
    {
        base.startTask();


        if (!manager)
        {
            Start();
        }


        if (skip)
        {
            log.log("INFO	skip task	"+ name, 1);
            return;
        }


        destination = destinations.currentObject();
        source      = sources.currentObject();

        while (source != null && destination != null)
        {
            position = source.transform.position;
            rotation = source.transform.rotation;
            Debug.Log(destination.name.ToString());
            Debug.Log(source.name);


            source.transform.position = destination.transform.position;
            //log.log("TASK_ROTATE\t" + source.name + "\t" + this.GetType().Name + "\t" + source.transform.localEulerAngles.ToString("f1"),1);
            source.transform.localRotation = destination.transform.localRotation;
            //log.log("TASK_POSITION\t" + source.name + "\t" + this.GetType().Name + "\t" + source.transform.position.ToString("f1"),1);

            log.log("Object: \t" + source.name +
                    "\tPosition (xyz): \t" + source.transform.position.x + "\t" + source.transform.position.y + "\t" + source.transform.position.z +
                    "\tRotation (xyz): \t" + source.transform.eulerAngles.x + "\t" + source.transform.eulerAngles.y + "\t" + source.transform.eulerAngles.z
                    , 1);



            if (swap)
            {
                destination.transform.position      = position;
                destination.transform.localRotation = rotation;
            }

            destinations.incrementCurrent();
            destination = destinations.currentObject();

            sources.incrementCurrent();
            source = sources.currentObject();
        }
    }
예제 #3
0
    public override void TASK_START()
    {
        if (!manager)
        {
            Start();
        }
        base.startTask();



        if (skip)
        {
            log.log("INFO    skip task    " + name, 1);
            return;
        }

        GameObject sgo = new GameObject("Instruction Display");

        GameObject avatar = manager.player.GetComponent <HUD>().Canvas as GameObject;
        Text       canvas = avatar.GetComponent <Text>();

        hud.SecondsToShow = hud.InstructionDuration;


        sgo.AddComponent <GUIText>();
        sgo.hideFlags          = HideFlags.HideAndDontSave;
        sgo.transform.position = new Vector3(0, 0, 0);
        gui                = sgo.GetComponent <GUIText>();
        gui.pixelOffset    = new Vector2(20, Screen.height - 20);
        gui.font           = instructionFont;
        gui.fontSize       = instructionSize;
        gui.material.color = text_color;
        gui.text           = message.text;

        if (texts)
        {
            currentText = texts.currentString().Trim();
        }
        if (objects)
        {
            currentObject = objects.currentObject();
        }
        if (instruction)
        {
            canvas.text = instruction.text;
        }
        if (blackout)
        {
            hud.showOnlyHUD();
        }
        if (message)
        {
            string msg = message.text;
            if (currentText != null)
            {
                msg = string.Format(msg, currentText);
            }
            if (currentObject != null)
            {
                msg = string.Format(msg, currentObject.name);
            }
            hud.setMessage(msg);
        }
        hud.flashStatus("");

        if (restrictMovement)
        {
            manager.player.GetComponent <CharacterController>().enabled            = false;
            manager.scaledPlayer.GetComponent <ThirdPersonCharacter>().immobilized = true;
        }

        // Change text and turn on the map action button if we're using it
        if (actionButtonOn)
        {
            // Use custom text for button (if provided)
            if (customButtonText != "")
            {
                actionButton.GetComponentInChildren <Text>().text = customButtonText;
            }
            // Otherwise, use default text attached to the button (component)
            else
            {
                actionButton.GetComponentInChildren <Text>().text = actionButton.GetComponent <DefaultText>().defaultText;
            }

            // activate the button
            hud.actionButton.SetActive(true);
            hud.actionButton.GetComponent <Button>().onClick.AddListener(hud.OnActionClick);

            // make the cursor functional and visible
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = true;
        }

        //---------------------------
        // Confidence Slider
        //---------------------------
        sliderObject = hud.confidenceSlider.gameObject;
        sliderObject.SetActive(true);
        if (vrEnabled)
        {
            vrSlider = sliderObject.GetComponent <LM_vrSlider>();
        }
        else
        {
            slider = sliderObject.GetComponent <Slider>();
        }

        // Reset the value before the trial starts
        if (vrEnabled)
        {
            vrSlider.ResetSliderPosition(randomStartValue);
        }
        else
        {
            if (randomStartValue)
            {
                slider.value = Random.Range(slider.minValue, slider.maxValue);
            }
            else
            {
                slider.value = 0;
            }
        }
    }