Exemplo n.º 1
0
    public bool Grab(Grabbable dude)
    {
        if (!GameManager.GameStart || GameManager.GameOver)
        {
            return(false);
        }
        AnimationController.SetBool("Grabbed", true);

        if (Grabbed != null || !dude)
        {
            return(false);
        }

        Grabbed = dude;
        foreach (var col in Grabbed.GetComponentsInChildren <Collider>())
        {
            col.enabled = false;
        }

        Grabbed.transform.position = GrabPoint.position;
        Grabbed.transform.rotation = GrabPoint.rotation;
        Grabbed.transform.SetParent(GrabPoint);
        Grabbed.Grab();

        SteamVR_Controller.Input((int)_controller.controllerIndex).TriggerHapticPulse(3000);
        return(true);
    }
Exemplo n.º 2
0
    void SetColliders(bool isEnabled)
    {
        List <Collider> disabledColliders = iteamReadyToSnap.GetComponentsInChildren <Collider>(false).ToList();

        for (int x = 0; x < disabledColliders.Count; x++)
        {
            Collider c = disabledColliders[x];
            c.enabled = isEnabled;
        }

        iteamReadyToSnap.enabled = isEnabled;
    }
Exemplo n.º 3
0
    void UpdateInformations()
    {
        int id = 0;
        List <GrabbableInformation> newGiList = new List <GrabbableInformation>();

        foreach (GrabbableInformation gi in grabbable.GetComponentsInChildren <GrabbableInformation>())
        {
            newGiList.Add(gi);
            gi.name = "GrabbableInformation[" + id + "]";
            gi.id   = id;
            id++;
        }
        grabbable.grabbableInformation = newGiList;
    }