(triggerType int)
| 1185 | } |
| 1186 | |
| 1187 | func (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) {} |