New SPAWN class methods

-- Added SpawnFromVec3
-- Added SpawnFromVec2
-- Revised SpawnFromUnit
-- Revised SpawnFromZone
-- Added POINT_VEC3:GetVec2()
-- Added POINT_VEC3:GetRandomVec2InRadius()
-- Added POINT_VEC2:NewFromVec2()
-- Revised the STATIC class working with POISITIONABLE
-- Revised ZONE_RADIUS:GetPointVec3
--
This commit is contained in:
FlightControl
2016-07-23 10:31:52 +02:00
parent a634fbb33c
commit 231b382df1
58 changed files with 787 additions and 311 deletions

View File

@@ -0,0 +1,50 @@
local Iterations = 10
local Iteration = 1
GroundStatics = { "GroundStatic1", "GroundStatic2", "GroundStatic3" }
AirplaneStatics = { "AirplaneStatic1", "AirplaneStatic2", "AirplaneStatic3" }
HelicopterStatics = { "HelicopterStatic1", "HelicopterStatic2", "HelicopterStatic3" }
ShipStatics = { "ShipStatic1", "ShipStatic2", "ShipStatic3" }
HeightLimit = 500
SpawnGrounds = SPAWN:New("Ground"):Limit( 20, 10 )
SpawnAirplanes = SPAWN:New("Airplane"):Limit( 20, 10 )
SpawnHelicopters = SPAWN:New("Helicopter"):Limit( 20, 10 )
SpawnShips = SPAWN:New("Ship"):Limit( 20, 10 )
--- Spawns these groups slowly.
SCHEDULER:New( nil,
function( Interation, Iterations )
do
-- Spawn Ground
local StaticName = GroundStatics[ math.random( 1, 3 ) ]
local SpawnStatic = STATIC:FindByName( StaticName )
SpawnGrounds:SpawnFromUnit( SpawnStatic, 500, 100 )
end
do
-- Spawn Airplanes
local StaticName = AirplaneStatics[ math.random( 1, 3 ) ]
local SpawnStatic = STATIC:FindByName( StaticName )
SpawnAirplanes:SpawnFromUnit( SpawnStatic, 500, 100 )
end
do
-- Spawn Helicopters
local StaticName = HelicopterStatics[ math.random( 1, 3 ) ]
local SpawnStatic = STATIC:FindByName( StaticName )
SpawnHelicopters:SpawnFromUnit( SpawnStatic, 500, 100 )
end
do
-- Spawn Ships
local StaticName = ShipStatics[ math.random( 1, 3 ) ]
local SpawnStatic = STATIC:FindByName( StaticName )
SpawnShips:SpawnFromUnit( SpawnStatic, 500, 100 )
end
end, {}, 0, 15, 0.5
)

View File

@@ -0,0 +1,50 @@
local Iterations = 10
local Iteration = 1
GroundUnits = { "GroundUnit1", "GroundUnit2", "GroundUnit3" }
AirplaneUnits = { "AirplaneUnit1", "AirplaneUnit2", "AirplaneUnit3" }
HelicopterUnits = { "HelicopterUnit1", "HelicopterUnit2", "HelicopterUnit3" }
ShipUnits = { "ShipUnit1", "ShipUnit2", "ShipUnit3" }
HeightLimit = 500
SpawnGrounds = SPAWN:New("Ground"):Limit( 20, 10 )
SpawnAirplanes = SPAWN:New("Airplane"):Limit( 20, 10 )
SpawnHelicopters = SPAWN:New("Helicopter"):Limit( 20, 10 )
SpawnShips = SPAWN:New("Ship"):Limit( 20, 10 )
--- Spawns these groups slowly.
SCHEDULER:New( nil,
function( Interation, Iterations )
do
-- Spawn Ground
local UnitName = GroundUnits[ math.random( 1, 3 ) ]
local SpawnUnit = UNIT:FindByName( UnitName )
SpawnGrounds:SpawnFromUnit( SpawnUnit, 10, 3 )
end
do
-- Spawn Airplanes
local UnitName = AirplaneUnits[ math.random( 1, 3 ) ]
local SpawnUnit = UNIT:FindByName( UnitName )
SpawnAirplanes:SpawnFromUnit( SpawnUnit )
end
do
-- Spawn Helicopters
local UnitName = HelicopterUnits[ math.random( 1, 3 ) ]
local SpawnUnit = UNIT:FindByName( UnitName )
SpawnHelicopters:SpawnFromUnit( SpawnUnit )
end
do
-- Spawn Ships
local UnitName = ShipUnits[ math.random( 1, 3 ) ]
local SpawnUnit = UNIT:FindByName( UnitName )
SpawnShips:SpawnFromUnit( SpawnUnit )
end
end, {}, 0, 15, 0.5
)

View File

@@ -0,0 +1,50 @@
local Iterations = 10
local Iteration = 1
GroundZones = { "GroundZone1", "GroundZone2", "GroundZone3" }
AirplaneZones = { "AirplaneZone1", "AirplaneZone2", "AirplaneZone3" }
HelicopterZones = { "HelicopterZone1", "HelicopterZone2", "HelicopterZone3" }
ShipZones = { "ShipZone1", "ShipZone2", "ShipZone3" }
HeightLimit = 500
SpawnGrounds = SPAWN:New("Ground"):Limit( 20, 10 )
SpawnAirplanes = SPAWN:New("Airplane"):Limit( 20, 10 )
SpawnHelicopters = SPAWN:New("Helicopter"):Limit( 20, 10 )
SpawnShips = SPAWN:New("Ship"):Limit( 20, 10 )
--- Spawns these groups slowly.
SCHEDULER:New( nil,
function( Interation, Iterations )
do
-- Spawn Ground
local ZoneName = GroundZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnGrounds:SpawnFromVec2( SpawnVec3:GetVec2(), 500, 100 )
end
do
-- Spawn Airplanes
local ZoneName = AirplaneZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnAirplanes:SpawnFromVec2( SpawnVec3:GetVec2(), 500, 100 )
end
do
-- Spawn Helicopters
local ZoneName = HelicopterZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnHelicopters:SpawnFromVec2( SpawnVec3:GetVec2(), 500, 100 )
end
do
-- Spawn Ships
local ZoneName = ShipZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnShips:SpawnFromVec2( SpawnVec3:GetVec2(), 500, 100 )
end
end, {}, 0, 15, 0.5
)

View File

@@ -0,0 +1,50 @@
local Iterations = 10
local Iteration = 1
GroundZones = { "GroundZone1", "GroundZone2", "GroundZone3" }
AirplaneZones = { "AirplaneZone1", "AirplaneZone2", "AirplaneZone3" }
HelicopterZones = { "HelicopterZone1", "HelicopterZone2", "HelicopterZone3" }
ShipZones = { "ShipZone1", "ShipZone2", "ShipZone3" }
HeightLimit = 500
SpawnGrounds = SPAWN:New("Ground"):Limit( 20, 10 )
SpawnAirplanes = SPAWN:New("Airplane"):Limit( 20, 10 )
SpawnHelicopters = SPAWN:New("Helicopter"):Limit( 20, 10 )
SpawnShips = SPAWN:New("Ship"):Limit( 20, 10 )
--- Spawns these groups slowly.
SCHEDULER:New( nil,
function( Interation, Iterations )
do
-- Spawn Ground
local ZoneName = GroundZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnGrounds:SpawnFromVec3( SpawnVec3:GetVec3(), 500, 100 )
end
do
-- Spawn Airplanes
local ZoneName = AirplaneZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnAirplanes:SpawnFromVec3( SpawnVec3:GetVec3(), 500, 100 )
end
do
-- Spawn Helicopters
local ZoneName = HelicopterZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnHelicopters:SpawnFromVec3( SpawnVec3:GetVec3(), 500, 100 )
end
do
-- Spawn Ships
local ZoneName = ShipZones[ math.random( 1, 3 ) ]
local SpawnVec3 = POINT_VEC3:NewFromVec3( ZONE:New( ZoneName ):GetPointVec3() )
SpawnShips:SpawnFromVec3( SpawnVec3:GetVec3(), 500, 100 )
end
end, {}, 0, 15, 0.5
)