-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sound.cs
88 lines (71 loc) · 1.55 KB
/
Sound.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Linq;
using System.Collections.Generic;
using Microsoft.Xna.Framework.Audio;
namespace ImagineCup2012
{
public class Sound
{
private Cue cue;
private string name;
public Sound(string name)
: this(null, name)
{
}
public Sound(Cue cue, string name)
{
this.cue = cue;
this.name = name;
}
public Cue getCue()
{
return cue;
}
public string getName()
{
return name;
}
public void play()
{
cue.Play();
}
public void resume()
{
if (cue.IsPaused)
{
cue.Resume();
}
}
public void pause()
{
if (!cue.IsPaused)
{
cue.Pause();
}
}
public void stop(AudioStopOptions options)
{
cue.Stop(options);
}
public bool isStopped()
{
return cue.IsStopped;
}
public bool isPlaying()
{
return cue.IsPlaying;
}
public override bool Equals(Object obj)
{
if (obj == null) return false;
Sound sound = obj as Sound;
if ((Object)sound == null) return false;
if (sound == this) return true;
return name.Equals(sound.name);
}
public override int GetHashCode()
{
return 0;
}
}
}