/// <summary> /// constructor, takes an actual taskevent and serialize it into its internal structure /// called during serialization /// </summary> public SerializableTaskEvent(TaskEvent taskEvent) { if (taskEvent != null) { TypeName = taskEvent.GetType().Name; switch (TypeName) { case "TransformTaskEvent": { TransformTaskEvent castedEvent = taskEvent as TransformTaskEvent; StartPos = castedEvent.StartPos; EndPos = castedEvent.EndPos; StartRotation = castedEvent.StartRotation; EndRotation = castedEvent.EndRotation; Duration = castedEvent.Duration; } break; case "AnimationTaskEvent": { AnimationTaskEvent castedEvent = taskEvent as AnimationTaskEvent; GameObject = castedEvent.GameObject; AnimatorParam = castedEvent.AnimatorParam; AnimatorParamValue = castedEvent.AnimatorParamValue; ModifyAnimatorParam = castedEvent.ModifyAnimatorParam; AnimatorLayer = castedEvent.AnimatorLayer; AnimatorLayerAmount = castedEvent.AnimatorLayerAmount; ModifyAnimatorLayer = castedEvent.ModifyAnimatorLayer; } break; } } }
/// <summary> /// constructor, takes an actual taskevent and serialize it into its internal structure /// called during serialization /// </summary> public SerializableTaskEvent(TaskEvent taskEvent) { if (taskEvent != null) { TypeName = taskEvent.GetType().Name; switch (TypeName) { case "TransformTaskEvent": { TransformTaskEvent castedEvent = taskEvent as TransformTaskEvent; StartPos = castedEvent.StartPos; EndPos = castedEvent.EndPos; StartRotation = castedEvent.StartRotation; EndRotation = castedEvent.EndRotation; } break; } } }