Ejemplo n.º 1
0
        public static CyanEmuObjectHighlight CreateInteractHelper()
        {
            GameObject interact = GameObject.CreatePrimitive(PrimitiveType.Cube);

            interact.name = "Highlight";
            DestroyImmediate(interact.GetComponent <BoxCollider>());
            CyanEmuObjectHighlight highlight = interact.AddComponent <CyanEmuObjectHighlight>();

            highlight.interactHighlight_ = interact.GetComponent <Renderer>();
            highlight.interactHighlight_.sharedMaterial = GetHighlightMaterial();
            return(highlight);
        }
        private void Start()
        {
            highlight_ = CyanEmuObjectHighlight.CreateInteractHelper();
            highlight_.transform.parent = transform;

            // Tool tip text
            toolTip_ = new GameObject("ToolTip");
            toolTip_.transform.parent = transform;
            GameObject child = new GameObject("ToolTipText");

            child.transform.parent        = toolTip_.transform;
            child.transform.localRotation = Quaternion.Euler(0, 180, 0);
            child.transform.localPosition = new Vector3(0, .05f, 0);

            toolTipText_               = child.AddComponent <TextMesh>();
            toolTipText_.anchor        = TextAnchor.LowerCenter;
            toolTipText_.characterSize = 0.01f;
            toolTipText_.fontSize      = 100;
            toolTipText_.text          = "";

            SetEnabled(false);
        }