Beispiel #1
0
    void Update()
    {
        Ray   ray         = viewCamera.ScreenPointToRay(Input.mousePosition);
        Plane groundPlane = new Plane(Vector3.up, Vector3.zero);
        float rayDistance;

        if (groundPlane.Raycast(ray, out rayDistance))
        {
            Vector3 point = ray.GetPoint(rayDistance);
            LookAt(point);
        }

        if (Input.GetButton("Shoot"))
        {
            gunController.OnTriggerHold();
        }
        if (Input.GetButtonUp("Shoot"))
        {
            gunController.OnTriggerRelease();
        }

        if (Input.GetButtonDown("Change Weapon"))
        {
            gunController.ChangeGun();
        }
        if (Input.GetButton("Reload"))
        {
            gunController.equippedGun.GetComponent <Gun>().ForceReload();
        }
        if (Input.GetButtonDown("Fire2"))
        {
            gunController.ChangeFireMode();
        }
    }
Beispiel #2
0
 private void ChangeAction()
 {
     _controller.ChangeFireMode();
 }