コード例 #1
0
 protected void OnEnable()
 {
     //When this inspector is created, also create the built-in inspector
     if (defaultEditor == null)
     {
         defaultEditor = CreateEditor(targets, Type.GetType("UnityEditor.TextureInspector, UnityEditor"));
     }
     animatedPos = new AnimVector3(Vector3.zero, () =>
     {
         m_Pos = animatedPos.value;
         Repaint();
     })
     {
         speed = 1.5f
     };
     rCallback = r => {
         rGBAMaterial.SetFloat("_R", r ? 1 : 0);
         rGBATransparentMaterial.SetFloat("_R", r ? 1 : 0);
         normalsMaterial.SetFloat("_R", r ? 1 : 0);
     };
     gCallback = g => {
         rGBAMaterial.SetFloat("_G", g ? 1 : 0);
         rGBATransparentMaterial.SetFloat("_G", g ? 1 : 0);
         normalsMaterial.SetFloat("_G", g ? 1 : 0);
     };
     bCallback = b => {
         rGBAMaterial.SetFloat("_B", b ? 1 : 0);
         rGBATransparentMaterial.SetFloat("_B", b ? 1 : 0);
         normalsMaterial.SetFloat("_B", b ? 1 : 0);
     };
 }
コード例 #2
0
    private void Start()
    {
        mTransform = GameObject.transform;
        mRenderer  = GameObject.GetComponent <Renderer>();

        mAnimPosition           = new AnimVector3(Vector3.zero, Vector3.back * 2, 0.67f);
        mAnimPosition.EaseType  = AnimEasing.EaseType.EaseInOutBack;
        mAnimPosition.OnUpdate += OnUpdatePosition;

        mAnimRotation           = new AnimQuaternion(Quaternion.identity, Quaternion.identity, 0.5f);
        mAnimRotation.EaseType  = AnimEasing.EaseType.EaseOutCirc;
        mAnimRotation.OnUpdate += OnUpdateRotation;
        mAnimRotation.OnFinish += OnFinishRotation;

        mAnimColor           = new AnimColor(Color.red, Color.yellow, 2);
        mAnimColor.EaseType  = AnimEasing.EaseType.EaseInOutCirc;
        mAnimColor.OnUpdate += OnUpdateColor;
        mAnimColor.OnFinish += OnFinishColor;

        mAnimText           = new AnimString("", Messages[0], 2);
        mAnimText.EaseType  = AnimEasing.EaseType.EaseOutCubic;
        mAnimText.OnUpdate += OnUpdateText;
        mAnimText.OnFinish += OnFinishText;

        mCurrentMessageIndex++;
    }
コード例 #3
0
        public void OffsetMoveBg()
        {
            float   offsetSize      = UnitWindow.WINDOW_FRAMES.y * 1.5f;
            float   offsetSizeFrame = offsetSize * 3f;
            Vector2 offset          = Vector2.zero;

            if (mousePositon.y >= (position.size.y - offsetSizeFrame))
            {
                offset.y = offsetSize;
            }
            if (position.size.x > offsetSizeFrame)
            {
                if (mousePositon.x <= offsetSizeFrame)
                {
                    offset.x = -offsetSize;
                }
                else if (mousePositon.x >= (position.size.x - offsetSizeFrame))
                {
                    offset.x = offsetSize;
                }
            }

            animOffsetBg        = new AnimVector3(Vector3.zero);
            animOffsetBg.speed  = 0.5f;
            animOffsetBg.target = offset;
            animOffsetBg.valueChanged.AddListener(Repaint);

            lastAnimOffsetBg = animOffsetBg.value;
        }
コード例 #4
0
        // ----------------------------------------------------------------------------------------------------------------
        #region system

        private void Awake()
        {
            tr = GetComponent <Transform>();

            camPivot    = new AnimVector3(Vector3.zero, focusSmoothing);
            camDistance = new AnimFloat(defaultZoom, zoomSmoothing);
            camRotator  = new AnimQuaternion(Quaternion.Euler(defaultRotation), focusSmoothing, UpdateCameraRotation);

            Focus(null, true, true);
        }
コード例 #5
0
        private void HandleCameraMouseDrag(CameraState cameraState, Camera cam)
        {
            Event current = Event.current;

            switch (this.m_CurrentViewTool)
            {
            case UnityEditor.ViewTool.Orbit:
                this.OrbitCameraBehavior(cameraState, cam);
                break;

            case UnityEditor.ViewTool.Pan:
            {
                cameraState.FixNegativeSize();
                Vector3 position = cam.WorldToScreenPoint(cameraState.pivot.value) + new Vector3(-Event.current.delta.x, Event.current.delta.y, 0f);
                Vector3 vector7  = cam.ScreenToWorldPoint(position) - cameraState.pivot.value;
                if (current.shift)
                {
                    vector7 = (Vector3)(vector7 * 4f);
                }
                AnimVector3 pivot = cameraState.pivot;
                pivot.value += vector7;
                break;
            }

            case UnityEditor.ViewTool.Zoom:
            {
                float num = HandleUtility.niceMouseDeltaZoom * (!current.shift ? ((float)3) : ((float)9));
                this.m_TotalMotion += num;
                if (this.m_TotalMotion >= 0f)
                {
                    cameraState.viewSize.value += (num * this.m_ZoomSpeed) * 0.003f;
                    break;
                }
                cameraState.viewSize.value = this.m_StartZoom * (1f + (this.m_TotalMotion * 0.001f));
                break;
            }

            case UnityEditor.ViewTool.FPS:
            {
                Vector3    vector     = cameraState.pivot.value - ((Vector3)((cameraState.rotation.value * Vector3.forward) * cameraState.GetCameraDistance()));
                Quaternion quaternion = cameraState.rotation.value;
                quaternion = Quaternion.AngleAxis((current.delta.y * 0.003f) * 57.29578f, (Vector3)(quaternion * Vector3.right)) * quaternion;
                quaternion = Quaternion.AngleAxis((current.delta.x * 0.003f) * 57.29578f, Vector3.up) * quaternion;
                cameraState.rotation.value = quaternion;
                cameraState.pivot.value    = vector + ((Vector3)((quaternion * Vector3.forward) * cameraState.GetCameraDistance()));
                break;
            }
            }
            current.Use();
        }
コード例 #6
0
        protected void OnEnable()
        {
            //When this inspector is created, also create the built-in inspector
            if (defaultEditor == null)
            {
                defaultEditor = CreateEditor(targets, Type.GetType("UnityEditor.TextureInspector, UnityEditor"));
            }
            animatedPos = new AnimVector3(Vector3.zero, () =>
            {
                scrollPosition = animatedPos.value;
                Repaint();
            })
            {
                speed = 1.5f
            };
            rCallback = r =>
            {
                rGBMaterial.SetFloat(R, r ? 1 : 0);
                rGBAMaterial.SetFloat(R, r ? 1 : 0);
                normalsMaterial.SetFloat(R, r ? 1 : 0);
            };
            gCallback = g =>
            {
                rGBMaterial.SetFloat(G, g ? 1 : 0);
                rGBAMaterial.SetFloat(G, g ? 1 : 0);
                normalsMaterial.SetFloat(G, g ? 1 : 0);
            };
            bCallback = b =>
            {
                rGBMaterial.SetFloat(B, b ? 1 : 0);
                rGBAMaterial.SetFloat(B, b ? 1 : 0);
                normalsMaterial.SetFloat(B, b ? 1 : 0);
            };

            if (QualitySettings.activeColorSpace == ColorSpace.Linear)
            {
                rGBMaterial.EnableKeyword("LINEAR");
                rGBAMaterial.EnableKeyword("LINEAR");
            }
            else
            {
                rGBMaterial.DisableKeyword("LINEAR");
                rGBAMaterial.DisableKeyword("LINEAR");
            }
        }
コード例 #7
0
ファイル: AnimExample.cs プロジェクト: RadicalShape/AnimValue
    private void Start()
    {
        mTransform = GameObject.transform;
        mRenderer = GameObject.GetComponent<Renderer>();

        mAnimPosition = new AnimVector3(Vector3.zero, Vector3.back * 2, 0.67f);
        mAnimPosition.EaseType = AnimEasing.EaseType.EaseInOutBack;
        mAnimPosition.OnUpdate += OnUpdatePosition;

        mAnimRotation = new AnimQuaternion(Quaternion.identity, Quaternion.identity, 0.5f);
        mAnimRotation.EaseType = AnimEasing.EaseType.EaseOutCirc;
        mAnimRotation.OnUpdate += OnUpdateRotation;
        mAnimRotation.OnFinish += OnFinishRotation;

        mAnimColor = new AnimColor(Color.red, Color.yellow, 2);
        mAnimColor.EaseType = AnimEasing.EaseType.EaseInOutCirc;
        mAnimColor.OnUpdate += OnUpdateColor;
        mAnimColor.OnFinish += OnFinishColor;

        mAnimText = new AnimString("", Messages[0], 2);
        mAnimText.EaseType = AnimEasing.EaseType.EaseOutCubic;
        mAnimText.OnUpdate += OnUpdateText;
        mAnimText.OnFinish += OnFinishText;

        mCurrentMessageIndex++;
    }