コード例 #1
0
    public override void Grabbed(VRTK_InteractGrab currentGrabbingObject)
    {
        base.Grabbed(currentGrabbingObject);

        slideCollider.enabled = true;

        if (ammoTooltipGameObject != null)
        {
            ammoTooltipGameObject.SetActive(true);
        }

        if (ammoTooltip != null)
        {
            ammoTooltip.UpdateText(bulletsLeftInClip + " / " + bulletClipSize);
        }

        controllerEvents = currentGrabbingObject.GetComponent <VRTK_ControllerEvents>();

        ToggleSlide(true);

        slide.reloadAction += Reloaded;

        if (VRTK_DeviceFinder.GetControllerHand(currentGrabbingObject.controllerEvents.gameObject) == SDK_BaseController.ControllerHand.Left)
        {
            allowedTouchControllers      = AllowedController.LeftOnly;
            allowedUseControllers        = AllowedController.LeftOnly;
            slide.allowedGrabControllers = AllowedController.RightOnly;
        }
        else if (VRTK_DeviceFinder.GetControllerHand(currentGrabbingObject.controllerEvents.gameObject) == SDK_BaseController.ControllerHand.Right)
        {
            allowedTouchControllers      = AllowedController.RightOnly;
            allowedUseControllers        = AllowedController.RightOnly;
            slide.allowedGrabControllers = AllowedController.LeftOnly;
        }
    }
コード例 #2
0
    void textUpdater(int moleculeIndex)
    {
        switch (moleculeIndex)
        {
        case 0:
            tooltip_1.UpdateText("Ethanol");
            tooltip_2.UpdateText("Ethanol");
            break;

        case 1:
            tooltip_1.UpdateText("Water");
            tooltip_2.UpdateText("Water");
            break;
        }
    }
コード例 #3
0
    public void OnTriggerEnter(Collider other)
    {
        Tooltip.containerColor.a = 255;
        Tooltip.UpdateText(textAffichage);                         //on affiche les informations
        Parent      = transform.root.gameObject;                   //on recupère le gameobject parent dans la hierarchie
        allChildren = Parent.GetComponentsInChildren <Renderer>(); //Récupération des objets du modele


        if (tag == "Highlight")
        {
            tag = "Origin";                              //tag l'objet d'origin
            for (int i = 0; i < allChildren.Length; i++) //On parcours tout les objects du modèle
            {
                if (allChildren[i].tag != "Origin")      //Si ce n'est pas l'origine on le rend transparent
                {
                    allChildren[i].material = TransparentMaterial;
                }
                if (allChildren[i].tag == "Origin")//Si c'est l'origine on lui rend son material de base.
                {
                    allChildren[i].material = this.OriginMaterial;
                }
            }
            tag = "Highlight";//on remet le bon tag
        }
    }
コード例 #4
0
 public void ShowTooltip(string text, float duration)
 {
     m_duration = duration > 0 ? duration : float.PositiveInfinity;
     m_objectTooltip.gameObject.SetActive(true);
     m_objectTooltip.UpdateText(text);
     m_tooltipActivatedTime = Time.time;
 }
コード例 #5
0
    public void CorrectAnswer()
    {
        //flash dark green and black Tick

        // switch to Colour green
        toolTipOfObject.containerColor = Color.green;

        //Change name
        toolTipOfObject.UpdateText(PreferedName);



        // play ding

        //
        //add score

        // add from score
        GameController.SavedTime += TimeAddedForCorrectAnswer;

        // remove object from the controller
        GameController.Unanwsered.Remove(this.gameObject);

        // disable
        //transformVRTK_InteractableObject
        SphereVRTKController.disableWhenIdle = false;
        SphereVRTKController.enabled         = false;
    }
コード例 #6
0
 protected virtual void Awake()
 {
     tooltipScript             = GetComponent <VRTK_ObjectTooltip>();
     tooltipScript.displayText = transform.parent.name;
     tooltipScript.UpdateText(transform.parent.name);
 }