Beispiel #1
0
    public TweeningAnim GetAnim()
    {
        TweeningAnim anim = ScriptableObject.CreateInstance <TweeningAnim>();

        anim.animationCurve                = animationCurve;
        anim.animationTime                 = animationTime;
        anim.animationStartPos             = animationStartPos;
        anim.animationEndPos               = animationEndPos;
        anim.colorAnimation                = colorAnimation;
        anim.useColorChange                = useColorChange;
        anim.animationEndRot               = animationEndRot;
        anim.animationStartRot             = animationStartRot;
        anim.animationStartScale           = animationStartScale;
        anim.animationEndScale             = animationEndScale;
        anim.customRotCurve                = customRotCurve;
        anim.customScaleCurve              = customScaleCurve;
        anim.scaleAnimationCurve           = customScaleCurve ? scaleAnimationCurve : animationCurve;
        anim.rotAnimationCurve             = customRotCurve ? rotAnimationCurve : animationCurve;
        anim.movementRelativeToOriginalPos = movementRelativeToOriginalPos;

        return(anim);
    }
Beispiel #2
0
    public static void CreateAnimInAssets(TweeningAnim newAnim)
    {
        string path = AssetDatabase.GetAssetPath(Selection.activeObject.GetInstanceID());

        if (path == "")
        {
            path = "Assets";
        }
        else if (Path.GetExtension(path) != "")
        {
            path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeContext)), "");
        }

        string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/New " + typeof(TweeningAnim).ToString() + ".asset");

        AssetDatabase.CreateAsset(newAnim, assetPathAndName);

        AssetDatabase.SaveAssets();
        AssetDatabase.Refresh();
        EditorUtility.FocusProjectWindow();
        Selection.activeObject = newAnim;
    }