예제 #1
0
    public void AddDevice()
    {
        var dropdown = DeviceDropdown.GetComponent <Dropdown>();

        if (dropdown.value >= dropdown.options.Count)
        {
            return;
        }
        var deviceId = dropdown.options[dropdown.value].text;
        var obj      = Instantiate(DevicePrefab, CurrentIndicator.transform.position, Quaternion.identity);
        var device   = obj.GetComponent <Device>();

        Devices.Add(device);
        device.DeviceId = deviceId;
        var particles = obj.GetComponentInChildren <ParticleSystem>();

        particles.transform.LookAt(particles.transform.position + CurrentHit.normal);
        ExtendedFlycam.UnlockCameraPosition();
        DeviceDropdown.SetInteractable(false);
        AddDeviceButton.interactable = false;
    }