Beispiel #1
0
 private void Update()
 {
     if (NRInput.GetButtonDown(ControllerButton.HOME) && ARCinimaScene.isActive)
     {
         OnCancel();
     }
 }
Beispiel #2
0
 private void Update()
 {
     if (NRInput.GetButtonDown(ControllerButton.HOME))
     {
         GoToMainScene();
     }
 }
Beispiel #3
0
 private void Update()
 {
     if (NRInput.GetButtonDown(ControllerButton.HOME) && !Key.Equals("cinima") && isActive)
     {
         SceneSwitchManager.Instance.GoToMainScene();
     }
 }
Beispiel #4
0
        void Update()
        {
            // If the player doesn't click the trigger button, we are done with this update.
            if (!NRInput.GetButtonDown(ControllerButton.TRIGGER))
            {
                return;
            }

            //code to Instantiate multiple Andy Models


            // Get controller laser origin.
            Transform laserAnchor = NRInput.AnchorsHelper.GetAnchor(ControllerAnchorEnum.RightLaserAnchor);

            RaycastHit hitResult;

            if (Physics.Raycast(new Ray(laserAnchor.transform.position, laserAnchor.transform.forward), out hitResult, 10))
            {
                if (hitResult.collider.gameObject != null && hitResult.collider.gameObject.GetComponent <NRTrackableBehaviour>() != null)
                {
                    var behaviour = hitResult.collider.gameObject.GetComponent <NRTrackableBehaviour>();
                    if (behaviour.Trackable.GetTrackableType() != TrackableType.TRACKABLE_PLANE)
                    {
                        return;
                    }

                    // Instantiate Andy model at the hit point / compensate for the hit point rotation.
                    //Instantiate(AndyPlanePrefab, hitResult.point, Quaternion.identity, behaviour.transform);
                    //Debug.Log(hitResult.point.ToString());

                    //code to Instantiate multiple Andy Models
                }
            }
        }
Beispiel #5
0
    void Update()
    {
        #region PlayersTurnNr Logic
        //Player has to press trigger button to go on
        if (!NRInput.GetButtonDown(ControllerButton.TRIGGER))
        {
            return;
        }

        //Must have 2 players in room
        if (PhotonNetwork.PlayerList.Length < 2)
        {
            return;
        }

        //Must be players turn
        if (PhotonNetwork.LocalPlayer.ActorNumber != PlayerInPlay)
        {
            return;
        }
        #endregion PlayersTurnNr Logic

        #region Select GameField
        // Get controller laser origin.
        Transform laserAnchor = NRInput.AnchorsHelper.GetAnchor(NRInput.RaycastMode == RaycastModeEnum.Gaze ? ControllerAnchorEnum.GazePoseTrackerAnchor : ControllerAnchorEnum.RightLaserAnchor);
        //Ray ray;
        if (Physics.Raycast(new Ray(laserAnchor.transform.position, laserAnchor.transform.forward), out hit, 20))
        {
            photonView.RPC("exoh_prefab", RpcTarget.All, hit.transform.position, Quaternion.identity, hit.transform.name);
        }
        #endregion Select GameField
    }
 private void Update()
 {
     if (NRInput.GetButtonDown(ControllerButton.HOME))
     {
         OnCancel();
     }
 }
Beispiel #7
0
        private void Update()
        {
            if ((NRInput.GetButtonDown(ControllerButton.APP) || Input.GetKeyDown(KeyCode.Q)) && m_IsInTest)
            {
                BackToMainPage();
            }

            if (Input.GetKeyDown(KeyCode.S))
            {
                JumpTo(TestType.Slam);
            }
            if (Input.GetKeyDown(KeyCode.P))
            {
                JumpTo(TestType.Plane);
            }
            if (Input.GetKeyDown(KeyCode.M))
            {
                JumpTo(TestType.Marker);
            }
            if (Input.GetKeyDown(KeyCode.O))
            {
                JumpTo(TestType.M2p);
            }
            if (Input.GetKeyDown(KeyCode.N))
            {
                JumpTo(TestType.SingleMarker);
            }
        }
Beispiel #8
0
        private void Update()
        {
            if (NRInput.GetButtonDown(ControllerButton.HOME) || Input.GetKeyDown(KeyCode.R))
            {
                NRSessionManager.Instance.Recenter();
            }

            CheckQuit();
        }
Beispiel #9
0
 private void PrintInputState()
 {
     Debug.LogFormat("istouching:{0} getbutton app:{1} trigger:{2} home:{3} \n" +
                     "getbuttondown app:{4} trigger:{5} home:{6} \n" +
                     "getbuttonup app:{7} trigger:{8} home:{9} \n" +
                     "origin touch:[{10}] gettouch:{11}", NRInput.IsTouching(), NRInput.GetButton(ControllerButton.APP), NRInput.GetButton(ControllerButton.TRIGGER), NRInput.GetButton(ControllerButton.HOME)
                     , NRInput.GetButtonDown(ControllerButton.APP), NRInput.GetButtonDown(ControllerButton.TRIGGER), NRInput.GetButtonDown(ControllerButton.HOME)
                     , NRInput.GetButtonUp(ControllerButton.APP), NRInput.GetButtonUp(ControllerButton.TRIGGER), NRInput.GetButtonUp(ControllerButton.HOME)
                     , NRVirtualDisplayer.SystemButtonState.ToString(), NRInput.GetTouch(m_CurrentDebugHand).ToString("F3"));
 }
        private void Update()
        {
            if (Input.GetKeyDown(KeyCode.Space) || NRInput.GetButtonDown(ControllerButton.APP))
            {
                PreviewScreen.gameObject.SetActive(!PreviewScreen.gameObject.activeInHierarchy);

                NRInput.LaserVisualActive   = !PreviewScreen.gameObject.activeInHierarchy;
                NRInput.ReticleVisualActive = !PreviewScreen.gameObject.activeInHierarchy;
            }
            this.BindPreviewTOController();
        }
Beispiel #11
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.R) || NRInput.GetButtonDown(ControllerButton.TRIGGER))
        {
            Recorder.StartRecord();
        }

        if (Input.GetKeyDown(KeyCode.T) || NRInput.GetButtonDown(ControllerButton.HOME))
        {
            Recorder.StopRecord();
        }
    }
        /// <summary> Updates this object. </summary>
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.Space) || NRInput.GetButtonDown(ControllerButton.TRIGGER))
            {
                TakeAPhoto();
            }

            if (m_PhotoCaptureObject != null)
            {
                Previewer.SetData(m_PhotoCaptureObject.PreviewTexture, true);
            }
        }
Beispiel #13
0
        /// <summary> Updates this object. </summary>
        private void Update()
        {
            if (NRInput.GetAvailableControllersCount() < 2)
            {
                m_CurrentDebugHand = NRInput.DomainHand;
            }
            else
            {
                if (NRInput.GetButtonDown(ControllerHandEnum.Right, ControllerButton.TRIGGER))
                {
                    m_CurrentDebugHand = ControllerHandEnum.Right;
                }
                else if (NRInput.GetButtonDown(ControllerHandEnum.Left, ControllerButton.TRIGGER))
                {
                    m_CurrentDebugHand = ControllerHandEnum.Left;
                }
            }

            if (NRInput.GetButtonDown(m_CurrentDebugHand, ControllerButton.TRIGGER))
            {
                AddExtraInfo("trigger_btn_down");
            }

            if (NRInput.GetButtonDown(m_CurrentDebugHand, ControllerButton.HOME))
            {
                AddExtraInfo("home_btn_down");
            }

            if (NRInput.GetButtonDown(m_CurrentDebugHand, ControllerButton.APP))
            {
                AddExtraInfo("app_btn_down");
            }

            if (NRInput.GetButtonUp(m_CurrentDebugHand, ControllerButton.TRIGGER))
            {
                AddExtraInfo("trigger_btn_up");
            }

            if (NRInput.GetButtonUp(m_CurrentDebugHand, ControllerButton.HOME))
            {
                AddExtraInfo("home_btn_up");
            }

            if (NRInput.GetButtonUp(m_CurrentDebugHand, ControllerButton.APP))
            {
                AddExtraInfo("app_btn_up");
            }

            FollowMainCam();
            RefreshInfoTexts();
        }
Beispiel #14
0
        private void Update()
        {
            if (Input.GetKeyDown(KeyCode.Space) || NRInput.GetButtonDown(ControllerButton.APP))
            {
                Root.SetActive(!Root.activeInHierarchy);

                NRInput.LaserVisualActive   = !Root.activeInHierarchy;
                NRInput.ReticleVisualActive = !Root.activeInHierarchy;
            }
            if (isBindToController)
            {
                this.BindPreviewTOController();
            }
        }
Beispiel #15
0
        void Update()
        {
            if (NRInput.GetButtonDown(ControllerButton.TRIGGER))
            {
                RGBCamTexture.Play();
            }

            if (NRInput.GetButtonDown(ControllerButton.HOME))
            {
                RGBCamTexture.Stop();
            }

            FrameCount.text = RGBCamTexture.FrameCount.ToString();
        }
Beispiel #16
0
 /// <summary> Updates this object. </summary>
 private void Update()
 {
     if (NRInput.GetButtonDown(ControllerButton.TRIGGER))
     {
         m_PreviousPos = NRInput.GetTouch();
     }
     else if (NRInput.GetButton(ControllerButton.TRIGGER))
     {
         UpdateScroll();
     }
     else if (NRInput.GetButtonUp(ControllerButton.TRIGGER))
     {
         m_PreviousPos = Vector2.zero;
     }
 }
Beispiel #17
0
 /// <summary> Updates this object. </summary>
 void Update()
 {
     if (vibrationButtons == null || vibrationButtons.Length == 0)
     {
         return;
     }
     for (int i = 0; i < vibrationButtons.Length; i++)
     {
         if (NRInput.GetButtonDown(ControllerHandEnum.Right, vibrationButtons[i]))
         {
             NRInput.TriggerHapticVibration(ControllerHandEnum.Right, vibrationTime);
         }
         if (NRInput.GetButtonDown(ControllerHandEnum.Left, vibrationButtons[i]))
         {
             NRInput.TriggerHapticVibration(ControllerHandEnum.Left, vibrationTime);
         }
     }
 }
        private void Update()
        {
            if (isPlaying)
            {
                currentTime       += Time.deltaTime;
                m_Slider.value     = currentTime * 1000 / (long)m_Player.Info.GetDurationMs();
                m_CurrentTime.text = NRealTool.GetTimeByMSeconds((long)(currentTime * 1000)) + " / " + NRealTool.GetTimeByMSeconds((long)m_Player.Info.GetDurationMs());
            }

            if (Input.GetKeyUp(KeyCode.Space))
            {
                OnPlayBtnClick(null);
            }

            if (NRInput.GetButtonDown(ControllerButton.HOME))
            {
                CancleLock();
            }
        }
Beispiel #19
0
        bool IInputController.IsDown(ButtonType type)
        {
            switch (type)
            {
            case ButtonType.One:
                return(NRInput.GetButtonDown(_inputSettings.One));

            case ButtonType.Two:
                return(NRInput.GetButtonDown(_inputSettings.Two));

            case ButtonType.Three:
                return(NRInput.GetButtonDown(_inputSettings.Three));

            case ButtonType.Four:
                return(NRInput.GetButtonDown(_inputSettings.Four));

            default:
                return(false);
            }
        }
 private void JudgeDrop()
 {
     if (!IsMoveable)
     {
         return;
     }
     if (!IsBeingSelected)
     {
         return;
     }
     if (NRInput.GetButtonDown(ControllerButton.TRIGGER))
     {
         m_TriggerDownTime = Time.time;
         m_TouchDownPos    = NRInput.GetTouch();
     }
     if (NRInput.GetButton(ControllerButton.TRIGGER) && !m_TouchMoved)
     {
         m_TouchMoved = Vector2.Distance(NRInput.GetTouch(), m_TouchDownPos) > JUDGE_TOUCH_MOVED_DISTANCE;
     }
     if (NRInput.GetButtonUp(ControllerButton.TRIGGER))
     {
         if ((Time.time - m_TriggerDownTime) < SelectingRaycaster.clickInterval)
         {
             forceDeselectOnce = true;
         }
         if (NRInput.GetControllerType() == ControllerType.CONTROLLER_TYPE_PHONE && m_TouchMoved)
         {
             forceDeselectOnce = false;
         }
         m_TouchMoved = false;
     }
     else if (NRInput.GetButtonUp(ControllerButton.HOME))
     {
         forceDeselectOnce = true;
     }
     if (forceDeselectOnce)
     {
         forceDeselectOnce = false;
         Deselected();
     }
 }
        void Update()
        {
            if (m_VideoCapture == null)
            {
                return;
            }

            if (Input.GetKeyDown(KeyCode.R) || NRInput.GetButtonDown(ControllerButton.TRIGGER))
            {
                StartVideoCapture();

                Previewer.SetData(m_VideoCapture.PreviewTexture, true);
            }

            if (Input.GetKeyDown(KeyCode.T) || NRInput.GetButtonDown(ControllerButton.HOME))
            {
                StopVideoCapture();

                Previewer.SetData(m_VideoCapture.PreviewTexture, false);
            }
        }
Beispiel #22
0
        private void CheckQuit()
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                QuitApplication();
                return;
            }

#if !UNITY_EDITOR
            if (!hasNRInput)
            {
                if (Input.GetMouseButtonDown(1))
                {
                    QuitApplication();
                }
                return;
            }
#endif

            if (quitLongPressTime == 0f && NRInput.GetButtonDown(ControllerButton.HOME))
            {
                QuitApplication();
                return;
            }

            if (NRInput.GetButton(ControllerButton.HOME))
            {
                quitTimer += Time.deltaTime;
                if (quitTimer > quitLongPressTime)
                {
                    quitTimer = 0f;
                    QuitApplication();
                }
            }
            else
            {
                quitTimer = 0f;
            }
        }
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.T) || NRInput.GetButtonDown(ControllerButton.TRIGGER))
            {
                TakeAPhoto();
            }

            if (Input.GetKeyDown(KeyCode.Q) || NRInput.GetButtonDown(ControllerButton.HOME))
            {
                Close();
            }

            if (Input.GetKeyDown(KeyCode.O) || NRInput.GetButtonDown(ControllerButton.APP))
            {
                Create();
            }

            if (photoCaptureObject != null)
            {
                Previewer.SetData(photoCaptureObject.CaptureBehaviour.PreviewTexture, true);
            }
        }
Beispiel #24
0
        private void Update()
        {
            if (NRInput.GetButtonDown(ControllerButton.TRIGGER))
            {
                NRInput.TriggerHapticVibration(0.5f);
                AddExtraInfo("trigger_btn_down");
            }

            if (NRInput.GetButtonDown(ControllerButton.HOME))
            {
                AddExtraInfo("home_btn_down");
            }

            if (NRInput.GetButtonDown(ControllerButton.APP))
            {
                AddExtraInfo("app_btn_down");
            }

            if (NRInput.GetButtonUp(ControllerButton.TRIGGER))
            {
                AddExtraInfo("trigger_btn_up");
            }

            if (NRInput.GetButtonUp(ControllerButton.HOME))
            {
                AddExtraInfo("home_btn_up");
            }

            if (NRInput.GetButtonUp(ControllerButton.APP))
            {
                AddExtraInfo("app_btn_up");
            }

            FollowMainCam();
            RefreshInfoTexts();
        }
Beispiel #25
0
        private void Update()
        {
            brain1 = GameObject.Find("Brain");
            solar  = GameObject.Find("Rotate");
            var rotate = solar.GetComponent <Button>();
            var button = brain1.GetComponent <Button>();

            //  var button2 =
            button.onClick.AddListener(() => {
                if (brn == false)
                {
                    brn            = true;
                    brnenum        = brnlist.Brain2;
                    brainText.text = "Brain 2";
                }
                else
                {
                    brn            = false;
                    brnenum        = brnlist.Brain1;
                    brainText.text = "Brain 1";
                }
            });

            rotate.onClick.AddListener(() => {
                if (controlZoom == false)
                {
                    controlZoom     = true;
                    buttonText.text = "Zoom";
                }
                else
                {
                    controlZoom     = false;
                    buttonText.text = "Rotate";
                }
            });

            switch (brnenum)
            {
            case brnlist.Brain1:
                brain1.SetActive(true);
                brain2.SetActive(false);
                break;

            case brnlist.Brain2:
                brain1.SetActive(false);
                brain2.SetActive(true);
                break;
            }
            if (NRInput.GetButtonDown(ControllerButton.TRIGGER))
            {
                m_PreviousPos = NRInput.GetTouch();
            }
            else if (NRInput.GetButton(ControllerButton.TRIGGER))
            {
                UpdateScroll();
            }
            else if (NRInput.GetButtonUp(ControllerButton.TRIGGER))
            {
                m_PreviousPos = Vector2.zero;
            }
        }
    // Update is called once per frame
    void Update()
    {
        // コントローラ(左手右手)情報の取得
        // 複数のコントローラを使用している場合、使用したコントローラを判断するための処理。
        // 今後のハンドジェスチャーを見越しての処理か?
        if (NRInput.GetAvailableControllersCount() < 2)
        {
            m_CurrentDebugHand = NRInput.DomainHand;
        }
        else
        {
            if (NRInput.GetButtonDown(ControllerHandEnum.Right, ControllerButton.TRIGGER))
            {
                m_CurrentDebugHand = ControllerHandEnum.Right;
            }
            else if (NRInput.GetButtonDown(ControllerHandEnum.Left, ControllerButton.TRIGGER))
            {
                m_CurrentDebugHand = ControllerHandEnum.Left;
            }
        }

        // Trigger以外のボタン動作をハンドリングするにはIPointerDownHandlerではなく、Updateでハンドリングする
        // Triggerだけで良ければIPointerDownHandler/IPointerUpHandlerで実装するほうが良い
        if (NRInput.GetButtonDown(this.m_CurrentDebugHand, ControllerButton.APP))
        {
            this.director.WriteLog("OnPointerDown_APP");
            this.currentDownButton = ControllerButton.APP;

            if (this.unityChanEnterState)
            {
                GetComponent <Animator>().SetTrigger("doJump");
            }
        }
        else
        if (NRInput.GetButtonDown(this.m_CurrentDebugHand, ControllerButton.TRIGGER))
        {
            this.director.WriteLog("OnPointerDown_TRIGGER");
            this.currentDownButton = ControllerButton.TRIGGER;
        }
        else
        if (NRInput.GetButtonDown(this.m_CurrentDebugHand, ControllerButton.GRIP))
        {
            this.director.WriteLog("OnPointerDown_GRID");
            this.currentDownButton = ControllerButton.GRIP;
        }
        else
        if (NRInput.GetButtonDown(this.m_CurrentDebugHand, ControllerButton.HOME))
        {
            this.director.WriteLog("OnPointerDown_HOME");
            this.currentDownButton = ControllerButton.HOME;
        }
        else
        if (NRInput.GetButtonDown(this.m_CurrentDebugHand, ControllerButton.TOUCHPAD_BUTTON))
        {
            this.director.WriteLog("OnPointerDown_TOUCHPAD_BUTTON");
            this.currentDownButton = ControllerButton.TOUCHPAD_BUTTON;
        }

        if (NRInput.GetButtonUp(this.m_CurrentDebugHand, ControllerButton.APP) ||
            NRInput.GetButtonUp(this.m_CurrentDebugHand, ControllerButton.TRIGGER) ||
            NRInput.GetButtonUp(this.m_CurrentDebugHand, ControllerButton.GRIP) ||
            NRInput.GetButtonUp(this.m_CurrentDebugHand, ControllerButton.HOME) ||
            NRInput.GetButtonUp(this.m_CurrentDebugHand, ControllerButton.TOUCHPAD_BUTTON))
        {
            this.director.WriteLog("OnPointerUp_all");
            this.currentDownButton = 0;
        }
    }
Beispiel #27
0
    // Update is called once per frame
    void Update()
    {
        if (staticStuff.score > 0)
        {
            score            += staticStuff.score * 10;
            staticStuff.score = 0;
        }

        if (staticStuff.ammo > 0)
        {
            bullets         += staticStuff.ammo * 10;
            staticStuff.ammo = 0;
        }
        if (staticStuff.carHealth < 0)
        {
            staticStuff.carHealth = 0;
        }
        // Update the score
        if (reloading > 0)
        {
            text.text = "Score : " + score + "\nHealth : " + Math.Round(staticStuff.carHealth, 1) + "\nAmmo : Reloading/" + bullets;
        }
        else
        {
            text.text = "Score : " + score + "\nHealth : " + Math.Round(staticStuff.carHealth, 1) + "\nAmmo : " + clip + "/" + bullets;
        }

        if (staticStuff.gameOver)
        {
            if (countdown > 0)
            {
                countdown--;
            }
            text.text    = "";
            endText.text = "Game Over!\nScore:" + score + "\nRestarting in " + Math.Ceiling((double)(countdown / 100) + 1) + "...";
            if (countdown <= 0)
            {
                staticStuff.carHealth = staticStuff.maxCarHealth;
                staticStuff.score     = 0;
                staticStuff.ammo      = 0;
                staticStuff.zombieNum = 0;
                staticStuff.gameOver  = false;
                countdown             = 300;
                clip    = 10;
                bullets = 20;
                //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); This works on laptop but crashed on nreal
            }
        }
        else
        {
            endText.text = "";
        }

        if (staticStuff.carHealth <= 0)
        {
            staticStuff.gameOver = true;
        }

        // Check for an update on the car locations
        int recHostId;
        int recConnectionId;
        int recChannelId;

        byte[]           recBuffer  = new byte[1350];
        int              bufferSize = 1350;
        int              dataSize;
        byte             error;
        NetworkEventType recNetworkEvent = NetworkTransport.Receive(out recHostId, out recConnectionId, out recChannelId, recBuffer, bufferSize, out dataSize, out error);

        //output.text = output.text + "" + recNetworkEvent;
        switch (recNetworkEvent)
        {
        case NetworkEventType.Nothing:
            break;

        case NetworkEventType.ConnectEvent:
            Debug.Log("incoming connection event received");
            //output.text = output.text + "connectEventReceived";
            break;

        case NetworkEventType.DataEvent:
            Stream          stream    = new MemoryStream(recBuffer);
            BinaryFormatter formatter = new BinaryFormatter();
            string          message   = formatter.Deserialize(stream) as string;

            // Parse the updated locations into the Info struct format and process it
            Info inf = JsonUtility.FromJson <Info>(message);
            updateCars(inf);
            //output.text = output.text + "car update received";
            break;

        case NetworkEventType.DisconnectEvent:
            Debug.Log("remote client event disconnected");
            break;
        }

        // Spawn coins with a wait period in between
        coinWaited++;
        if (coinWaited > coinWait)
        {
            coinWaited = 0;
            //GameObject newCoin = Instantiate(coin, new Vector3(UnityEngine.Random.Range(-width, width), 0.2f, 15), transform.rotation);
        }

        /*
         * if (staticStuff.carHealth < 50 && windowCracks.transform.position.y > 50)
         * {
         *  windowCracks.transform.position -= new Vector3(0, windowCracks.transform.position.y - 0.75f, 0);
         * }
         *
         * if (staticStuff.carHealth > 50 && windowCracks.transform.position.y < 50)
         * {
         *  windowCracks.transform.position += new Vector3(0, 100, 0);
         * }
         */
        float newC = (float)(1 - Math.Round(staticStuff.carHealth / 100, 1));

        cracks.SetTextureScale("_MainTex", new Vector2(newC, newC));


        spawnTimer++;
        if (spawnTimer > spawnWait && staticStuff.zombieNum < maxZombies && !staticStuff.gameOver && spawnZs)
        {
            spawnTimer = 0;
            GameObject newZombie = Instantiate(zombie, new Vector3(0, 0.1f, 20), Quaternion.identity);
            newZombie.transform.RotateAround(center.transform.position, Vector3.up, UnityEngine.Random.Range(0, 360));
            newZombie.GetComponent <zombie>().car    = car;
            newZombie.GetComponent <zombie>().target = center;
            Vector3 targetDir = newZombie.transform.position - car.transform.position;
            float   angle     = Vector3.Angle(targetDir, car.transform.forward);
            Debug.Log("Created with angle : " + angle);
            if (angle > allowedAngle)
            {
                Destroy(newZombie);
                spawnTimer = spawnWait + 1;
            }
            else
            {
                staticStuff.zombieNum++;
            }
        }

        if (controllerMode)
        {
            //gun.transform.position = NRInput.GetPosition() + new Vector3(0,1,0);
            gun.transform.rotation = NRInput.GetRotation();
        }

        if ((Input.GetKeyDown(KeyCode.E) || NRInput.GetButtonDown(ControllerButton.TRIGGER)) && clip > 0 && !staticStuff.gameOver)
        {
            Vector3 newRot = cam.transform.eulerAngles;

            //newRot.x += 90;
            //Debug.Log(newRot);
            //newRot.y += 90;
            //newRot.z += 90;
            Quaternion newRotQ   = new Quaternion(newRot.x, newRot.y, newRot.z, cam.transform.localRotation.w);//.normalized;
            GameObject newBullet = Instantiate(bullet, bulletSpawn.transform.position, newRotQ);
            //newBullet.transform.parent = bulletSpawn.transform;
            //newBullet.transform.rotation = newRotQ;
            //newBullet.transform.GetChild(0).GetComponent<bullet>().rot = cam.transform.rotation;
            if (controllerMode)
            {
                newBullet.GetComponent <bullet>().rot = gun.transform.rotation;
            }
            else
            {
                newBullet.GetComponent <bullet>().rot = cam.transform.rotation;
            }
            clip--;
        }

        buTiWaited++;
        if (buTiWaited > bulletTrickleTime)
        {
            buTiWaited = 0;
            bullets++;
        }

        if (clip <= 0 && reloading <= 0)
        {
            reloading = 100;
        }

        if (reloading > 0 && bullets > 0)
        {
            reloading--;
        }

        if (reloading <= 0 && clip == 0)
        {
            if (bullets < 10)
            {
                clip     = bullets;
                bullets -= clip;
            }
            if (bullets >= 10)
            {
                clip     = 10;
                bullets -= 10;
            }
        }
    }
Beispiel #28
0
 bool IInputController.IsTouchUp(ControllerType type) => NRInput.GetButtonDown(ControllerButton.TRIGGER);