using System.Collections.Generic; using Fort23.Core; using Fort23.UTool; #if !COMBAT_SERVER using UnityEngine; using UnityEngine.Playables; using UnityEngine.Timeline; #endif using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventLogic; [System.Serializable] public class TimeLineCollisionTriggerSerializtion : TimeLineAssetSerialization { public string guid; public List allVe = new List(); public Vector3 off; public string startPosGuid; public string boneName; public TimeLineCollisionTriggerSerializtion() { } #if !COMBAT_SERVER public TimeLineCollisionTriggerSerializtion(PlayableDirector playableDirector, GroupTrack groupTrack, TimelineClip timelineClip) : base(groupTrack, timelineClip) { TimeLineCollisionTriggerAsset animationPlayableAsset = timelineClip.asset as TimeLineCollisionTriggerAsset; Object obj = animationPlayableAsset.GameObject.defaultValue; Debug.Log(obj); if (animationPlayableAsset.GameObject.Resolve(playableDirector.playableGraph.GetResolver()) != null) { GameObject go = animationPlayableAsset.GameObject.Resolve(playableDirector.playableGraph.GetResolver()); BoxCollider2D boxCollider2D = go.GetComponent(); if (boxCollider2D != null) { allVe = new List(); Vector2 Half_size = boxCollider2D.size / 2; allVe.Add(new Vector3(-Half_size.x, -Half_size.y)); allVe.Add(new Vector3(-Half_size.x, Half_size.y)); allVe.Add(new Vector3(Half_size.x, Half_size.y)); allVe.Add(new Vector3(Half_size.x, -Half_size.y)); off = boxCollider2D.offset+(Vector2)boxCollider2D.transform.localPosition; } else { EdgeCollider2D edgeCollider2D = go.GetComponent(); if (edgeCollider2D != null) { allVe = new List(); Vector2[] points = edgeCollider2D.points; for (int i = 0; i < edgeCollider2D.pointCount; i++) { allVe.Add(points[i]); } } off = edgeCollider2D.transform.localPosition; } guid = animationPlayableAsset.guid; startPosGuid = animationPlayableAsset.startPosGuid; } } #endif public override TimeLineEventLogicBasic CreateLogic() { return CObjectPool.Instance.Fetch(); } }