// Public Method
    #region Public Method
    public void SetActiveCamera(CameraKind kind)
    {
        var obj = GetCameraObject(kind);

        if (obj != null)
        {
            if (!obj.activeInHierarchy)
            {
                obj.SetActive(true);
                return;
            }
        }
        var data = GetCameraData(kind);

        if (data == null)
        {
#if UNITY_EDITOR
            Debug.LogError(string.Format($"{kind.ToString()} 해당 카메라종류가 발견되지 않았습니다."));
#endif
        }
        else
        {
            var c = Instantiate <GameObject>(data.cameraObject, transform);
            c.SetActive(true);

            if (!dicCameraObjs.ContainsKey(data.kind))
            {
                dicCameraObjs.Add(data.kind, c);
            }
        }
    }
Beispiel #2
0
        private static ICamera TryAssembly(CameraKind camraKind)
        {
            string name      = camraKind.ToString();
            var    realSense = LoadAssemblyOrNull(name);

            if (realSense == null)
            {
                return(null);
            }
            try {
                return((ICamera)Activator.CreateInstance(
                           "SharpSenses." + name,
                           "SharpSenses." + name + "." + name + "Camera",
                           true, BindingFlags.Instance | BindingFlags.Public, null, null, null, null).Unwrap());
            }
            catch (BadImageFormatException bex) {
                throw new CameraException("SharpSenses only works with x64 applications :(");
            }
            catch (Exception ex) {
                throw new CameraException(ex.Message);
            }
        }
Beispiel #3
0
 private static ICamera TryAssembly(CameraKind camraKind)
 {
     string name = camraKind.ToString();
     var realSense = LoadAssemblyOrNull(name);
     if (realSense == null) return null;
     try {
         return (ICamera) Activator.CreateInstance(
             "SharpSenses." + name,
             "SharpSenses." + name + "." + name + "Camera",
             true, BindingFlags.Instance | BindingFlags.Public, null, null, null, null).Unwrap();
     }
     catch(BadImageFormatException bex) {
         throw new CameraException("SharpSenses only works with x64 applications :(");
     }
     catch (Exception ex) {
         throw new CameraException(ex.Message);
     }
 }