-
Notifications
You must be signed in to change notification settings - Fork 0
/
Doors.cs
81 lines (73 loc) · 1.92 KB
/
Doors.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using IrrKlang;
using Microsoft.Xna.Framework;
namespace Game3
{
public class Doors
{
ISoundEngine engine = new ISoundEngine();
public int x, y, z;
public double delaytime;
string doorname;
string dcs, dos;
bool isopen;
bool isInpassable;
public Map Map
{
get { return map; }
}
Map map;
public Doors(Map map, int dx, int dy, int dz, string name, bool isOpen=false)
{
this.map = map;
this.x = dx;
this.y = dy;
this.z = dz;
this.isopen = isOpen;
this.doorname = name;
map.engine.Play3D("sounds/doors/"+name+"/loop.mp3", x, y, z, true);
}
public void Update(GameTime gameTime)
{
if ((int)Map.Player.me.X == x && (int)Map.Player.me.Y == y && (int)Map.Player.me.Z == z)
{
if (isopen==false)
{
isInpassable = true;
map.engine.Play3D("sounds/doors/" + doorname + "/wall.mp3", x, y, z);
map.bounce();
}
else
{
isInpassable = false;
}
}
}
public void interact()
{
if (isopen)
{
close();
}
else
{
open();
}
}
public void open()
{
isopen = true;
map.engine.Play3D("sounds/doors/"+doorname+"/open.mp3", x, y, z);
}
public void close()
{
isopen = false;
map.engine.Play3D("sounds/doors/"+doorname+"/close.mp3", x, y, z);
}
}
}