Example #1
0
    private void Start()
    {
        if (handUIManager == null)
        {
            var foundObjects = FindObjectsOfType <HandUIManager>();
            if (foundObjects.Length > 0)
            {
                handUIManager = foundObjects[0];
            }
            else
            {
                Debug.LogError("HandUIManager is missing in the scene.");
            }
        }

        if (objectType == ObjectType.Line)
        {
            lineRenderer = GetComponent <LineRenderer>();
        }

        if (objectType == ObjectType.Rect)
        {
            initButtonSize = buttonSize;
        }

        handL = HandUIManager.handLeft;
        handR = HandUIManager.handRight;
    }
Example #2
0
    void Start()
    {
        mr           = GetComponent <MeshRenderer>();
        target       = transform.position;
        initialScale = transform.localScale;

        if (HandUIManager == null)
        {
            var foundObjects = FindObjectsOfType <HandUIManager>();
            if (foundObjects.Length > 0)
            {
                HandUIManager = foundObjects[0];
            }
            else
            {
                Debug.LogError("HandUIManager is missing in the scene.");
            }
        }

        if (whichHand == Chirality.Left)
        {
            hand = HandUIManager.handLeft;
            pg   = HandUIManager.pinchLeft;
        }
        else
        {
            hand = HandUIManager.handRight;
            pg   = HandUIManager.pinchRight;
        }
    }
Example #3
0
 public void Appear(Chirality whichHand)
 {
     self.Show(0, 0.1f);
     currentlyHoveringHand = HandUIManager.GetHand(whichHand);
     currentOffset         = whichHand == Chirality.Right ? pinchPointOffsetR : pinchPointOffsetL;
     shown = true;
 }
Example #4
0
    private void FindComponent()
    {
        switch (objectType)
        {
        case ObjectType.Mesh:
            mesh = GetComponent <MeshRenderer>();
            break;

        case ObjectType.Line:
            line = GetComponent <LineRenderer>();
            break;

        case ObjectType.Sprite:
            sprite = GetComponent <SpriteRenderer>();
            break;

        case ObjectType.Image:
            image = GetComponent <Image>();
            break;

        case ObjectType.Text:
            text = GetComponent <TextMeshPro>();
            break;

        case ObjectType.Auto:
            HandUIManager.Warn("UIEntity color component not found, try setting the object type value", this);
            break;
        }
    }
Example #5
0
    public void SetColor(float a, float t = 0.15f)
    {
        var c = HandUIManager.GetColor(a);

        if (useCustomColor)
        {
            c   = overrideTint;
            c.a = a;
        }

        if (!renderComponentFound)
        {
            DetermineType();
        }

        switch (objectType)
        {
        case ObjectType.Mesh:
            if (mesh.material.HasProperty("_Color"))
            {
                mesh.material.DOColor(c, t);
            }
            else
            {
                mesh.material.SetColor("_TintColor", c);
            }
            break;

        case ObjectType.Line:
            if (line.material.HasProperty("_Color"))
            {
                line.material.DOColor(c, t);
            }
            else if (line.material.HasProperty("_TintColor"))
            {
                line.material.SetColor("_TintColor", c);
            }
            break;

        case ObjectType.Sprite:
            sprite.DOColor(c, t);
            break;

        case ObjectType.Image:
            image.DOColor(c, t);
            break;

        case ObjectType.Text:
            if (!guiText)
            {
                text.DOColor(c, t);
            }
            else
            {
                textGUI.DOColor(c, t);
            }
            break;
        }
    }
Example #6
0
    //--------------------------------------------------

    //--------------------------------------------------
    public void TunnelSliceScanComplete()
    //--------------------------------------------------
    {
        tunnelScanCompleted = true;

        HandUIManager handUI = m_scientistPlayer.GetComponentInChildren <HandUIManager>();

        handUI.SwitchHandUI(HandUIManager.HandUI.DATA_SELECTOR);
    }
Example #7
0
    private void OnEnable()
    {
        hand  = HandUIManager.GetHand(whichHand);
        pinch = HandUIManager.GetPinchGesture(whichHand);
        self  = GetComponent <UIEntity>();

        hrt = keyboardPlane.GetComponent <HandRaycastTarget>();

        pinch.OnOpen += OnPinch;
        self.Hide(0, 0.05f);
    }
Example #8
0
    public void SpawnKeyboard()
    {
        transform.localScale = Vector3.zero;

        transform.position = HandUIManager.PostitionInFrontOfHead(spawnOffset.z, spawnOffset.y);
        transform.LookAt(transform.position - (HandUIManager.head.position - transform.position));
        transform.eulerAngles = Vector3.up * transform.eulerAngles.y;

        self.Scale(1);

//		Vector3 newPos = HandUIManager.PostitionInFrontOfHead() ;
    }
Example #9
0
    void OnEnable()
    {
        handUI = transform.GetComponent <HandUIObject>();
        if (handUI == null)
        {
            HandUIManager.Warn("HandUIItem couldn't find HandUIObject!", this);
        }

        handUI.OnHoverBegin += OnHoverBegin;
        handUI.OnHoverEnd   += OnHoverEnd;
        handUI.OnPinchBegin += OnPinchBegin;
        handUI.OnPinchEnd   += OnPinchEnd;
    }
Example #10
0
    void Start()
    {
        initScale = transform.localScale;
        circle    = GetComponent <CircleLine>();
        hand      = HandUIManager.GetHand(whichHand);
        uiColor   = GetComponent <UIColor>();

        minY = transform.localPosition.y;

        if (this.enabled)
        {
            Hide();
        }
    }
Example #11
0
    private void Start()
    {
        head = HandUIManager.head;

        hand = HandUIManager.GetHand(whichHand);
        pg   = HandUIManager.GetPinchGesture(whichHand);

        // AirTap init, getting index and wrist postions
        fPos     = hand.leapHand.GetIndex().TipPosition.ToVector3();
        fPrevPos = fPos;

        wPos     = hand.leapHand.WristPosition.ToVector3();
        wPrevPos = wPos;
    }
Example #12
0
    public void SetColor(float a, float t = 0.15f)
    {
        var c = HandUIManager.GetColor(a);

        if (useCustomColor)
        {
            c   = customColor;
            c.a = a;
        }

        if (!componentFound)
        {
            FindComponent();
        }

        switch (objectType)
        {
        case ObjectType.Mesh:
            if (mesh.material.HasProperty("_Color"))
            {
                mesh.material.DOColor(c, t).SetId("");
            }
            else
            {
                mesh.material.SetColor("_TintColor", c);
            }
            break;

        case ObjectType.Line:
            if (line.material.HasProperty("_Color"))
            {
                line.material.DOColor(c, t);
            }
            else if (line.material.HasProperty("_TintColor"))
            {
                line.material.SetColor("_TintColor", c);
            }
            break;

        case ObjectType.Sprite:
            sprite.DOColor(c, t);
            break;

        case ObjectType.Text:
            text.DOColor(c, t);
            break;
        }
    }
Example #13
0
    // Use this for initialization
    void Start()
    {
        line      = GetComponentInChildren <LineProjector>();
        lineColor = line.transform.GetComponent <UIColor>();
        pg        = HandUIManager.GetPinchGesture(whichHand);
        hand      = whichHand == Chirality.Left ? HandUIManager.handLeft : HandUIManager.handRight;

        projector      = GetComponentInChildren <Projector>();
        projectorColor = projector.transform.GetComponent <UIColor>();

        initSphereParentScale = sphere.parent.localScale;

        CalculateBounds();

        HideSphere();
    }
Example #14
0
    void Start()
    {
        line = GetComponent <LineRenderer>();
        if (transform.parent.GetComponent <HandRaycast>())
        {
            hr   = transform.parent.GetComponent <HandRaycast>();
            hand = HandUIManager.GetHand(hr.whichHand);
        }
        else
        {
            HandUIManager.Warn("HandRaycast not found", this);
        }

        DimDown();
        Hide();
    }
Example #15
0
    //--------------------------------------------------

    //--------------------------------------------------
    private IEnumerator IE_LoadingData()
    //--------------------------------------------------
    {
        //Debug.Log("Loading data...");

        currentGameState = GameState.LOADING;

        HandUIManager handUI = m_scientistPlayer.GetComponentInChildren <HandUIManager>();

        handUI.SetLoadingText("Loading data...");
        handUI.SwitchHandUI(HandUIManager.HandUI.LOADING);

        while (!m_dataManager.DataLoaded())
        {
            yield return(null);
        }

        //Debug.Log("Data loaded successfully!");
        handUI.SwitchHandUI(HandUIManager.HandUI.MAIN_MENU);
        OnLoadMapIntializer();
    }
Example #16
0
 public static Vector3 stablePinchPos(this InteractionHand hand)
 {
     return(HandUIManager.GetPinchGesture(hand.chirality()).stablePinch.position);
 }
Example #17
0
 public static bool isPinched(this InteractionHand hand)
 {
     return(HandUIManager.GetPinchGesture(hand.chirality()).isActive&& hand.isTracked);
 }
Example #18
0
 public static Transform stablePinchTransform(this InteractionHand hand)
 {
     return(HandUIManager.GetPinchGesture(hand.chirality()).stablePinch);
 }
Example #19
0
 private void Start()
 {
     hand = HandUIManager.GetHand(whichHand);
     Hide();
 }