using CombatLibrary.CombatLibrary.CombatCore.CustomizeTime.CameraShakingAsset;
using UnityEngine;
using UnityEngine.Playables;
using Utility;


[System.Serializable]
public class CameraShakingAsset : CustomizePlayableAsset
{
    [Header("激活对象")] public ExposedReference<Camera> camera;
    [Header("抖动方向")] public ShakeDirection direction;
    // [Header("曲线类型")] public int type;
    [Header("抖动时间")] public float totalTime;
    [Header("抖动次数")] public int count;
    [Header("抖动强度")] public float qiangDu;
    [Header("动画曲线")] public AnimationCurve AnimationCurve;

    public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
    {
        ScriptPlayable<CameraShakingBehaviour> playable =
            ScriptPlayable<CameraShakingBehaviour>.Create(graph);
        playable.GetBehaviour().direction = direction;
        // playable.GetBehaviour().type = type;
        playable.GetBehaviour().totalTime = totalTime;
        playable.GetBehaviour().count = count;
        playable.GetBehaviour().qiangDu = qiangDu;
        playable.GetBehaviour().AnimationCurve = AnimationCurve;
        playable.GetBehaviour().Camera = camera.Resolve(graph.GetResolver());
        return playable;
    }
}