Пример #1
0
        private void DoButtonOneTouchStart(object sender, ControllerInteractionEventArgs e)
        {
            VRTK_InteractGrab gr = GameObject.Find("RightControllerScriptAlias").GetComponent("VRTK_InteractGrab") as VRTK_InteractGrab;

            if (gr.GetGrabbedObject() != null)
            {
                Leaveblower lc = gr.GetGrabbedObject().GetComponent("Leaveblower") as Leaveblower;
                if (lc != null && ammoContainer.ammo > 0)
                {
                    lc.Shoot();
                }

                CoconutLoader bc = gr.GetGrabbedObject().GetComponent <CoconutLoader>();
                Debug.Log(gr.GetGrabbedObject().name);
                if (bc != null)
                {
                    bc.loadAmmo();
                }

                BirdController x = gr.GetGrabbedObject().GetComponent <BirdController>();
                Debug.Log(gr.GetGrabbedObject().name);
                if (x != null)
                {
                    x.loadAmmo();
                }
            }
        }
Пример #2
0
    public void loadAmmo()
    {
        Leaveblower lf    = GameObject.Find("Leaveblower").GetComponent("Leaveblower") as Leaveblower;
        Vector3     lbpos = GameObject.Find("Leaveblower").transform.position;
        float       dis   = Vector3.Magnitude(lbpos - transform.position);

        if (dis < 2)
        {
            lf.Load();
            //PhotonNetwork.RaiseEvent(0, this.gameObject.GetPhotonView().viewID, true, null);
            PhotonNetwork.Destroy(this.gameObject);
        }
    }
Пример #3
0
        private void DoTouchpadPressed(object sender, ControllerInteractionEventArgs e)
        {
            VRTK_InteractGrab gr = GameObject.Find("RightControllerScriptAlias").GetComponent("VRTK_InteractGrab") as VRTK_InteractGrab;

            if (gr.GetGrabbedObject() != null)
            {
                Leaveblower lc = gr.GetGrabbedObject().GetComponent("Leaveblower") as Leaveblower;

                if (lc != null)
                {
                    lc.Shoot();
                }
            }
        }