MCPcopy Create free account
hub / github.com/SolarLune/masterplan / Trigger

Method Trigger

contents.go:1187–1209  ·  view source on GitHub ↗
(triggerType int)

Source from the content-addressed store, hash-verified

1185}
1186
1187func (sc *SoundContents) Trigger(triggerType int) {
1188
1189 if sc.Sound != nil {
1190
1191 switch triggerType {
1192 case TriggerTypeSet:
1193 sc.Playing = true
1194 sc.Sound.Play()
1195 case TriggerTypeClear:
1196 sc.Playing = false
1197 sc.Sound.Pause()
1198 case TriggerTypeToggle:
1199 sc.Playing = !sc.Playing
1200 if sc.Playing {
1201 sc.Sound.Play()
1202 } else {
1203 sc.Sound.Pause()
1204 }
1205 }
1206
1207 }
1208
1209}
1210
1211// We don't want to delete the sound on switch from SoundContents to another content type or on Card destruction because you could undo / switch back, which would require recreating the Sound, which seems unnecessary...?
1212// func (sc *SoundContents) ReceiveMessage(msg *Message) {}

Callers

nothing calls this directly

Calls 2

PlayMethod · 0.80
PauseMethod · 0.80

Tested by

no test coverage detected