Esempio n. 1
0
    //--------------------------------------------------------------------------------------------------------------------------
    // Collision Detection / Force Feedback

    // Called when this object enters the collider of another object
    protected virtual void OnTriggerEnter(Collider col)
    {
        SenseGlove_Interactable interact = col.attachedRigidbody != null?col.attachedRigidbody.GetComponent <SenseGlove_Interactable>()
                                               : col.GetComponent <SenseGlove_Interactable>();

        if (interact != null)
        {
            interact.TouchedBy(this);
            if (this.touchedObject == null)
            {
                //if (!this.IsTouching(col.gameObject))
                //{
                //    //touching a new object!
                //}
                this.touchedObject = interact.gameObject;
                this.touchedScript = interact;
                if (this.touchedObject.transform.parent != null)
                {
                    if (this.touchedObject.transform.parent.name == "Tastatur" && this.name == "indexPickupCollider")
                    {
                        this.transform.root.GetComponent <SenseGlove_Object>().SendBuzzCmd(new bool[5] {
                            false, true, false, false, false
                        }, 100, 50);
                        GlobalCtrl text = this.transform.root.GetComponent <GlobalCtrl>();
                        text.textChange(this.touchedObject);
                    }
                    else if (this.touchedObject.transform.parent.name == "GUILoad" && this.name == "indexPickupCollider")
                    {
                        this.transform.root.GetComponent <SenseGlove_Object>().SendBuzzCmd(new bool[5] {
                            false, true, false, false, false
                        }, 100, 50);

                        if (this.touchedObject.name == "Down")
                        {
                            GlobalCtrl.updown += 1;
                        }
                        else if (this.touchedObject.name == "Up" && GlobalCtrl.updown >= 1)
                        {
                            GlobalCtrl.updown -= 1;
                        }
                        else if (this.touchedObject.name.StartsWith("Platz"))
                        {
                            List <atomData> loadFile = new List <atomData>();
                            loadFile = (List <atomData>)CFileHelper.LoadData(Application.dataPath + "/MoleculeFiles/" + touchedObject.transform.GetChild(0).GetComponent <Text>().text, typeof(List <atomData>));
                            this.transform.root.GetComponent <GlobalCtrl>().loadMolecule(loadFile);
                        }
                        else if (this.touchedObject.name == "ExitLoadGui")
                        {
                            GlobalCtrl.loadGUI = false;
                            GameObject.Find("GUILoad").SetActive(false);
                            molecule.SetActive(true);
                        }
                    }
                }
            }
        }
    }
Esempio n. 2
0
    //--------------------------------------------------------------------------------------------------------------------------
    // Collision Detection / Force Feedback

    // Called when this object enters the collider of another object
    protected virtual void OnTriggerEnter(Collider col)
    {
        SenseGlove_Interactable interact = col.attachedRigidbody != null?col.attachedRigidbody.GetComponent <SenseGlove_Interactable>()
                                               : col.GetComponent <SenseGlove_Interactable>();

        if (interact != null)
        {
            interact.TouchedBy(this);
            if (this.touchedObject == null)
            {
                //if (!this.IsTouching(col.gameObject))
                //{
                //    //touching a new object!
                //}
                this.touchedObject = interact.gameObject;
                this.touchedScript = interact;
            }
        }
    }