コード例 #1
0
        private void RunToTime(float _time, bool isSkipping)
        {
            if (transformType == TransformType.CopyMarker)
            {
                if (marker)
                {
                    linkedProp.Move(marker, moveMethod, _time, timeCurve);
                }
            }
            else
            {
                Vector3 targetVector = newVector;

                if (transformType == TransformType.Translate)
                {
                    if (toBy == ToBy.By)
                    {
                        targetVector = SetRelativeTarget(targetVector, isSkipping, linkedProp.transform.localPosition);
                    }
                }

                else if (transformType == TransformType.Rotate)
                {
                    if (toBy == ToBy.By)
                    {
                        int numZeros = 0;
                        if (targetVector.x == 0f)
                        {
                            numZeros++;
                        }
                        if (targetVector.y == 0f)
                        {
                            numZeros++;
                        }
                        if (targetVector.z == 0f)
                        {
                            numZeros++;
                        }

                        if (numZeros == 2)
                        {
                            targetVector = SetRelativeTarget(targetVector, isSkipping, linkedProp.transform.eulerAngles);
                        }
                        else
                        {
                            Quaternion currentRotation = linkedProp.transform.localRotation;
                            linkedProp.transform.Rotate(targetVector, Space.World);
                            targetVector = linkedProp.transform.localEulerAngles;
                            linkedProp.transform.localRotation = currentRotation;
                        }
                    }
                }

                else if (transformType == TransformType.Scale)
                {
                    if (toBy == ToBy.By)
                    {
                        targetVector = SetRelativeTarget(targetVector, isSkipping, linkedProp.transform.localScale);
                    }
                }

                if (transformType == TransformType.Rotate)
                {
                    linkedProp.Move(targetVector, moveMethod, _time, transformType, doEulerRotation, timeCurve);
                }
                else
                {
                    linkedProp.Move(targetVector, moveMethod, _time, transformType, false, timeCurve);
                }
            }
        }
        private void RunToTime(float _time, bool isSkipping)
        {
            if (transformType == TransformType.CopyMarker)
            {
                if (marker)
                {
                    linkedProp.Move(marker, moveMethod, inWorldSpace, _time, timeCurve);
                }
            }
            else
            {
                Vector3 targetVector = Vector3.zero;

                if (setVectorMethod == SetVectorMethod.FromVector3Variable)
                {
                    if (variableLocation == VariableLocation.Global)
                    {
                        targetVector = GlobalVariables.GetVector3Value(vectorVarID);
                    }
                    else if (variableLocation == VariableLocation.Local && !isAssetFile)
                    {
                        targetVector = LocalVariables.GetVector3Value(vectorVarID);
                    }
                }
                else if (setVectorMethod == SetVectorMethod.EnteredHere)
                {
                    targetVector = newVector;
                }

                if (transformType == TransformType.Translate)
                {
                    if (toBy == ToBy.By)
                    {
                        targetVector = SetRelativeTarget(targetVector, isSkipping, linkedProp.transform.localPosition);
                    }
                }
                else if (transformType == TransformType.Rotate)
                {
                    if (toBy == ToBy.By)
                    {
                        int numZeros = 0;
                        if (Mathf.Approximately(targetVector.x, 0f))
                        {
                            numZeros++;
                        }
                        if (Mathf.Approximately(targetVector.y, 0f))
                        {
                            numZeros++;
                        }
                        if (Mathf.Approximately(targetVector.z, 0f))
                        {
                            numZeros++;
                        }

                        if (numZeros == 2)
                        {
                            targetVector = SetRelativeTarget(targetVector, isSkipping, linkedProp.transform.eulerAngles);
                        }
                        else
                        {
                            Quaternion currentRotation = linkedProp.transform.localRotation;
                            linkedProp.transform.Rotate(targetVector, Space.World);
                            targetVector = linkedProp.transform.localEulerAngles;
                            linkedProp.transform.localRotation = currentRotation;
                        }
                    }
                }
                else if (transformType == TransformType.Scale)
                {
                    if (toBy == ToBy.By)
                    {
                        targetVector = SetRelativeTarget(targetVector, isSkipping, linkedProp.transform.localScale);
                    }
                }

                if (transformType == TransformType.Rotate)
                {
                    linkedProp.Move(targetVector, moveMethod, inWorldSpace, _time, transformType, doEulerRotation, timeCurve, clearExisting);
                }
                else
                {
                    linkedProp.Move(targetVector, moveMethod, inWorldSpace, _time, transformType, false, timeCurve, clearExisting);
                }
            }
        }
コード例 #3
0
        protected void RunToTime(float _time, bool isSkipping)
        {
            if (transformType == TransformType.CopyMarker)
            {
                if (runtimeMarker != null)
                {
                    runtimeLinkedProp.Move(runtimeMarker, moveMethod, inWorldSpace, _time, timeCurve);
                }
            }
            else
            {
                Vector3 targetVector = Vector3.zero;

                if (setVectorMethod == SetVectorMethod.FromVector3Variable)
                {
                    if (runtimeVariable != null)
                    {
                        targetVector = runtimeVariable.Vector3Value;
                    }
                }
                else if (setVectorMethod == SetVectorMethod.EnteredHere)
                {
                    targetVector = newVector;
                }

                if (transformType == TransformType.Translate)
                {
                    if (toBy == ToBy.By)
                    {
                        targetVector = SetRelativeTarget(targetVector, isSkipping, runtimeLinkedProp.transform.localPosition);
                    }
                }
                else if (transformType == TransformType.Rotate)
                {
                    if (toBy == ToBy.By)
                    {
                        int numZeros = 0;
                        if (Mathf.Approximately(targetVector.x, 0f))
                        {
                            numZeros++;
                        }
                        if (Mathf.Approximately(targetVector.y, 0f))
                        {
                            numZeros++;
                        }
                        if (Mathf.Approximately(targetVector.z, 0f))
                        {
                            numZeros++;
                        }

                        if (numZeros == 2)
                        {
                            targetVector = SetRelativeTarget(targetVector, isSkipping, runtimeLinkedProp.transform.eulerAngles);
                        }
                        else
                        {
                            Quaternion currentRotation = runtimeLinkedProp.transform.localRotation;
                            runtimeLinkedProp.transform.Rotate(targetVector, Space.World);
                            targetVector = runtimeLinkedProp.transform.localEulerAngles;
                            runtimeLinkedProp.transform.localRotation = currentRotation;
                        }
                    }
                }
                else if (transformType == TransformType.Scale)
                {
                    if (toBy == ToBy.By)
                    {
                        targetVector = SetRelativeTarget(targetVector, isSkipping, runtimeLinkedProp.transform.localScale);
                    }
                }

                if (transformType == TransformType.Rotate)
                {
                    runtimeLinkedProp.Move(targetVector, moveMethod, inWorldSpace, _time, transformType, doEulerRotation, timeCurve, clearExisting);
                }
                else
                {
                    runtimeLinkedProp.Move(targetVector, moveMethod, inWorldSpace, _time, transformType, false, timeCurve, clearExisting);
                }
            }
        }