コード例 #1
0
 private void Update()
 {
     //Asking for the value and specify the index
     if (phidgetInterfaceKit.getValue(0) <= 500 && ready)
     {
         //Creating a grenade gameObject when the sensor registers a change
         Instantiate(grenade, grenadeSpawnPosition.position, grenadeSpawnPosition.rotation);
         ready = false;
         StartCoroutine(coolDown());
     }
 }
コード例 #2
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F))
        {
            foreach (Gun _Gun in Guns)
            {
                _Gun.Add_Ammo(1000);
            }
        }

        if (Guns[Gun].Is_Automatic())
        {
            if (Input.GetButton("Fire1"))
            {
                Shoot();
            }
        }
        else
        {
            if (Input.GetButtonDown("Fire1"))
            {
                Shoot();
            }
        }

        if (phidgetInterfaceKit.getValue(2) >= 500)
        {
            Guns[Gun].Reload();
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            Guns [Gun].Reload();
        }

        if (Input.GetKeyDown(KeyCode.E))
        {
            Gun = Gun + 1 < Guns.Count ? Gun + 1 : 0;
        }

        if (Input.GetKeyDown(KeyCode.Q))
        {
            Gun = Gun - 1 >= 0 ? Gun - 1 : Guns.Count - 1;
        }

        DebugText.text = Guns [Gun].Get_Info();
    }
コード例 #3
0
    void Update()
    {
        //Scales down the phidget value to fit within the range given
        float sensorValue = phidgetInterfaceKit.getValue(1) / 16.7f;

        //Checks whether the sensor value is outside the resired range and locks it to either
        //the minimum or maximum range
        if (sensorValue > kMinZoom)
        {
            sensorValue = kMinZoom;
        }
        else if (sensorValue < kMaxZoom)
        {
            sensorValue = kMaxZoom;
        }
        //Sets the camera's feild of view to the value of the sensor
        GetComponent <Camera>().fieldOfView = sensorValue;
    }
コード例 #4
0
 // Update is called once per frame
 void Update()
 {
     Debug.Log(phidgetInterfaceKit.getValue(2));
 }