diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EntityBase.cs | 142 |
1 files changed, 142 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..65a0395 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs | |||
@@ -0,0 +1,142 @@ | |||
1 | using System.Collections.Generic; | ||
2 | using Axiom.Math; | ||
3 | using libsecondlife; | ||
4 | |||
5 | namespace OpenSim.Region.Environment.Scenes | ||
6 | { | ||
7 | public abstract class EntityBase | ||
8 | { | ||
9 | public LLUUID uuid; | ||
10 | |||
11 | protected List<EntityBase> children; | ||
12 | |||
13 | protected Scene m_world; | ||
14 | protected string m_name; | ||
15 | |||
16 | /// <summary> | ||
17 | /// | ||
18 | /// </summary> | ||
19 | public virtual string Name | ||
20 | { | ||
21 | get { return m_name; } | ||
22 | set { m_name = value; } | ||
23 | } | ||
24 | |||
25 | protected LLVector3 m_pos; | ||
26 | /// <summary> | ||
27 | /// | ||
28 | /// </summary> | ||
29 | public virtual LLVector3 Pos | ||
30 | { | ||
31 | get | ||
32 | { | ||
33 | return m_pos; | ||
34 | } | ||
35 | set | ||
36 | { | ||
37 | m_pos = value; | ||
38 | } | ||
39 | } | ||
40 | |||
41 | public LLVector3 m_velocity; | ||
42 | |||
43 | /// <summary> | ||
44 | /// | ||
45 | /// </summary> | ||
46 | public virtual LLVector3 Velocity | ||
47 | { | ||
48 | get | ||
49 | { | ||
50 | return m_velocity; | ||
51 | } | ||
52 | set | ||
53 | { | ||
54 | m_velocity = value; | ||
55 | } | ||
56 | } | ||
57 | |||
58 | protected Quaternion m_rotation = new Quaternion(0,0,1,0); | ||
59 | |||
60 | public virtual Quaternion Rotation | ||
61 | { | ||
62 | get | ||
63 | { | ||
64 | return m_rotation; | ||
65 | } | ||
66 | set | ||
67 | { | ||
68 | m_rotation = value; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | protected uint m_localId; | ||
73 | |||
74 | public uint LocalId | ||
75 | { | ||
76 | get { return m_localId; } | ||
77 | set { m_localId = value; } | ||
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 LLUUID(); | ||
86 | |||
87 | m_pos = new LLVector3(); | ||
88 | m_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 | /// Copies the entity | ||
127 | /// </summary> | ||
128 | /// <returns></returns> | ||
129 | public virtual EntityBase Copy() | ||
130 | { | ||
131 | return (EntityBase)this.MemberwiseClone(); | ||
132 | } | ||
133 | |||
134 | /// <summary> | ||
135 | /// Infoms the entity that the land (heightmap) has changed | ||
136 | /// </summary> | ||
137 | public virtual void LandRenegerated() | ||
138 | { | ||
139 | |||
140 | } | ||
141 | } | ||
142 | } | ||