示例#1
0
    public static AnimationController AnimateObject(GameObject animatedObject, Vector3 newPosition, Vector3 newAngle, float duration, EaseInOutType type, AnimateObjectCompleted animationDelegate, object delegateParameter)
    {
        GameObject newAnimationObj = new GameObject(animatedObject + "_animation");
        //newAnimationObj.transform.parent = animatedObject.transform;

        AnimationController newAnimation = newAnimationObj.AddComponent <AnimationController>();

        newAngle = MathfPlus.GetClosestAngle(animatedObject.transform.eulerAngles, newAngle);

        newAnimation.m_AnimationDelegate = animationDelegate;
        newAnimation.m_DelegateParameter = delegateParameter;

        newAnimation.m_AnimatedObject = animatedObject;
        newAnimation.m_NewPosition    = newPosition;
        newAnimation.m_NewAngle       = newAngle;
        newAnimation.m_Duration       = duration;
        newAnimation.m_Type           = type;

        return(newAnimation);
    }