diff options
Diffstat (limited to 'src/world/Entity.cs')
-rw-r--r-- | src/world/Entity.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/world/Entity.cs b/src/world/Entity.cs new file mode 100644 index 0000000..ab07fd6 --- /dev/null +++ b/src/world/Entity.cs | |||
@@ -0,0 +1,53 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using Axiom.MathLib; | ||
5 | using OpenSim.types; | ||
6 | |||
7 | namespace OpenSim.world | ||
8 | { | ||
9 | public class Entity | ||
10 | { | ||
11 | protected libsecondlife.LLUUID uuid; | ||
12 | protected Vector3 position; | ||
13 | protected Vector3 velocity; | ||
14 | protected Quaternion rotation; | ||
15 | protected string name; | ||
16 | protected List<Entity> children; | ||
17 | |||
18 | public Entity() | ||
19 | { | ||
20 | uuid = new libsecondlife.LLUUID(); | ||
21 | position = new Vector3(); | ||
22 | velocity = new Vector3(); | ||
23 | rotation = new Quaternion(); | ||
24 | name = "(basic entity)"; | ||
25 | children = new List<Entity>(); | ||
26 | } | ||
27 | |||
28 | public virtual void update() { | ||
29 | // Do any per-frame updates needed that are applicable to every type of entity | ||
30 | foreach (Entity child in children) | ||
31 | { | ||
32 | child.update(); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | public virtual string getName() | ||
37 | { | ||
38 | return name; | ||
39 | } | ||
40 | |||
41 | public virtual Mesh getMesh() | ||
42 | { | ||
43 | Mesh mesh = new Mesh(); | ||
44 | |||
45 | foreach (Entity child in children) | ||
46 | { | ||
47 | mesh += child.getMesh(); | ||
48 | } | ||
49 | |||
50 | return mesh; | ||
51 | } | ||
52 | } | ||
53 | } | ||