Beispiel #1
0
        public void SetUp(GameObject resource, Vector2Int size)
        {
            if (_objectCaptureObject == null)
            {
                var instance = EditorGUIUtility.Load("ObjectCapture/ObjectCapture.prefab");
                _objectCaptureObject           = (GameObject)Object.Instantiate(instance);
                _objectCaptureObject.name      = instance.name;
                _objectCaptureObject.hideFlags = HideFlags.HideInHierarchy | HideFlags.DontSave;
            }

            _objectCapture = _objectCaptureObject.GetComponent <ObjectCapture>();

            if (_createObject == null)
            {
                _createObject = Object.Instantiate(resource, _objectCapture.ObjRoot);
            }

            _animator = _createObject.GetComponent <Animator>();
            if (_animator.runtimeAnimatorController.animationClips.Length > 0)
            {
                _maxLength = _animator.runtimeAnimatorController.animationClips[_animationIndex].length;
            }

            _backgroundColor = _objectCapture.Camera.backgroundColor;
            _cameraPosition  = _objectCapture.Camera.transform.localPosition;
            _cameraRotation  = _objectCapture.Camera.transform.localEulerAngles;
            if (_info == null)
            {
                _info = new Info(_objectCapture.Camera, size);
            }
            else
            {
                _info.CreateRenderTexture(size);
            }
        }
Beispiel #2
0
        private bool SetParam()
        {
            if (_objectCaptureObject == null)
            {
                _objectCaptureObject = GameObject.Find("ObjectCapture");
            }
            if (_objectCaptureObject == null)
            {
                return(false);
            }

            if (_objectCapture == null)
            {
                _objectCapture = _objectCaptureObject.GetComponent <ObjectCapture>();
            }
            if (_objectCapture == null)
            {
                return(false);
            }

            if (_animator == null)
            {
                _animator = _createObject.GetComponent <Animator>();
            }
            if (_animator == null)
            {
                return(false);
            }

            return(true);
        }