Пример #1
0
  void FireRay() {
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    RaycastHit hit;

    if (Physics.Raycast(ray, out hit)) {
      GameObject collidedDevice = hit.collider.gameObject;

      if (collidedDevice.CompareTag("Device")) {

        Instantiate(particle, collidedDevice.transform.position, collidedDevice.transform.rotation);

        currentDevice.SetModel(true);
        currentDevice = collidedDevice.GetComponent<DeviceController>();
        if (currentDevice.IsFunctioning()) {
          GetComponent<AudioSource>().PlayOneShot(jumpFx);
          currentDevice.CyberJump(this);
        }
      }
    }
  }
Пример #2
0
    void FireRay()
    {
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            GameObject collidedDevice = hit.collider.gameObject;

            if (collidedDevice.CompareTag("Device"))
            {
                Instantiate(particle, collidedDevice.transform.position, collidedDevice.transform.rotation);

                currentDevice.SetModel(true);
                currentDevice = collidedDevice.GetComponent <DeviceController>();
                if (currentDevice.IsFunctioning())
                {
                    GetComponent <AudioSource>().PlayOneShot(jumpFx);
                    currentDevice.CyberJump(this);
                }
            }
        }
    }