diff options
Diffstat (limited to 'OpenSim/Region/Examples')
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 16 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MySceneObject.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyWorld.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/Program.cs | 3 |
4 files changed, 9 insertions, 39 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index af70f07..f7bf5d6 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -12,6 +12,7 @@ using OpenSim.Framework.Interfaces; | |||
12 | using OpenSim.Framework.Types; | 12 | using OpenSim.Framework.Types; |
13 | using OpenSim.Framework.Data; | 13 | using OpenSim.Framework.Data; |
14 | using OpenSim.Framework.Utilities; | 14 | using OpenSim.Framework.Utilities; |
15 | using OpenSim.Region.Environment.Scenes; | ||
15 | 16 | ||
16 | namespace SimpleApp | 17 | namespace SimpleApp |
17 | { | 18 | { |
@@ -78,9 +79,9 @@ namespace SimpleApp | |||
78 | #pragma warning restore 67 | 79 | #pragma warning restore 67 |
79 | 80 | ||
80 | private LLUUID myID = LLUUID.Random(); | 81 | private LLUUID myID = LLUUID.Random(); |
81 | public MyNpcCharacter() | 82 | public MyNpcCharacter( EventManager eventManager ) |
82 | { | 83 | { |
83 | 84 | eventManager.OnFrame += Update; | |
84 | } | 85 | } |
85 | 86 | ||
86 | public virtual LLVector3 StartPos | 87 | public virtual LLVector3 StartPos |
@@ -143,18 +144,9 @@ namespace SimpleApp | |||
143 | { | 144 | { |
144 | this.OnRegionHandShakeReply(this); | 145 | this.OnRegionHandShakeReply(this); |
145 | this.OnCompleteMovementToRegion(); | 146 | this.OnCompleteMovementToRegion(); |
146 | this.StartMovement(); | ||
147 | } | ||
148 | |||
149 | public void StartMovement() | ||
150 | { | ||
151 | Timer timer = new Timer(); | ||
152 | timer.Enabled = true; | ||
153 | timer.Interval = 500; | ||
154 | timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); | ||
155 | } | 147 | } |
156 | 148 | ||
157 | public void Heartbeat(object sender, EventArgs e) | 149 | private void Update( ) |
158 | { | 150 | { |
159 | Encoding enc = Encoding.ASCII; | 151 | Encoding enc = Encoding.ASCII; |
160 | 152 | ||
diff --git a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs index f5c6a0f..3828b9d 100644 --- a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs | |||
@@ -21,20 +21,15 @@ namespace SimpleApp | |||
21 | String instanceName = "_Total"; | 21 | String instanceName = "_Total"; |
22 | 22 | ||
23 | m_counter = new PerformanceCounter(objectName, counterName, instanceName); | 23 | m_counter = new PerformanceCounter(objectName, counterName, instanceName); |
24 | |||
25 | Timer timer = new Timer(); | ||
26 | timer.Enabled = true; | ||
27 | timer.Interval = 100; | ||
28 | timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); | ||
29 | |||
30 | } | 24 | } |
31 | 25 | ||
32 | public void Heartbeat(object sender, EventArgs e) | 26 | public override void Update( ) |
33 | { | 27 | { |
34 | float cpu = m_counter.NextValue() / 40f; | 28 | float cpu = m_counter.NextValue() / 40f; |
35 | LLVector3 size = new LLVector3(cpu, cpu, cpu); | 29 | LLVector3 size = new LLVector3(cpu, cpu, cpu); |
36 | rootPrimitive.ResizeGoup( size ); | 30 | rootPrimitive.ResizeGoup( size ); |
37 | update(); | 31 | |
32 | base.Update(); | ||
38 | } | 33 | } |
39 | } | 34 | } |
40 | } | 35 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs index cd69225..9749e22 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs | |||
@@ -74,24 +74,6 @@ namespace SimpleApp | |||
74 | avatar.Pos = new LLVector3(128, 128, 26); | 74 | avatar.Pos = new LLVector3(128, 128, 26); |
75 | } | 75 | } |
76 | 76 | ||
77 | public override void Update() | ||
78 | { | ||
79 | foreach (LLUUID UUID in Entities.Keys) | ||
80 | { | ||
81 | Entities[UUID].updateMovement(); | ||
82 | } | ||
83 | |||
84 | lock (this.m_syncRoot) | ||
85 | { | ||
86 | this.phyScene.Simulate(timeStep); | ||
87 | } | ||
88 | |||
89 | foreach (LLUUID UUID in Entities.Keys) | ||
90 | { | ||
91 | Entities[UUID].update(); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | #endregion | 77 | #endregion |
96 | } | 78 | } |
97 | } | 79 | } |
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 322db2c..9d798de 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs | |||
@@ -54,6 +54,7 @@ namespace SimpleApp | |||
54 | UDPServer udpServer; | 54 | UDPServer udpServer; |
55 | 55 | ||
56 | Scene scene = SetupScene(regionInfo, out udpServer); | 56 | Scene scene = SetupScene(regionInfo, out udpServer); |
57 | scene.StartTimer(); | ||
57 | 58 | ||
58 | udpServer.ServerListener(); | 59 | udpServer.ServerListener(); |
59 | 60 | ||
@@ -64,7 +65,7 @@ namespace SimpleApp | |||
64 | SceneObject m_sceneObject = new MySceneObject(scene, scene.EventManager, LLUUID.Zero, scene.PrimIDAllocate(), pos, shape); | 65 | SceneObject m_sceneObject = new MySceneObject(scene, scene.EventManager, LLUUID.Zero, scene.PrimIDAllocate(), pos, shape); |
65 | scene.AddEntity(m_sceneObject); | 66 | scene.AddEntity(m_sceneObject); |
66 | 67 | ||
67 | MyNpcCharacter m_character = new MyNpcCharacter(); | 68 | MyNpcCharacter m_character = new MyNpcCharacter( scene.EventManager ); |
68 | scene.AddNewClient(m_character, false); | 69 | scene.AddNewClient(m_character, false); |
69 | 70 | ||
70 | m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); | 71 | m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit."); |