Implemented a new method on ZONE:BoundZone

Creates a visual boundary around a ZONE_* of tires with a white flag.
These tires will also move when the ZONE is "rebound".
This commit is contained in:
FlightControl
2017-03-05 09:32:17 +01:00
parent 5793e04aeb
commit f7bf997511
11 changed files with 489 additions and 90 deletions

View File

@@ -0,0 +1,32 @@
---
-- Name: ZON-100 - Normal Zone
-- Author: FlightControl
-- Date Created: 21 Feb 2017
--
-- # Situation:
--
-- A ZONE has been defined, which boundaries are smoking.
-- A vehicle is driving through the zone perimeters.
-- When the vehicle is driving in the zone, a red smoke is fired from the vehicle location.
--
-- # Test cases:
--
-- 1. Observe the zone perimeter smoke.
-- 2. Observe the vehicle smoking a red smoke when driving through the zone.
local GroupInside = GROUP:FindByName( "Test Inside Polygon" )
local GroupOutside = GROUP:FindByName( "Test Outside Polygon" )
local ZoneA = ZONE:New( "Zone A" )
ZoneA:BoundZone( 90 )
Messager = SCHEDULER:New( nil,
function()
GroupInside:MessageToAll( ( GroupInside:IsCompletelyInZone( ZoneA ) ) and "Inside Zone A" or "Outside Zone A", 1 )
if GroupInside:IsCompletelyInZone( ZoneA ) then
GroupInside:GetUnit(1):SmokeRed()
end
end,
{}, 0, 1 )

View File

@@ -0,0 +1,33 @@
---
-- Name: ZON-502 - Polygon Zone Boundary
-- Author: FlightControl
-- Date Created: 18 Feb 2017
--
-- # Situation:
--
-- A ZONE_POLYGON has been defined, which boundaries are tires.
-- A vehicle is driving through the zone perimeters.
-- When the vehicle is driving in the zone, a red smoke is fired from the vehicle location.
--
-- # Test cases:
--
-- 1. Observe the polygon perimeter smoke.
-- 2. Observe the vehicle smoking a red smoke when driving through the zone.
local GroupInside = GROUP:FindByName( "Test Inside Polygon" )
local GroupOutside = GROUP:FindByName( "Test Outside Polygon" )
local GroupPolygon = GROUP:FindByName( "Polygon A" )
local PolygonZone = ZONE_POLYGON:New( "Polygon A", GroupPolygon )
PolygonZone:BoundZone()
Messager = SCHEDULER:New( nil,
function()
GroupInside:MessageToAll( ( GroupInside:IsCompletelyInZone( PolygonZone ) ) and "Inside Polygon A" or "Outside Polygon A", 1 )
if GroupInside:IsCompletelyInZone( PolygonZone ) then
GroupInside:GetUnit(1):SmokeRed()
end
end,
{}, 0, 1 )