public void Start()
    {
        foreach (Ingredient ingredient in RecipeController.instance.allIngredients)
        {
            if (ingredient.name == name)
            {
                correspondingIngredient = ingredient;
                break;
            }
        }

        GameObject tooltipObject = GameObject.Instantiate(RecipeController.instance.tooltipPrefab) as GameObject;

        tooltipObject.transform.parent     = this.gameObject.transform;
        tooltipObject.transform.localScale = new Vector3(5.0f, 5.0f, 5.0f);

        tooltipObject.transform.localPosition = (Vector3.up / tooltipObject.transform.localScale.y);

        Debug.LogWarning("Local position is " + tooltipObject.transform.localPosition);



        tooltip = tooltipObject.GetComponent <VRTK.VRTK_ObjectTooltip>();

        tooltip.displayText = correspondingIngredient.translatedName;
        tooltip.drawLineTo  = this.gameObject.transform;
        tooltip.gameObject.SetActive(false);
    }
Beispiel #2
0
 public void Awake()
 {
     if (LevelManager.Instance.settings == null)
     {
         Debug.Log("Creating new settings for LevelManager");
         LevelManager.Instance.settings = new LevelSettings();
     }
     gameModeLabel        = GameObject.Find("gameModeLabel").GetComponent <VRTK.VRTK_ObjectTooltip>();
     customerCountLabel   = GameObject.Find("customerCountLabel").GetComponent <VRTK.VRTK_ObjectTooltip>();
     difficultyLevelLabel = GameObject.Find("difficultyLevelLabel").GetComponent <VRTK.VRTK_ObjectTooltip>();
     UpdateLabels();
 }
Beispiel #3
0
    public void init()
    {
        GameObject tooltipObject = GameObject.Instantiate(RecipeController.instance.tooltipPrefab) as GameObject;

        tooltipObject.transform.parent     = this.gameObject.transform;
        tooltipObject.transform.localScale = new Vector3(5.0f, 5.0f, 5.0f);

        tooltipObject.transform.localPosition = (Vector3.up / tooltipObject.transform.localScale.y);

        Debug.LogWarning("Local position is " + tooltipObject.transform.localPosition);

        tooltip = tooltipObject.GetComponent <VRTK.VRTK_ObjectTooltip>();

        tooltip.displayText = GetComponent <FinishedFood>().foodRecipe.name;
        tooltip.drawLineTo  = this.gameObject.transform;
        tooltip.gameObject.SetActive(false);
    }
        protected virtual void InitialiseTips()
        {
            bool initComplete = false;

            VRTK_ObjectTooltip[] tooltips = GetComponentsInChildren <VRTK_ObjectTooltip>(true);
            for (int i = 0; i < tooltips.Length; i++)
            {
                VRTK_ObjectTooltip tooltip      = tooltips[i];
                string             tipText      = "";
                Transform          tipTransform = null;

                switch (tooltip.name.Replace("Tooltip", "").ToLower())
                {
                case "trigger":
                    tipText      = triggerText;
                    tipTransform = GetTransform(trigger, SDK_BaseController.ControllerElements.Trigger);
                    break;

                case "grip":
                    tipText      = gripText;
                    tipTransform = GetTransform(grip, SDK_BaseController.ControllerElements.GripLeft);
                    break;

                case "touchpad":
                    tipText      = touchpadText;
                    tipTransform = GetTransform(touchpad, SDK_BaseController.ControllerElements.Touchpad);
                    break;

                case "buttonone":
                    tipText      = buttonOneText;
                    tipTransform = GetTransform(buttonOne, SDK_BaseController.ControllerElements.ButtonOne);
                    break;

                case "buttontwo":
                    tipText      = buttonTwoText;
                    tipTransform = GetTransform(buttonTwo, SDK_BaseController.ControllerElements.ButtonTwo);
                    break;

                case "startmenu":
                    tipText      = startMenuText;
                    tipTransform = GetTransform(startMenu, SDK_BaseController.ControllerElements.StartMenu);
                    break;
                }

                initComplete = (tipTransform != null);

                tooltip.displayText = tipText;
                tooltip.drawLineTo  = tipTransform;

                tooltip.containerColor = tipBackgroundColor;
                tooltip.fontColor      = tipTextColor;
                tooltip.lineColor      = tipLineColor;

                tooltip.ResetTooltip();

                if (tipTransform == null || tipText.Trim().Length == 0)
                {
                    tooltip.gameObject.SetActive(false);
                }
            }

            if (!initComplete && retryInitCurrentTries > 0)
            {
                retryInitCurrentTries--;
                Invoke("ResetTooltip", retryInitCounter);
                return;
            }

            if (!hideWhenNotInView)
            {
                ToggleTips(true);
            }
        }
 // Use this for initialization
 void Start()
 {
     link = GetComponent <VRTK.VRTK_ObjectTooltip>();
     //link.displayText = prependText + "4000m/s";// speed.magnitude.ToString();
 }