Modyfing Sequencer.cs
Posted: Sat Aug 28, 2021 10:21 pm
Hello!
I'm currently at the stage of my game where a lot of things has been done, and I gotta hack my way around...
Here is my situation: I have lots of conversation across my game, and I have been using the sequencer command "AnimatorPlay(animationName, animatorTarget, transition duration)" extensively
It works great but now I'm finding myself in a specific need: I want to call a specific function in one of my game scripts when the AnimatorPlay is called, and another function when the duration of the transition has passed.
My first guess was to try and modify (reluctantly, but I dont see any other solution) Sequencer.cs, more specifically the method "HandleAnimatorPlayInternally", and call my stuff just before animator.CrossFadeInFixedTime(...)
However here is my problem: I cannot manage to reference my own script in Sequencer.cs (or any other DS scripts). I'm guessing this is due to assembly definitions, but I unfortunately have no experiences with this and I am having trouble finding how can I reference my script there!
To go a bit more in details about WHY im doing this:
My characters are animated a specific way, with their body and faces all animated in single clips. The faces are 2D sprites that are animated with constant values. However when transitioning to another clip, the value used for the 2D sprites is blending too, so it create very weird motions. My goal is to completely prevent any blending whatsoever as soon as a "AnimatorPlay" is called, and resume the transition after the duration of the crossfade. Other animation cases like gameplay and cutscene are already handled another way, but I still need to find a solution for animations triggered from dialogue sequences.
This is a very specific problem, and probably not DS specific tho, but I'm still asking in case you can help
I'm currently at the stage of my game where a lot of things has been done, and I gotta hack my way around...
Here is my situation: I have lots of conversation across my game, and I have been using the sequencer command "AnimatorPlay(animationName, animatorTarget, transition duration)" extensively
It works great but now I'm finding myself in a specific need: I want to call a specific function in one of my game scripts when the AnimatorPlay is called, and another function when the duration of the transition has passed.
My first guess was to try and modify (reluctantly, but I dont see any other solution) Sequencer.cs, more specifically the method "HandleAnimatorPlayInternally", and call my stuff just before animator.CrossFadeInFixedTime(...)
However here is my problem: I cannot manage to reference my own script in Sequencer.cs (or any other DS scripts). I'm guessing this is due to assembly definitions, but I unfortunately have no experiences with this and I am having trouble finding how can I reference my script there!
To go a bit more in details about WHY im doing this:
My characters are animated a specific way, with their body and faces all animated in single clips. The faces are 2D sprites that are animated with constant values. However when transitioning to another clip, the value used for the 2D sprites is blending too, so it create very weird motions. My goal is to completely prevent any blending whatsoever as soon as a "AnimatorPlay" is called, and resume the transition after the duration of the crossfade. Other animation cases like gameplay and cutscene are already handled another way, but I still need to find a solution for animations triggered from dialogue sequences.
This is a very specific problem, and probably not DS specific tho, but I'm still asking in case you can help