diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/EntityBase.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EntityBase.cs | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs new file mode 100644 index 0000000..edd72c5 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs | |||
@@ -0,0 +1,133 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using Axiom.MathLib; | ||
5 | using libsecondlife; | ||
6 | |||
7 | namespace OpenSim.Region.Environment.Scenes | ||
8 | { | ||
9 | public abstract class EntityBase | ||
10 | { | ||
11 | public libsecondlife.LLUUID uuid; | ||
12 | |||
13 | protected List<EntityBase> children; | ||
14 | |||
15 | protected Scene m_world; | ||
16 | protected string m_name; | ||
17 | |||
18 | /// <summary> | ||
19 | /// | ||
20 | /// </summary> | ||
21 | public virtual string Name | ||
22 | { | ||
23 | get { return m_name; } | ||
24 | } | ||
25 | |||
26 | protected LLVector3 m_pos; | ||
27 | /// <summary> | ||
28 | /// | ||
29 | /// </summary> | ||
30 | public virtual LLVector3 Pos | ||
31 | { | ||
32 | get | ||
33 | { | ||
34 | return m_pos; | ||
35 | } | ||
36 | set | ||
37 | { | ||
38 | m_pos = value; | ||
39 | } | ||
40 | } | ||
41 | |||
42 | public LLVector3 velocity; | ||
43 | |||
44 | /// <summary> | ||
45 | /// | ||
46 | /// </summary> | ||
47 | public virtual LLVector3 Velocity | ||
48 | { | ||
49 | get | ||
50 | { | ||
51 | return velocity; | ||
52 | } | ||
53 | set | ||
54 | { | ||
55 | velocity = value; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | public Quaternion _rotation; | ||
60 | |||
61 | public virtual Quaternion rotation | ||
62 | { | ||
63 | get | ||
64 | { | ||
65 | return _rotation; | ||
66 | } | ||
67 | set | ||
68 | { | ||
69 | _rotation = value; | ||
70 | } | ||
71 | } | ||
72 | |||
73 | protected uint m_localId; | ||
74 | |||
75 | public uint LocalId | ||
76 | { | ||
77 | get { return m_localId; } | ||
78 | } | ||
79 | |||
80 | /// <summary> | ||
81 | /// Creates a new Entity (should not occur on it's own) | ||
82 | /// </summary> | ||
83 | public EntityBase() | ||
84 | { | ||
85 | uuid = new libsecondlife.LLUUID(); | ||
86 | |||
87 | m_pos = new LLVector3(); | ||
88 | velocity = new LLVector3(); | ||
89 | rotation = new Quaternion(); | ||
90 | m_name = "(basic entity)"; | ||
91 | children = new List<EntityBase>(); | ||
92 | } | ||
93 | |||
94 | /// <summary> | ||
95 | /// | ||
96 | /// </summary> | ||
97 | public virtual void updateMovement() | ||
98 | { | ||
99 | foreach (EntityBase child in children) | ||
100 | { | ||
101 | child.updateMovement(); | ||
102 | } | ||
103 | } | ||
104 | |||
105 | /// <summary> | ||
106 | /// Performs any updates that need to be done at each frame. This function is overridable from it's children. | ||
107 | /// </summary> | ||
108 | public virtual void update() | ||
109 | { | ||
110 | // Do any per-frame updates needed that are applicable to every type of entity | ||
111 | foreach (EntityBase child in children) | ||
112 | { | ||
113 | child.update(); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | /// <summary> | ||
118 | /// Called at a set interval to inform entities that they should back themsleves up to the DB | ||
119 | /// </summary> | ||
120 | public virtual void BackUp() | ||
121 | { | ||
122 | |||
123 | } | ||
124 | |||
125 | /// <summary> | ||
126 | /// Infoms the entity that the land (heightmap) has changed | ||
127 | /// </summary> | ||
128 | public virtual void LandRenegerated() | ||
129 | { | ||
130 | |||
131 | } | ||
132 | } | ||
133 | } | ||