Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Custom Events (Triggers) #93

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Conversation

Elecast2
Copy link
Contributor

@Elecast2 Elecast2 commented Nov 10, 2023

This code should allow you to add triggers to enable AnimationTracks. It adds the next properties to notes:
triggerOnMiss and triggerOnCut, can be a simple string or an array of strings (allowing to trigger multiple triggers).
AnimationTrack has a new field called "trigger" it also can be a string or an array allowing for different triggers to trigger it.
Notes:

  • If the beat of the AnimationTrack occurs before the note event, it won't be triggered.
  • triggerOnMiss and triggerOnCut have some delay and is not at the same beat of the note, so you have to make sure the AnimationTrack is a bit later, I have tested 150ms to work
  • More events should be added but I am not sure how (hit wall event? dodge wall event?, hit bomb event?, dodgeBomb event?)

Example of Custom Data:

"colorNotes": [
		{
			"b": 25,
			"x": 2,
			"c": 1,
			"d": 1,
			"customData": {
				"triggerOnMiss": "tm0",
				"triggerOnCut": "tc0"
			}
		}
]`
"customEvents": [
			{
				"b": 25.15,
				"t": "AnimateTrack",
				"d": {
					"track": "ttest",
					"duration": 0.5,
					"trigger": "tc0",
					"position": [
						[
							-1.46,
							0.4,
							8.913,
							0
						],
						[
							-1.46,
							2,
							8.913,
							0.5,
							"easeOutCirc"
						],
						[
							-1.46,
							0.4,
							8.913,
							1,
							"easeInCirc"
						]
					]
				}
			},
			{
				"b": 25.15,
				"t": "AnimateTrack",
				"d": {
					"track": "ttest",
					"duration": 0.5,
					"trigger": "tm0",
					"position": [
						[
							-1.46,
							0.4,
							8.913,
							0
						],
						[
							-2.46,
							0.4,
							8.913,
							0.33,
							"easeOutBack"
						],
						[
							-0.45999999999999999,
							0.4,
							8.913,
							0.66,
							"easeInOutBack"
						],
						[
							-1.46,
							0.4,
							8.913,
							1,
							"easeInOutBack"
						]
					]
				}
			}
]

Example video: https://streamable.com/9rf3wr

@@ -41,6 +43,24 @@ internal void StartEventCoroutine(CustomEventData customEventData, EventType eve
return;
}

IEnumerable<Trigger> triggers = heckData.Triggers;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick but use triggers.Any(x => x.isTriggered) for more declarative syntax here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants