aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2016-07-28 00:48:12 +0100
committerUbitUmarov2016-07-28 00:48:12 +0100
commit7a69b7d20d2e420f6cce29ae500b58300f885cff (patch)
tree8bc353a3966459718e0fe05e93d74987f8b1479e /OpenSim
parentremove references to RegionCombinerModule (diff)
downloadopensim-SC-7a69b7d20d2e420f6cce29ae500b58300f885cff.zip
opensim-SC-7a69b7d20d2e420f6cce29ae500b58300f885cff.tar.gz
opensim-SC-7a69b7d20d2e420f6cce29ae500b58300f885cff.tar.bz2
opensim-SC-7a69b7d20d2e420f6cce29ae500b58300f885cff.tar.xz
remove more code related to Mega regions
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/Border.cs148
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs2
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SceneGraph.cs71
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs340
4 files changed, 34 insertions, 527 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Border.cs b/OpenSim/Region/Framework/Scenes/Border.cs
deleted file mode 100644
index 08c0c31..0000000
--- a/OpenSim/Region/Framework/Scenes/Border.cs
+++ /dev/null
@@ -1,148 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenMetaverse;
32
33namespace OpenSim.Region.Framework.Scenes
34{
35 public class Border
36 {
37 /// <summary>
38 /// Line perpendicular to the Direction Cardinal. Z value is the
39 /// </summary>
40 public Vector3 BorderLine = Vector3.Zero;
41
42 /// <summary>
43 /// Direction cardinal of the border, think, 'which side of the region this is'. EX South border: Cardinal.S
44 /// </summary>
45 public Cardinals CrossDirection = Cardinals.N;
46 public uint TriggerRegionX = 0;
47 public uint TriggerRegionY = 0;
48
49 public Border()
50 {
51 }
52
53 /// <summary>
54 /// Creates a Border. The line is perpendicular to the direction cardinal.
55 /// IE: if the direction cardinal is South, the line is West->East
56 /// </summary>
57 /// <param name="lineStart">The starting point for the line of the border.
58 /// The position of an object must be greater then this for this border to trigger.
59 /// Perpendicular to the direction cardinal</param>
60 /// <param name="lineEnd">The ending point for the line of the border.
61 /// The position of an object must be less then this for this border to trigger.
62 /// Perpendicular to the direction cardinal</param>
63 /// <param name="triggerCoordinate">The position that triggers border the border
64 /// cross parallel to the direction cardinal. On the North cardinal, this
65 /// normally 256. On the South cardinal, it's normally 0. Any position past this
66 /// point on the cartesian coordinate will trigger the border cross as long as it
67 /// falls within the line start and the line end.</param>
68 /// <param name="triggerRegionX">When this border triggers, teleport to this regionX
69 /// in the grid</param>
70 /// <param name="triggerRegionY">When this border triggers, teleport to this regionY
71 /// in the grid</param>
72 /// <param name="direction">Cardinal for border direction. Think, 'which side of the
73 /// region is this'</param>
74 public Border(float lineStart, float lineEnd, float triggerCoordinate, uint triggerRegionX,
75 uint triggerRegionY, Cardinals direction)
76 {
77 BorderLine = new Vector3(lineStart,lineEnd,triggerCoordinate);
78 CrossDirection = direction;
79 TriggerRegionX = triggerRegionX;
80 TriggerRegionY = triggerRegionY;
81 }
82
83 /// <summary>
84 /// Tests to see if the given position would cross this border.
85 /// </summary>
86 /// <returns></returns>
87 public bool TestCross(Vector3 position)
88 {
89 bool result = false;
90 switch (CrossDirection)
91 {
92 case Cardinals.N: // x+0, y+1
93 if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y > BorderLine.Z)
94 {
95 return true;
96 }
97 break;
98 case Cardinals.NE: // x+1, y+1
99 break;
100 case Cardinals.E: // x+1, y+0
101 if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X > BorderLine.Z)
102 {
103 return true;
104 }
105 break;
106 case Cardinals.SE: // x+1, y-1
107 break;
108 case Cardinals.S: // x+0, y-1
109 if (position.X >= BorderLine.X && position.X <= BorderLine.Y && position.Y < BorderLine.Z)
110 {
111 return true;
112 }
113 break;
114 case Cardinals.SW: // x-1, y-1
115 break;
116 case Cardinals.W: // x-1, y+0
117 if (position.Y >= BorderLine.X && position.Y <= BorderLine.Y && position.X < BorderLine.Z)
118 {
119 return true;
120 }
121 break;
122 case Cardinals.NW: // x-1, y+1
123 break;
124 }
125
126 return result;
127 }
128
129 public float Extent
130 {
131 get
132 {
133 switch (CrossDirection)
134 {
135 case Cardinals.N:
136 break;
137 case Cardinals.S:
138 break;
139 case Cardinals.W:
140 break;
141 case Cardinals.E:
142 break;
143 }
144 return 0;
145 }
146 }
147 }
148}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 37352af..00e699e 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -430,7 +430,6 @@ namespace OpenSim.Region.Framework.Scenes
430 /// </summary> 430 /// </summary>
431 private int m_lastFrameTick; 431 private int m_lastFrameTick;
432 432
433 public bool CombineRegions = false;
434 /// <summary> 433 /// <summary>
435 /// Tick at which the last maintenance run occurred. 434 /// Tick at which the last maintenance run occurred.
436 /// </summary> 435 /// </summary>
@@ -1060,7 +1059,6 @@ namespace OpenSim.Region.Framework.Scenes
1060 1059
1061 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); 1060 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
1062 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); 1061 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
1063 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
1064 1062
1065 string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; 1063 string[] possibleMapConfigSections = new string[] { "Map", "Startup" };
1066 1064
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index f59518b..b65d168 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -298,45 +298,42 @@ namespace OpenSim.Region.Framework.Scenes
298 protected internal bool AddRestoredSceneObject( 298 protected internal bool AddRestoredSceneObject(
299 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) 299 SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
300 { 300 {
301 if (!m_parentScene.CombineRegions) 301 // temporary checks to remove after varsize suport
302 { 302 float regionSizeX = m_parentScene.RegionInfo.RegionSizeX;
303 // temporary checks to remove after varsize suport 303 if (regionSizeX == 0)
304 float regionSizeX = m_parentScene.RegionInfo.RegionSizeX; 304 regionSizeX = Constants.RegionSize;
305 if (regionSizeX == 0) 305 float regionSizeY = m_parentScene.RegionInfo.RegionSizeY;
306 regionSizeX = Constants.RegionSize; 306 if (regionSizeY == 0)
307 float regionSizeY = m_parentScene.RegionInfo.RegionSizeY; 307 regionSizeY = Constants.RegionSize;
308 if (regionSizeY == 0) 308
309 regionSizeY = Constants.RegionSize; 309 // KF: Check for out-of-region, move inside and make static.
310 310 Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X,
311 // KF: Check for out-of-region, move inside and make static. 311 sceneObject.RootPart.GroupPosition.Y,
312 Vector3 npos = new Vector3(sceneObject.RootPart.GroupPosition.X, 312 sceneObject.RootPart.GroupPosition.Z);
313 sceneObject.RootPart.GroupPosition.Y, 313 bool clampZ = m_parentScene.ClampNegativeZ;
314 sceneObject.RootPart.GroupPosition.Z); 314
315 bool clampZ = m_parentScene.ClampNegativeZ; 315 if (!(((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0))) && (npos.X < 0.0 || npos.Y < 0.0 || (npos.Z < 0.0 && clampZ) ||
316 316 npos.X > regionSizeX ||
317 if (!(((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0))) && (npos.X < 0.0 || npos.Y < 0.0 || (npos.Z < 0.0 && clampZ) || 317 npos.Y > regionSizeY))
318 npos.X > regionSizeX || 318 {
319 npos.Y > regionSizeY)) 319 if (npos.X < 0.0) npos.X = 1.0f;
320 if (npos.Y < 0.0) npos.Y = 1.0f;
321 if (npos.Z < 0.0 && clampZ) npos.Z = 0.0f;
322 if (npos.X > regionSizeX) npos.X = regionSizeX - 1.0f;
323 if (npos.Y > regionSizeY) npos.Y = regionSizeY - 1.0f;
324
325 SceneObjectPart rootpart = sceneObject.RootPart;
326 rootpart.GroupPosition = npos;
327
328 foreach (SceneObjectPart part in sceneObject.Parts)
320 { 329 {
321 if (npos.X < 0.0) npos.X = 1.0f; 330 if (part == rootpart)
322 if (npos.Y < 0.0) npos.Y = 1.0f; 331 continue;
323 if (npos.Z < 0.0 && clampZ) npos.Z = 0.0f; 332 part.GroupPosition = npos;
324 if (npos.X > regionSizeX) npos.X = regionSizeX - 1.0f;
325 if (npos.Y > regionSizeY) npos.Y = regionSizeY - 1.0f;
326
327 SceneObjectPart rootpart = sceneObject.RootPart;
328 rootpart.GroupPosition = npos;
329
330 foreach (SceneObjectPart part in sceneObject.Parts)
331 {
332 if (part == rootpart)
333 continue;
334 part.GroupPosition = npos;
335 }
336 rootpart.Velocity = Vector3.Zero;
337 rootpart.AngularVelocity = Vector3.Zero;
338 rootpart.Acceleration = Vector3.Zero;
339 } 333 }
334 rootpart.Velocity = Vector3.Zero;
335 rootpart.AngularVelocity = Vector3.Zero;
336 rootpart.Acceleration = Vector3.Zero;
340 } 337 }
341 338
342 bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); 339 bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
deleted file mode 100644
index e209221..0000000
--- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
+++ /dev/null
@@ -1,340 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Text;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Tests.Common;
36
37namespace OpenSim.Region.Framework.Scenes.Tests
38{
39 [TestFixture]
40 public class BorderTests : OpenSimTestCase
41 {
42 [Test]
43 public void TestCross()
44 {
45 TestHelpers.InMethod();
46
47 List<Border> testborders = new List<Border>();
48
49 Border NorthBorder = new Border();
50 NorthBorder.BorderLine = new Vector3(0, 256, 256); //<---
51 NorthBorder.CrossDirection = Cardinals.N;
52 testborders.Add(NorthBorder);
53
54 Border SouthBorder = new Border();
55 SouthBorder.BorderLine = new Vector3(0, 256, 0); //--->
56 SouthBorder.CrossDirection = Cardinals.S;
57 testborders.Add(SouthBorder);
58
59 Border EastBorder = new Border();
60 EastBorder.BorderLine = new Vector3(0, 256, 256); //<---
61 EastBorder.CrossDirection = Cardinals.E;
62 testborders.Add(EastBorder);
63
64 Border WestBorder = new Border();
65 WestBorder.BorderLine = new Vector3(0, 256, 0); //--->
66 WestBorder.CrossDirection = Cardinals.W;
67 testborders.Add(WestBorder);
68
69 Vector3 position = new Vector3(200,200,21);
70
71 foreach (Border b in testborders)
72 Assert.That(!b.TestCross(position));
73
74 position = new Vector3(200,280,21);
75 Assert.That(NorthBorder.TestCross(position));
76
77 // Test automatic border crossing
78 // by setting the border crossing aabb to be the whole region
79 position = new Vector3(25,25,21); // safely within one 256m region
80
81 // The Z value of the BorderLine is reversed, making all positions within the region
82 // trigger bordercross
83
84 SouthBorder.BorderLine = new Vector3(0,256,256); // automatic border cross in the region
85 Assert.That(SouthBorder.TestCross(position));
86
87 NorthBorder.BorderLine = new Vector3(0, 256, 0); // automatic border cross in the region
88 Assert.That(NorthBorder.TestCross(position));
89
90 EastBorder.BorderLine = new Vector3(0, 256, 0); // automatic border cross in the region
91 Assert.That(EastBorder.TestCross(position));
92
93 WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region
94 Assert.That(WestBorder.TestCross(position));
95 }
96
97 [Test]
98 public void TestCrossSquare512()
99 {
100 TestHelpers.InMethod();
101
102 List<Border> testborders = new List<Border>();
103
104 Border NorthBorder = new Border();
105 NorthBorder.BorderLine = new Vector3(0, 512, 512);
106 NorthBorder.CrossDirection = Cardinals.N;
107 testborders.Add(NorthBorder);
108
109 Border SouthBorder = new Border();
110 SouthBorder.BorderLine = new Vector3(0, 512, 0);
111 SouthBorder.CrossDirection = Cardinals.S;
112 testborders.Add(SouthBorder);
113
114 Border EastBorder = new Border();
115 EastBorder.BorderLine = new Vector3(0, 512, 512);
116 EastBorder.CrossDirection = Cardinals.E;
117 testborders.Add(EastBorder);
118
119 Border WestBorder = new Border();
120 WestBorder.BorderLine = new Vector3(0, 512, 0);
121 WestBorder.CrossDirection = Cardinals.W;
122 testborders.Add(WestBorder);
123
124 Vector3 position = new Vector3(450,220,21);
125
126 foreach (Border b in testborders)
127 {
128 Assert.That(!b.TestCross(position));
129
130 }
131
132 //Trigger east border
133 position = new Vector3(513,220,21);
134 foreach (Border b in testborders)
135 {
136 if (b.CrossDirection == Cardinals.E)
137 Assert.That(b.TestCross(position));
138 else
139 Assert.That(!b.TestCross(position));
140
141 }
142
143 //Trigger west border
144 position = new Vector3(-1, 220, 21);
145 foreach (Border b in testborders)
146 {
147 if (b.CrossDirection == Cardinals.W)
148 Assert.That(b.TestCross(position));
149 else
150 Assert.That(!b.TestCross(position));
151
152 }
153
154 //Trigger north border
155 position = new Vector3(220, 513, 21);
156 foreach (Border b in testborders)
157 {
158 if (b.CrossDirection == Cardinals.N)
159 Assert.That(b.TestCross(position));
160 else
161 Assert.That(!b.TestCross(position));
162
163 }
164
165 //Trigger south border
166 position = new Vector3(220, -1, 21);
167 foreach (Border b in testborders)
168 {
169 if (b.CrossDirection == Cardinals.S)
170 Assert.That(b.TestCross(position));
171 else
172 Assert.That(!b.TestCross(position));
173
174 }
175 }
176
177 [Test]
178 public void TestCrossRectangle512x256()
179 {
180 TestHelpers.InMethod();
181
182 List<Border> testborders = new List<Border>();
183
184 Border NorthBorder = new Border();
185 NorthBorder.BorderLine = new Vector3(0, 512, 256);
186 NorthBorder.CrossDirection = Cardinals.N;
187 testborders.Add(NorthBorder);
188
189 Border SouthBorder = new Border();
190 SouthBorder.BorderLine = new Vector3(0, 512, 0);
191 SouthBorder.CrossDirection = Cardinals.S;
192 testborders.Add(SouthBorder);
193
194 Border EastBorder = new Border();
195 EastBorder.BorderLine = new Vector3(0, 256, 512);
196 EastBorder.CrossDirection = Cardinals.E;
197 testborders.Add(EastBorder);
198
199 Border WestBorder = new Border();
200 WestBorder.BorderLine = new Vector3(0, 256, 0);
201 WestBorder.CrossDirection = Cardinals.W;
202 testborders.Add(WestBorder);
203
204 Vector3 position = new Vector3(450, 220, 21);
205
206 foreach (Border b in testborders)
207 {
208 Assert.That(!b.TestCross(position));
209
210 }
211
212 //Trigger east border
213 position = new Vector3(513, 220, 21);
214 foreach (Border b in testborders)
215 {
216 if (b.CrossDirection == Cardinals.E)
217 Assert.That(b.TestCross(position));
218 else
219 Assert.That(!b.TestCross(position));
220
221 }
222
223 //Trigger west border
224 position = new Vector3(-1, 220, 21);
225 foreach (Border b in testborders)
226 {
227 if (b.CrossDirection == Cardinals.W)
228 Assert.That(b.TestCross(position));
229 else
230 Assert.That(!b.TestCross(position));
231
232 }
233
234 //Trigger north border
235 position = new Vector3(220, 257, 21);
236 foreach (Border b in testborders)
237 {
238 if (b.CrossDirection == Cardinals.N)
239 Assert.That(b.TestCross(position));
240 else
241 Assert.That(!b.TestCross(position));
242
243 }
244
245 //Trigger south border
246 position = new Vector3(220, -1, 21);
247 foreach (Border b in testborders)
248 {
249 if (b.CrossDirection == Cardinals.S)
250 Assert.That(b.TestCross(position));
251 else
252 Assert.That(!b.TestCross(position));
253
254 }
255 }
256
257 [Test]
258 public void TestCrossOdd512x512w256hole()
259 {
260 TestHelpers.InMethod();
261
262 List<Border> testborders = new List<Border>();
263 // 512____
264 // | |
265 // 256__| |___
266 // | |
267 // |______|
268 // 0 | 512
269 // 256
270
271 // Compound North border since the hole is at the top
272 Border NorthBorder1 = new Border();
273 NorthBorder1.BorderLine = new Vector3(0, 256, 512);
274 NorthBorder1.CrossDirection = Cardinals.N;
275 testborders.Add(NorthBorder1);
276
277 Border NorthBorder2 = new Border();
278 NorthBorder2.BorderLine = new Vector3(256, 512, 256);
279 NorthBorder2.CrossDirection = Cardinals.N;
280 testborders.Add(NorthBorder2);
281
282 Border SouthBorder = new Border();
283 SouthBorder.BorderLine = new Vector3(0, 512, 0);
284 SouthBorder.CrossDirection = Cardinals.S;
285 testborders.Add(SouthBorder);
286
287 //Compound East border
288 Border EastBorder1 = new Border();
289 EastBorder1.BorderLine = new Vector3(0, 256, 512);
290 EastBorder1.CrossDirection = Cardinals.E;
291 testborders.Add(EastBorder1);
292
293 Border EastBorder2 = new Border();
294 EastBorder2.BorderLine = new Vector3(257, 512, 256);
295 EastBorder2.CrossDirection = Cardinals.E;
296 testborders.Add(EastBorder2);
297
298
299
300 Border WestBorder = new Border();
301 WestBorder.BorderLine = new Vector3(0, 512, 0);
302 WestBorder.CrossDirection = Cardinals.W;
303 testborders.Add(WestBorder);
304
305 Vector3 position = new Vector3(450, 220, 21);
306
307 foreach (Border b in testborders)
308 {
309 Assert.That(!b.TestCross(position));
310
311 }
312
313 position = new Vector3(220, 450, 21);
314
315 foreach (Border b in testborders)
316 {
317 Assert.That(!b.TestCross(position));
318
319 }
320
321 bool result = false;
322 int bordersTriggered = 0;
323
324 position = new Vector3(450, 450, 21);
325
326 foreach (Border b in testborders)
327 {
328 if (b.TestCross(position))
329 {
330 bordersTriggered++;
331 result = true;
332 }
333 }
334
335 Assert.That(result);
336 Assert.That(bordersTriggered == 2);
337
338 }
339 }
340}