Map - alexneargarder/Broforce-Docs GitHub Wiki
-
Combat & Damage
-
Methods
- BlindUnits
- BurnBlocksAround
- BurnDamageBlock
- BurnLargeObjects
- BurnLargeObjects
- BurnUnitsAround_Local
- CanRollOntoUnits
- CheckForCorpse
- CollectUnits
- ConstrainToBlocks
- CrushUnitsAgainstWalls
- CrushUnitsAgainstWallsHorizontal
- CrushUnitsAgainstWallsVertical
- DamageBackground
- DamageBackground
- DamageBackground
- DecapitateUnits
- DoLevelEndExplosions
- ExplodeUnits
- FivePointPalmExplodingHeartTechnique
- FreezeUnits
- GeLivingtUnit
- GetFirstUnit
- GetNearbyMook
- GetNearbyMookVertical
- HeadShotUnit
- HitAllLivingUnits
- HitAllLivingUnits
- HitClosestUnit
- HitDeadUnits
- HitHellUnits
- HitLivingHeroes
- HitLivingUnits
- HitLivingUnits
- HitUnits
- HitUnits
- HitUnits
- HitUnits
- HitUnits
- HitUnits
- HitUnits
- HitUnits
- HitUnits
- HitUnits
- HitUnits
- HitUnits
- HitUnits
- HitUnitsWithArrow
- InseminateUnits
- KnockAndDamageUnit
- KnockAndDamageUnit
- KnockMooks
- KnockUnits
- MakeAllBlocksUltraTough
- MakeLevelEndExplosion
- PopulateLevelEndExplosionBank
- RegisterTargetableObject
- RemoveTargetableObject
- ReviveDeadUnits
- RollOntoUnits
- StartLevelEndExplosions
- StartLevelEndExplosionsOverNetwork
- StunUnits
- TearGasUnits
- WhipUnits
- Fields
-
Methods
-
Position & Physics
-
Methods
- AddSlime
- AddTaggedObject
- CallFakeHelicopter
- CallFakeHelicopter
- CallFakeHelicopter
- CheckCheckPoint
- CheckPersistBlocksPastLevelLoad
- CheckPersistBlocksPastLevelLoad
- CheckPersistBlocksPastLevelLoad
- ClearPersistenBlocksInstant
- ClearPersistenBlocksInstant
- ClearPersistenBlocksInstant
- ConstrainToBlocks
- Create4AmmoAndRevives
- Create4AmmoAndRevives
- Create4AmmoAndRevives
- CreateExitPortal
- CreateExitPortal
- CreateExitPortal
- CreateRemoteControlCar
- CrossProduct
- DamageDoodadByTag
- DestroyPersistantBlocks
- DestroyPersistantBlocks
- DestroyPersistantBlocks
- Distance
- Distance
- Distance
- DoesForegroundBlockHaveBackground
- DoesForegroundBlockHaveBackground
- DontPersistBlocks
- DontPersistBlocks
- DontPersistBlocks
- DotProduct
- FindHoleToJumpThroughAndAppear
- FindLadderNearPosition
- FindLadderNearPosition
- FindLargeBlockDimensions
- FindStartLocation
- GetAmmoCrateFrequency
- GetBlockCenter
- GetBlocksXY
- GetBlocksXYPosition
- GetCheckPoint
- GetCheckPointAirHeight
- GetCollumn
- GetDoodadByTag
- GetDoodadsByTag
- GetGroundHeight
- GetLeafColor
- GetMaxCollumns
- GetMaxRows
- GetNearbyCheckPoint
- GetNearestCheckPoint
- GetNearestCheckPointToRight
- GetNearestRescueBro
- GetRow
- GetRowCollumn
- GetSpawnPoint
- GetSpawnPointPosition
- GetUnitXOffset
- HasSandStormTrigger
- HasSandStormTrigger
- HasSandStormTrigger
- HasThisMapGotAliens
- HasThisMapGotAliens
- HasThisMapGotAliens
- InsideWall
- IsBackgroundBlock
- IsBlockCompatible
- IsBlockDestroyed
- IsBlockEmpty
- IsBlockFacingOpen
- IsBlockFloor
- IsBlockLadder
- IsBlockLadder
- IsBlockQuicksand
- IsBlockQuicksand
- IsBlockSandbag
- IsBlockSolid
- IsBlockSolid
- IsBlockSolidTerrain
- IsBlockSolidTerrain
- IsBlockSolidToWater
- IsCheckPointAnAirdrop
- IsCitizenNearby
- IsCitizenNearby
- IsCitizenNearby
- IsCollumnEmpty
- IsForegroundBlock
- IsGround
- IsGroundEmpty
- IsGroundTypeSolid
- IsMapOpenAboveCrate
- IsMapOpenAboveCrate
- IsMapOpenAboveCrate
- IsNearActivatedCheckPoint
- IsNearActivatedCheckPoint
- IsNearActivatedCheckPoint
- IsOverBackground
- IsOverGround
- IsTerrainCompatible
- IsTerrainTheSame
- LineToPointDistance2D
- LineToPointDistance2D
- LineToPointDistance2D
- LoadArea
- MakeBlockPersist
- MakeBlockPersist
- MakeBlockPersist
- Persist
- Persist
- Persist
- PersistBlocks
- PersistBlocks
- PersistBlocks
- PlaceGround
- PushBlock
- PushBlock
- RegisterCheckPoint
- RegisterSpawnPoint
- RemoveCheckPoint
- ReplaceCagesWithAmmoAndRevives
- ReplaceCagesWithAmmoAndRevives
- ReplaceCagesWithAmmoAndRevives
- ReplaceCageWithAmmoAndRevives
- ReplaceCageWithAmmoAndRevives
- ReplaceCageWithAmmoAndRevives
- SetStartFromHorizontalSuperCheckPoint
- SetStartFromHorizontalSuperCheckPoint
- SetStartFromHorizontalSuperCheckPoint
- SetStartFromSuperCheckPoint
- SetStartFromSuperCheckPoint
- SetStartFromSuperCheckPoint
- SetStartFromVerticalSuperCheckPoint
- SetStartFromVerticalSuperCheckPoint
- SetStartFromVerticalSuperCheckPoint
- SetTryReduceLoadingTimes
- SetTryReduceLoadingTimes
- SetTryReduceLoadingTimes
- TryingToReduceLoadingTimes
- TryingToReduceLoadingTimes
- TryingToReduceLoadingTimes
- WasBlockEarth
- WasBlockOriginallyAir
- WasBlockOriginallySolid
-
Fields
- barrierLayer
- cameraBlockers
- checkPoints
- defaultLayer
- exitPortalPrefabReference
- fragileLayer
- groundAndDamageableObjects
- groundLayer
- groundLayerStrict
- hangingLayer
- highestSolidBlock
- highestSolidBlockLadder
- ladderLayer
- largeObjectsLayer
- maxCollumnActive
- maxUnitX
- maxUnitY
- minCollumnActive
- minRowActive
- minUnitX
- minUnitY
- nearestCheckPoint
- platformLayer
- spawnPointInvisiblePrefabReference
- spawnPointOffset
- spawnPointPrefabReference
- spawnPoints
- startFromSuperCheckPoint
- superCheckpointStartPos
- switchesLayer
- TileSize
- TileSize
- TileSize
- unitLayer
- unitOffsetCount
- victoryLayer
- waterLayer
-
Methods
-
Environmental Objects
-
Methods
- BloodyDoodads
- DamageDoodads
- DamageStaticDoodads
- DisturbAlienEggs
- DisturbWildLife
- GeTargetableObjectsInRange
- GetDoodadVariationAmount
- GetNearbyMookSwitch
- GetNearbySwitch
- GetNearbyTeleportDoor
- GetNearestAcid
- GetNextClosestTargetableObject
- GetNextClosestTargetableObjectOnScreen
- GetOtherZiplinePoint
- GetStaticDoodad
- HurtWildLife
- IsInSubstance
- JiggleDoodads
- JiggleSlime
- PassThroughScenery
- PlaceDoodad
- RegisterAlienEggExplosive
- RegisterAlienTelepathyTrigger
- RegisterCage
- RegisterCameraBlocker
- RegisterDamageableScenerye
- RegisterDecalDoodad
- RegisterDestroyableDoodad
- RegisterGrassAndBlood
- RegisterHelicopter
- RegisterJigglyBit
- RegisterMookDoor
- RegisterStaticDoodad
- RegisterSwitch
- RegisterTeleportDoor
- RegisterTreeFoliage
- RemoveAlienEggExplosive
- RemoveAlienTelepathyTrigger
- RemoveCage
- RemoveCameraBlocker
- RemoveDecalDoodad
- RemoveDestroyableDoodad
- RemoveGrassOrBlood
- RemoveJigglyBit
- RemoveMookDoor
- RemoveStaticDoodad
- RemoveSwitch
- RemoveTeleportDoor
- ResetZiplines
- SetOilAlight
- ShakeTrees
-
Fields
- acidPools
- alienTelepathyTriggers
- cages
- damageableScenery
- decalDoodads
- destroyableDoodads
- entranceDoors
- exitDoors
- exitPortalNID
- grassAndBlood
- jigglySlime
- LevelEndExplosionActiveList
- LevelEndExplosionBank
- LevelEndExplosionBankSizeInc
- mookDoors
- remoteCarPrefabReference
- ropePrefabReference
- staticDoodads
- switches
- teleportDoors
- treeFoliage
-
Methods
-
Unit Management
-
Methods
- GetNearestEnemyUnit
- GetNearestEnemyUnit
- GetNearestEvilUnit
- GetNearestHero
- GetNearestUnit
- GetNearestUnitWithXBias
- GetNearestVisibleDeadUnit
- GetNearestVisibleUnit
- GetNearestVisibleUnitDamagebleBy
- GetNextClosestUnit
- GetNextClosestUnitOnScreen
- GetUnitCountInRange
- GetUnitsInRange
- GetUnitsInRange
- GetUnitsInRange
- GetUnitsInRange
- IsEnemyUnitNearby
- IsEnemyUnitNearby
- IsUnitInRange
- IsUnitNearby
- IsUnitNearby
- RegisterCitizen
- RegisterDisturbedWildLife
- RegisterUnit
- RegisterWildLife
- RemoveCitizen
- RemoveDisturbedWildLife
- RemoveUnit
- RemoveWildLife
- SpawnFaceBaneling
- SpawnFaceHugger
- Fields
-
Methods
-
AI & Player Management
-
Methods
- ActivateNearbyAlienTelepathyTriggers
- AddBroToHeroTransport
- AlertNearbyMooks
- AlertNearbyMooks
- AttractAliens
- AttractMooks
- BotherNearbyMooks
- CallInHeroTransportAnyway
- CallInTransport
- CallInTransport_RPC
- CanSeeNPCEnemyUnit
- CanSeeNPCEnemyUnit
- CanSeeNPCEnemyUnit
- CanSeeNPCEnemyUnitWithPosition
- CanSeePosition
- CanSeePosition
- CheckHighFive
- EnemyDeathEvent
- ForgetPlayer
- ForgetPlayer
- ForgetPlayer
- GetNearbyUnalertedMook
- GetNearestMookDoor
- GetNearestMookInterestPoint
- HeroTransportHasEntered
- MakeMooksDance
- PanicUnits
- PanicUnits
- PanicUnits
- PanicUnits
- PanicUnits
- RegisterEnemyDeathListener
- RegisterFetchObject
- RegisterHeroWatcher
- RegisterMookInterestPoint
- RemoveEnemyDeathListener
- RemoveHeroWatcher
- RemoveMookInterestPoint
- StunMooks
- Fields
-
Methods
-
Projectile & Explosive Management
-
Methods
- DamageProjectile
- DeflectProjectiles
- GetGrenadesInRange
- GetNearbyGrenade
- GetNearbySachelPack
- GetProjectilesInRange
- HitGrenades
- HitProjectiles
- HitProjectiles
- RegisterDamageableProjectile
- RegisterGrenade
- RegisterProjectile
- RegisterSachelPack
- RegisterShootableGrenade
- RemoveGrenade
- RemoveProjectile
- RemoveSachelPack
- RemoveShootableGrenade
- Fields
-
Methods
- Core & Instance Management
-
Map Data & State
-
Methods
- AssignBlock
- ClearBackgroundBlock
- ClearForegroundBlock
- CollapseTop
- CollapseTopLadders
- DeactivateHalfTheMap
- ExtendDisableToUnitPosition
- GetBackgroundBlock
- GetBackgroundGroundType
- GetBlock
- GetBlock
- GetBlockCenter
- GetBlockCenterX
- GetBlockCenterY
- GetBlockExcludingDestroyed
- GetBlocksX
- GetBlocksY
- GetCenterPosition
- GetDescentOffset
- GetGridPoint
- GetGridPoint
- GetGroundType
- GetHighestSolidBlock
- GetPosition
- InitializeDeactivationOffscreen
- IsBlockInvulnerable
- IsBlockSolid
- IsInvulnerableAbove
- IsWithinBounds
- IsWithinBounds
- RotateBlock
- RunDeactivationOffscreen
- SetBackgroundBlockEmpty
- SetBlockEmpty
- Properties
-
Fields
- _hasSpawnedFlexPower
- _mapData
- americaThemeReference
- barrelBlockCount
- burningJungleThemeReference
- cagesSinceLastHardcoreCage
- cityThemeReference
- currentBackgroundBlock
- currentBlock
- deathMatchHelicopterCount
- desertThemeReference
- dontPersistedPastLevelLoadThisLevel
- finished
- followCameraTransform
- forceMode
- forceTestLevel
- forceThisToBeTheDefaultCampaignScene
- forceTryingToReduceLoadingTimes
- forestThemeReference
- HalfTileSize
- hasAliens
- hasPersistedPastLevelLoad
- havePlacedCageForHardcore
- hellThemeReference
- isEditing
- jungleThemeReference
- lastXLoadOffset
- lastYLoadOffset
- LevelFileName
- levelNum
- levelsCount
- levelsLength
- maxRowActive
- nextXLoadOffset
- nextYLoadOffset
- persistentGameObject
- persistPastLevelLoad
- placeGroundType
- randomLevel
- randomLevelSet
- randomOffset
- randomRange
- runDeactivationOffscreenIsSetup
- sharedObjectsReference
- tempColor
- tempEmptyColor
- tempGroundType
- testLevelFileName
- tryingToReduceLoadingTimes
- woodBlockCount
-
Methods
Blinds all enemy units within range of a position. Blinded units have impaired vision and targeting abilities.
Parameters:
- int playerNum: Player number performing the blind effect
- float x: X position of the blind effect center
- float y: Y position of the blind effect center
- float range: Radius of the blind effect
- float blindTime: Duration of the blindness in seconds (default 9)
public static int BurnBlocksAround(int damage, int collumn, int row, bool forced, GameObject ignoreGameObject = null)
Burns blocks in the four cardinal directions (up, down, left, right) from a center position using raycasting. Can force burn non-oily blocks or only burn oily blocks based on the forced parameter.
Parameters:
- int damage: Amount of fire damage to apply
- int collumn: Grid column position of the center
- int row: Grid row position of the center
- bool forced: If true, burns all blocks; if false, only burns oily blocks
- GameObject ignoreGameObject: Optional GameObject to ignore during raycasting
Returns:
-
int
: Number of blocks that were burned
Burns and damages a block at the specified grid position, sending both Damage and ForceBurn messages to all objects within a 6 unit radius. Used for guaranteed fire spreading to blocks.
Parameters:
- int damage: Amount of fire damage to apply
- int collumn: Grid column position
- int row: Grid row position
Burns large objects at a specific grid position by sending fire damage messages to all objects within a 7 unit radius sphere. Commonly used for spreading fire to destructible scenery.
Parameters:
- int damage: Amount of fire damage to apply
- int collumn: Grid column position
- int row: Grid row position
Returns:
-
bool
: True if any objects were found and damaged, false otherwise
Burns large objects at a specific world position by sending fire damage messages to all objects within a 7 unit radius sphere. Overload that accepts world coordinates instead of grid coordinates.
Parameters:
- int damage: Amount of fire damage to apply
- float x: World X position
- float y: World Y position
Returns:
-
bool
: True if any objects were found and damaged, false otherwise
public static void BurnUnitsAround_Local(MonoBehaviour firedBy, int playerNum, int damage, float range, float x, float y, bool penetrates, bool setGroundAlight)
Sets units on fire within a specified range from a position. Only affects units when the Demonstration.enemiesSetOnFire flag is enabled. Damage can be blocked by non-penetrating fire hitting units. Additionally can set ground blocks on fire if setGroundAlight is true.
Parameters:
- MonoBehaviour firedBy: The object that caused the fire
- int playerNum: Player number of the fire source
- int damage: Burn damage to apply
- float range: Radius of the fire effect
- float x: X position of the fire center
- float y: Y position of the fire center
- bool penetrates: Whether fire goes through units or is blocked by the first unit hit
- bool setGroundAlight: Whether to also set nearby ground blocks on fire
Checks if a rolling object at the specified grid position can roll onto units in that location. Returns false if any heavy units are present that would block the roll.
Parameters:
- int collumn: Grid column position
- int row: Grid row position
- int direction: Direction of the roll (not used in current implementation)
Returns:
-
bool
: True if the object can roll onto units at this position, false if blocked by heavy units
Searches for the nearest corpse within the specified area. Performs line-of-sight checks to ensure the corpse is accessible. Used for abilities that interact with dead units, such as resurrection or corpse manipulation.
Parameters:
- float x: The X coordinate to search from.
- float y: The Y coordinate to search from.
- float xRange: The maximum horizontal search distance.
- float yRange: The maximum vertical search distance.
- out float corpseX: Output parameter that returns the X coordinate of the found corpse.
Returns:
-
Unit
: The nearest accessible corpse unit, or null if none found.
public static bool CollectUnits(MonoBehaviour damageSender, int playerNum, float range, float x, float y, bool penetrates, bool onlyLiving, List<Unit> alreadyHitUnits)
Collects all units within range that match the specified criteria into a list. Used for area effects that need to process multiple units, such as chain lightning or area scans.
Parameters:
- MonoBehaviour damageSender: The object collecting units (used for team checks).
- int playerNum: The player number performing the collection, used for team filtering.
- float range: The square radius from the center point for detection.
- float x: The X coordinate of the collection center point.
- float y: The Y coordinate of the collection center point.
- bool penetrates: If true, continues collecting all units; if false, stops at the first unit.
- bool onlyLiving: If true, only collects living units; if false, includes dead units.
- System.Collections.Generic.List{Unit} alreadyHitUnits: List to populate with collected units, also excludes units already in the list.
Returns:
-
bool
: True if at least one unit was collected, false otherwise.
Checks if a sphere at the specified position overlaps with any solid blocks on the ground layer.
Parameters:
- float x: The x-coordinate of the sphere center
- float y: The y-coordinate of the sphere center
- float size: The radius of the sphere to check
Returns:
-
bool
: True if the sphere overlaps with any blocks on the ground layer; false otherwise
public static void CrushUnitsAgainstWalls(MonoBehaviour damageSender, float x, float y, float range, int xDirection, int yDirection)
Checks units within range of a crushing force and either damages them if they're against a wall or pushes them away from the crusher position. Used for environmental crushers and moving walls.
Parameters:
- MonoBehaviour damageSender: The object causing the crushing damage
- float x: X position of the crusher
- float y: Y position of the crusher
- float range: Range of the crushing effect
- int xDirection: Horizontal direction of crushing force (1 for right, -1 for left, 0 for none)
- int yDirection: Vertical direction of crushing force (1 for up, -1 for down, 0 for none)
public static void CrushUnitsAgainstWallsHorizontal(MonoBehaviour damageSender, float x, float y, float crusherSize, int direction)
Crushes units horizontally against walls within a specified size range. Uses raycasting to detect if there's a solid wall in the crush direction before applying damage.
Parameters:
- MonoBehaviour damageSender: The object causing the crushing damage
- float x: X position of the crusher
- float y: Y position of the crusher
- float crusherSize: Half-height of the crushing area
- int direction: Horizontal crushing direction (1 for right, -1 for left)
public static void CrushUnitsAgainstWallsVertical(MonoBehaviour damageSender, float x, float y, float crusherSize, int direction)
Crushes units vertically against walls within a specified size range. Checks if units are positioned correctly relative to the crusher and uses raycasting to verify wall presence before applying crush damage.
Parameters:
- MonoBehaviour damageSender: The object causing the crushing damage
- float x: X position of the crusher
- float y: Y position of the crusher
- float crusherSize: Half-width of the crushing area
- int direction: Vertical crushing direction (1 for up, -1 for down)
public static void DamageBackground(MonoBehaviour damageSender, int damage, float radius, float x, float y)
Applies damage to both foreground and background blocks within a circular radius.
Parameters:
- MonoBehaviour damageSender: The entity causing the damage (used for damage attribution).
- int damage: The amount of damage to apply to affected blocks.
- float radius: The radius of the damage area in world units.
- float x: The X coordinate of the damage center.
- float y: The Y coordinate of the damage center.
public static void DamageBackground(MonoBehaviour damageSender, int damage, float radius, float x, float y)
Damages background and foreground blocks within a circular radius. This method is used for explosive damage that affects the destructible terrain behind the main play area.
Parameters:
- MonoBehaviour damageSender: The MonoBehaviour that is causing the damage (used for damage attribution)
- int damage: The amount of damage to apply to blocks
- float radius: The radius of the damage effect in world units
- float x: The X coordinate of the damage center
- float y: The Y coordinate of the damage center
public static void DamageBackground(MonoBehaviour damageSender, int damage, float radius, float x, float y)
Damages background and foreground blocks within a circular radius. This method is used for explosive damage that affects the destructible terrain behind the main play area.
Parameters:
- MonoBehaviour damageSender: The MonoBehaviour that is causing the damage (used for damage attribution)
- int damage: The amount of damage to apply to blocks
- float radius: The radius of the damage effect in world units
- float x: The X coordinate of the damage center
- float y: The Y coordinate of the damage center
public static Unit DecapitateUnits(MonoBehaviour damageSender, int playerNum, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool knock)
Attempts to decapitate the first eligible unit found within the specified area. Prioritizes headshot-capable units and applies decapitation effects, used for special finishing moves or precision attacks.
Parameters:
- MonoBehaviour damageSender: The object that initiated the decapitation attempt.
- int playerNum: The player number who caused the damage, used for team damage rules.
- int damage: The amount of damage to inflict if decapitation occurs.
- DamageType damageType: The type of damage being inflicted.
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the attack center point.
- float y: The Y coordinate of the attack center point.
- float xI: The horizontal impulse force to apply.
- float yI: The vertical impulse force to apply.
- bool knock: Whether to apply knockback force.
Returns:
-
Unit
: The unit that was decapitated, or null if no eligible unit was found.
Coroutine that continuously generates random explosions across the visible screen area.
Returns:
-
IEnumerator
: An IEnumerator for the coroutine execution
public static int ExplodeUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float range, float killRange, float x, float y, float force, float yI, int playerNum, bool forceTumble, bool knockSelf, bool knockFriendlies = true)
Creates an explosion that damages and knocks back units within range. Units within killRange take full damage, while units between killRange and range are only knocked back. Also handles oil ignition and worm deaths.
Parameters:
- MonoBehaviour damageSender: The object causing the explosion
- int damage: Base damage amount
- DamageType damageType: Type of damage to apply
- float range: Maximum range of the explosion effect
- float killRange: Range within which units take damage (units beyond this but within range are only knocked back)
- float x: X position of explosion center
- float y: Y position of explosion center
- float force: Knockback force multiplier
- float yI: Additional upward impulse for knockback
- int playerNum: Player number for damage ownership
- bool forceTumble: Whether to force units to tumble when knocked back
- bool knockSelf: Whether the damage sender can knock itself back
- bool knockFriendlies: Whether to knock back friendly units
Returns:
-
int
: Number of units killed by the explosion
public static bool FivePointPalmExplodingHeartTechnique(NetworkedUnit damageSender, int playerNum, int damage, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock)
Applies the legendary Five Point Palm Exploding Heart Technique to units and certain destructible objects. This martial arts move plants a delayed explosion effect that triggers after a countdown, inspired by Kill Bill. Also affects DamageRelay objects, BossBlockPieces, and BossBlockRocketBatteries.
Parameters:
- NetworkedUnit damageSender: The networked unit performing the technique (must be networked for proper synchronization).
- int playerNum: The player number who performed the technique.
- int damage: The initial damage dealt by the palm strike.
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the palm strike center point.
- float y: The Y coordinate of the palm strike center point.
- float xI: The horizontal impulse force to apply.
- float yI: The vertical impulse force to apply.
- bool penetrates: If true, the technique continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
Returns:
-
bool
: True if at least one unit or object was affected, false otherwise.
public static bool FreezeUnits(MonoBehaviour firedBy, int playerNum, float x, float y, float range, float freezeTime)
Freezes units within range of a position. Units that can be frozen will be frozen for the specified duration. Units that cannot be frozen will take 8 freeze damage instead. Returns true if any units were affected.
Parameters:
- MonoBehaviour firedBy: The object causing the freeze effect
- int playerNum: Player number performing the freeze
- float x: X position of the freeze center
- float y: Y position of the freeze center
- float range: Radius of the freeze effect
- float freezeTime: Duration of the freeze in seconds
Returns:
-
bool
: True if at least one unit was frozen or damaged, false otherwise
Gets the first living, non-stealthed unit within the specified rectangular area. The method name contains a typo (should be GetLivingUnit) but is preserved for compatibility. Uses slightly expanded hit detection based on unit size for more forgiving targeting.
Parameters:
- int playerNum: The player number searching for units, used for team filtering.
- float xRange: The horizontal radius from the center point for detection.
- float yRange: The vertical radius from the center point for detection.
- float x: The X coordinate of the search center point.
- float y: The Y coordinate of the search center point.
Returns:
-
Unit
: The first eligible living unit found, or null if none found.
public static Unit GetFirstUnit(MonoBehaviour damageSender, int playerNum, float range, float x, float y, bool onlyLiving, bool includeSuicide, List<Unit> alreadyHitUnits)
Finds the first unit within range that matches the specified criteria. Used for targeted abilities that need to select a single unit, such as grappling hooks or homing projectiles.
Parameters:
- MonoBehaviour damageSender: The object searching for a unit (used for team checks).
- int playerNum: The player number performing the search, used for team filtering.
- float range: The square radius from the center point for detection.
- float x: The X coordinate of the search center point.
- float y: The Y coordinate of the search center point.
- bool onlyLiving: If true, only finds living units; if false, includes dead units.
- bool includeSuicide: If true, includes suicide bomber units even if dead.
- System.Collections.Generic.List{Unit} alreadyHitUnits: List of units to exclude from the search.
Returns:
-
Unit
: The first eligible unit found, or null if none found.
public static Mook GetNearbyMook(float xRange, float yRange, float x, float y, int direction, bool canBeDead = true)
Finds the nearest enemy mook in a specified horizontal direction. Uses Manhattan distance and filters by direction, health status, and unit type.
Parameters:
- float xRange: The horizontal search range
- float yRange: The vertical search range
- float x: The X coordinate to search from
- float y: The Y coordinate to search from
- int direction: The horizontal direction to search (1 for right, -1 for left)
- bool canBeDead: Whether to include dead mooks in the search
Returns:
-
Mook
: The nearest mook matching criteria, or null if none found
public static Mook GetNearbyMookVertical(float xRange, float yRange, float x, float y, int direction, bool canBeDead = true)
Finds the nearest enemy mook in a specified vertical direction. Uses Manhattan distance and filters by direction, health status, and unit type.
Parameters:
- float xRange: The horizontal search range
- float yRange: The vertical search range
- float x: The X coordinate to search from
- float y: The Y coordinate to search from
- int direction: The vertical direction to search (1 for up, -1 for down)
- bool canBeDead: Whether to include dead mooks in the search
Returns:
-
Mook
: The nearest mook matching criteria, or null if none found
public static void HeadShotUnit(MonoBehaviour damageSender, Unit unit, int damage, DamageType damageType, float xI, float yI, int direction, bool knock, float xHit, float yHit)
Applies headshot damage to a unit with special headshot mechanics. Checks damage policies before applying damage and handles knockback separately.
Parameters:
- MonoBehaviour damageSender: The object that caused the headshot
- Unit unit: The unit to headshot
- int damage: The amount of damage to deal
- DamageType damageType: The type of damage being dealt
- float xI: The horizontal knockback force
- float yI: The vertical knockback force
- int direction: The direction of the hit (-1 for left, 1 for right)
- bool knock: Whether to apply knockback to the unit
- float xHit: The X position where the headshot hit
- float yHit: The Y position where the headshot hit
public static bool HitAllLivingUnits(MonoBehaviour damageSender, int playerNum, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, List<Unit> alreadyHit)
Damages all living units regardless of team within a rectangular area. Used for environmental hazards or attacks that damage everyone, including allies, except the damage sender's own player number.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage..
- int playerNum: The player number who caused the damage (units with this playerNum are immune).
- int damage: The amount of damage to inflict on each hit unit.
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static bool HitAllLivingUnits(MonoBehaviour damageSender, int playerNum, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, List<Unit> alreadyHit)
Damages all living units regardless of team, tracking which units have been hit. Allows for damage effects that need to avoid hitting the same unit multiple times across multiple calls.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage..
- int playerNum: The player number who caused the damage (units with this playerNum are immune).
- int damage: The amount of damage to inflict on each hit unit.
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
- System.Collections.Generic.List{Unit} alreadyHit: List of units to skip and to add newly hit units to.
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static Unit HitClosestUnit(MonoBehaviour damageSender, int playerNum, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool knock, bool canGib, bool firedLocally, bool checkIfUnitIsLocallyOwned, bool hitDead = true)
Finds and damages the closest unit within range, checking line of sight. Prioritizes living units over dead ones but can optionally hit dead units if no living targets exist.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage.
- int playerNum: The player number of the attacker (determines which units are enemies)
- int damage: The amount of damage to deal
- DamageType damageType: The type of damage being dealt
- float xRange: The horizontal search range
- float yRange: The vertical search range
- float x: The X position to search from
- float y: The Y position to search from
- float xI: The horizontal knockback force
- float yI: The vertical knockback force
- bool knock: Whether to apply knockback
- bool canGib: If false, dead units receive 0 damage (prevents gibbing)
- bool firedLocally: Whether this damage was initiated locally (unused in this method)
- bool checkIfUnitIsLocallyOwned: Whether to check unit ownership (unused in this method)
- bool hitDead: Whether dead units can be targeted (default true)
Returns:
-
Unit
: The unit that was hit, or null if no valid target was found
public static bool HitDeadUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float range, float x, float y, float xI, float yI, bool penetrates, bool knock)
Damages only dead units (corpses) within a square area. Used for attacks that can destroy or further damage corpses, such as explosives that gib bodies or effects that prevent resurrection.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage..
- int damage: The amount of damage to inflict on each corpse.
- DamageType damageType: The type of damage being inflicted (affects corpse reactions).
- float range: The square radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to corpses.
- float yI: The vertical impulse force to apply to corpses.
- bool penetrates: If true, damage continues through corpses; if false, stops at the first corpse hit.
- bool knock: Whether to apply knockback force to corpses.
Returns:
-
bool
: True if at least one corpse was hit, false otherwise.
public static bool HitHellUnits(MonoBehaviour damageSender, int playerNum, int damage, DamageType damageType, float range, float x, float y, float xI, float yI, bool penetrates, bool knock, bool ignoreDeadUnits, bool onlyGroundUnits = false, bool canHeadshot = true)
Damages only hell-type enemy units within a square area. Used for attacks that specifically target demonic enemies while ignoring regular units, with options to filter by unit state and position.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage..
- int playerNum: The player number who caused the damage, used for team damage rules.
- int damage: The amount of damage to inflict on each hit unit.
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float range: The square radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
- bool ignoreDeadUnits: If true, only damages living units.
- bool onlyGroundUnits: If true, only hits units that are on the ground. Default is false.
- bool canHeadshot: Whether this damage can trigger headshots. Default is true.
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static bool HitLivingHeroes(MonoBehaviour damageSender, int playerNum, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, bool hitHeroes)
Selectively damages either heroes or non-hero units based on the hitHeroes parameter. Used for attacks that need to differentiate between player characters and enemies, such as mind control effects or faction-specific attacks.
Parameters:
- MonoBehaviour damageSender: The object causing the damage.
- int playerNum: The player number who caused the damage, used for team damage rules.
- int damage: The amount of damage to inflict on each hit unit.
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
- bool hitHeroes: If true, only damages hero units; if false, only damages non-hero units.
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static bool HitLivingUnits(MonoBehaviour damageSender, int playerNum, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, bool canHeadshot = true, bool onlyGroundUnits = false)
Damages only living units within a square area. This overload uses equal horizontal and vertical range for a square hit area, commonly used for explosions and area-of-effect attacks.
Parameters:
- MonoBehaviour damageSender: The object causing the damage.
- int playerNum: The player number who caused the damage, used for team damage rules.
- int damage: The amount of damage to inflict on each hit unit.
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float range: The square radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
- bool canHeadshot: Whether this damage can trigger headshots. Default is true.
- bool onlyGroundUnits: If true, only hits units that are on the ground. Default is false.
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static bool HitLivingUnits(MonoBehaviour damageSender, int playerNum, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, bool canHeadshot = true, bool onlyGroundUnits = false)
Damages only living units within a rectangular area. Provides separate control over horizontal and vertical hit ranges, useful for attacks with non-square areas of effect.
Parameters:
- MonoBehaviour damageSender: The object causing the damage.
- int playerNum: The player number who caused the damage, used for team damage rules.
- int damage: The amount of damage to inflict on each hit unit.
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
- bool canHeadshot: Whether this damage can trigger headshots. Default is true.
- bool onlyGroundUnits: If true, only hits units that are on the ground. Default is false.
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Damages units within a square range using basic hit detection. Convenience overload that delegates to the canGib version with gibbing enabled by default.
Parameters:
- MonoBehaviour damageSender: The object causing the damage.
- MonoBehaviour avoidID: Unit to avoid damaging (unless it catches friendly bullets)
- int playerNum: The player number dealing damage (used for team damage rules)
- int damage: The amount of damage to inflict on each hit unit
- DamageType damageType: The type of damage being dealt (affects unit reactions and effects)
- float range: The hit detection range (used for both horizontal and vertical axes)
- float x: The X coordinate of the damage center point
- float y: The Y coordinate of the damage center point
- float xI: The horizontal knockback force
- float yI: The vertical knockback force
- bool penetrates: Whether damage penetrates through units
- bool knock: Whether to apply knockback
Returns:
-
bool
: True if any units were hit, false otherwise
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Damages units within a square range with gibbing control. Convenience overload that delegates to the rectangular version with equal x/y ranges and headshots enabled by default.
Parameters:
- MonoBehaviour damageSender: The object causing the damage.
- MonoBehaviour avoidID: Unit to avoid damaging (unless it catches friendly bullets)
- int playerNum: The player number dealing damage (used for team damage rules)
- int damage: The base damage amount
- DamageType damageType: The type of damage being dealt (affects unit reactions and effects)
- float range: The damage range (used for both axes)
- float x: The X coordinate of the damage source
- float y: The Y coordinate of the damage source
- float xI: The horizontal knockback force
- float yI: The vertical knockback force
- bool penetrates: Whether damage penetrates through units
- bool knock: Whether to apply knockback
- bool canGib: Whether units can be gibbed when killed
Returns:
-
bool
: True if any units were hit, false otherwise
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Damages units within a rectangular area with separate x/y ranges and headshot control. Convenience overload that delegates to the full implementation with default blood color tracking and no hit unit list.
Parameters:
- MonoBehaviour damageSender: The object causing the damage.
- MonoBehaviour avoidID: Unit to avoid damaging (unless it catches friendly bullets)
- int playerNum: The player number dealing damage (used for team damage rules)
- int damage: The amount of damage to inflict on each hit unit.
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
- bool canGib: Whether dead units can be gibbed (blown apart) by this damage.
- bool canHeadShot: Whether this damage can trigger headshots for increased damage (default: true)
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Core implementation of HitUnits with full parameter control. This is the main implementation that handles all unit damage logic, with options for blood color tracking, hit unit lists, and circular vs rectangular damage areas. Most other HitUnits overloads delegate to this method.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage..
- MonoBehaviour avoidID: Optional unit to exclude from damage, unless they have CatchFriendlyBullets enabled.
- int playerNum: The player number dealing damage (used for team damage rules)
- int damage: The amount of damage to inflict on each hit unit.
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
- bool canGib: Whether dead units can be gibbed (blown apart) by this damage.
- bool canHeadShot: Whether this damage can trigger headshots for increased damage.
- out BloodColor bloodColor: Output parameter that returns the blood color of the last unit hit.
- System.Collections.Generic.List{Unit} hitUnits: Optional list to populate with all units that were hit by this damage.
- bool onlyDamageInRadius: If true, applies damage only to units within a circular radius instead of rectangular area.
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Damages units along a line segment between two points. Standalone implementation for line-based damage detection, useful for beam weapons, laser attacks, or linear area effects. Always applies upward knockback.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage..
- MonoBehaviour avoidID: Unit to avoid damaging (currently not implemented in this overload)
- int playerNum: The player number dealing damage (used for team damage rules)
- int damage: The amount of damage to inflict on each hit unit.
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- Vector3 startPos: The starting position of the line segment
- Vector3 endPos: The ending position of the line segment
- float width: The width of the line for hit detection (perpendicular distance from line)
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Damages units within a square range with hit tracking and corpse filtering. Convenience overload that delegates to the corpse damage version with equal damage values for living and dead units.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage..
- int playerNum: The player number dealing damage (used for team damage rules)
- int damage: The amount of damage to inflict on each hit unit.
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float range: The square radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
- bool canGib: Whether dead units can be gibbed (blown apart) by this damage.
- System.Collections.Generic.List{Unit} alreadyHitUnits: List of units to skip and to add newly hit units to.
- bool ignoreDeadUnits: If true, only damages living units.
- bool canHeadshot: Whether this damage can trigger headshots.
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Damages units with separate damage values for living and dead units. Convenience overload that delegates to the rectangular version with equal x/y ranges. Useful for explosions that need different corpse damage.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage..
- int playerNum: The player number dealing damage (used for team damage rules)
- int damage: The amount of damage to inflict on living units
- int corpseDamage: The amount of damage to inflict on dead units (corpses)
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float range: The square radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
- bool canGib: Whether dead units can be gibbed (blown apart) by this damage.
- System.Collections.Generic.List{Unit} alreadyHitUnits: List of units to skip and to add newly hit units to.
- bool canHeadshot: Whether this damage can trigger headshots (default: false)
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Core implementation for damage with separate corpse damage values and rectangular areas. This is a standalone implementation (not a delegation) that handles all the damage logic for cases where living and dead units need different damage amounts.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage..
- int playerNum: The player number dealing damage (used for team damage rules)
- int damage: The amount of damage to inflict on living units.
- int corpseDamage: The amount of damage to inflict on dead units (corpses).
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
- bool canGib: Whether dead units can be gibbed (blown apart) by this damage.
- System.Collections.Generic.List{Unit} alreadyHitUnits: List of units to skip and to add newly hit units to.
- bool ignoreDeadUnits: If true, only damages living units.
- bool canHeadshot: Whether this damage can trigger headshots.
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Damages units with BroforceObject list tracking for mixed object types. Standalone implementation that tracks hit objects as BroforceObject instead of Unit, allowing for more flexible hit tracking across different game object types.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage..
- int playerNum: The player number dealing damage (used for team damage rules)
- int damage: The amount of damage to inflict on living units.
- int corpseDamage: The amount of damage to inflict on dead units (corpses).
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the damage center point.
- float y: The Y coordinate of the damage center point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
- bool canGib: Whether dead units can be gibbed (blown apart) by this damage.
- System.Collections.Generic.List{BroforceObject} alreadyHitObjects: List of BroforceObjects to skip and to add newly hit units to.
- bool canHeadshot: Whether this damage can trigger headshots. Default is false.
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Damages all units within a square range regardless of team. Convenience overload that delegates to the rectangular version with equal x/y ranges. No avoidID parameter means all units can be damaged.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage.
- int damage: The amount of damage to inflict on each hit unit
- DamageType damageType: The type of damage being dealt (affects unit reactions and effects)
- float range: The hit detection range (used for both horizontal and vertical axes)
- float x: The X coordinate of the damage center point
- float y: The Y coordinate of the damage center point
- float xI: The horizontal knockback force
- float yI: The vertical knockback force
- bool penetrates: If true, damage continues through units; if false, stops at first non-dead unit
- bool knock: Whether to apply knockback to damaged units
Returns:
-
bool
: True if at least one unit was hit, false otherwise
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Damages all units within a rectangular area regardless of team. Standalone implementation without avoidID that hits all units in range. Includes special penetration logic that reduces penetration chance based on unit mass.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage.
- int damage: The amount of damage to inflict on each hit unit
- DamageType damageType: The type of damage being dealt (affects unit reactions and effects)
- float xRange: The horizontal range of the damage area
- float yRange: The vertical range of the damage area
- float x: The X coordinate of the damage center point
- float y: The Y coordinate of the damage center point
- float xI: The horizontal knockback force
- float yI: The vertical knockback force
- bool penetrates: If true, damage continues through units; if false, stops at first non-dead unit
- bool knock: Whether to apply knockback to damaged units
Returns:
-
bool
: True if at least one unit was hit, false otherwise
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Damages all units within a square range and tracks blood color. Convenience overload that delegates to the rectangular version with equal x/y ranges. Used when visual blood effects are needed.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage.
- int damage: The amount of damage to inflict on each hit unit
- DamageType damageType: The type of damage being dealt (affects unit reactions and effects)
- float range: The range in both X and Y directions
- float x: The X coordinate of the damage center point
- float y: The Y coordinate of the damage center point
- float xI: The horizontal knockback force
- float yI: The vertical knockback force
- bool penetrates: If true, damage continues through units; if false, stops at first non-dead unit
- bool knock: Whether to apply knockback to damaged units
- out BloodColor bloodColor: Output parameter that returns the blood color of the last unit hit
Returns:
-
bool
: True if at least one unit was hit, false otherwise
public static bool HitUnits(MonoBehaviour damageSender, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool knock, ref BloodColor bloodColor)
Damages all units within a rectangular area and tracks blood color. Standalone implementation without team filtering that includes blood color tracking for visual effects and special penetration reduction based on unit mass.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage.
- int damage: The amount of damage to inflict on each hit unit
- DamageType damageType: The type of damage being dealt (affects unit reactions and effects)
- float xRange: The horizontal range of the damage area
- float yRange: The vertical range of the damage area
- float x: The X coordinate of the damage center point
- float y: The Y coordinate of the damage center point
- float xI: The horizontal knockback force
- float yI: The vertical knockback force
- bool penetrates: If true, damage continues through units; if false, stops at first non-dead unit
- bool knock: Whether to apply knockback to damaged units
- out BloodColor bloodColor: Output parameter that will contain the blood color of the last hit unit
Returns:
-
bool
: True if at least one unit was hit, false otherwise
public static bool HitUnitsWithArrow(MonoBehaviour damageSender, Arrow arrow, int playerNum, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool knock)
Specialized hit detection for arrow projectiles that destroys the arrow on impact. Handles headshot detection and applies appropriate damage based on hit location, simulating realistic arrow physics where the projectile stops on impact.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage. (typically the bow or crossbow).
- Arrow arrow: The arrow projectile instance that will be destroyed on hit.
- int playerNum: The player number who shot the arrow, used for team damage rules.
- int damage: The amount of damage to inflict on hit.
- DamageType damageType: The type of damage being inflicted (typically Bullet for arrows).
- float xRange: The horizontal hit detection range from the arrow's position.
- float yRange: The vertical hit detection range from the arrow's position.
- float x: The X coordinate of the arrow.
- float y: The Y coordinate of the arrow.
- float xI: The horizontal velocity/force of the arrow for knockback.
- float yI: The vertical velocity/force of the arrow for knockback.
- bool knock: Whether to apply knockback force to hit units.
Returns:
-
bool
: Always returns false after processing hits (arrow is destroyed on impact).
public static bool InseminateUnits(AlienFaceHugger inseminator, int playerNum, float xRange, float yRange, float x, float y, float xI, float yI)
Attempts to implant alien parasites into eligible units within range. Used by AlienFaceHugger enemies to infect heroes with chest-bursting aliens. Only affects non-replicant heroes that can be inseminated.
Parameters:
- AlienFaceHugger inseminator: The AlienFaceHugger performing the insemination.
- int playerNum: The player number of the face hugger, used for team damage rules.
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the insemination attempt center point.
- float y: The Y coordinate of the insemination attempt center point.
- float xI: The horizontal velocity of the face hugger (affects insemination angle).
- float yI: The vertical velocity of the face hugger (affects insemination angle).
Returns:
-
bool
: True if a unit was successfully inseminated, false otherwise.
public static void KnockAndDamageUnit(MonoBehaviour damageSender, Unit unit, int damage, DamageType damageType, float xI, float yI, int direction, bool knock, float hitX, float hitY, bool sendPosAndVelocityAcrossNetwork = false)
Applies knockback and damage to a unit. This is a convenience overload that calls the more detailed version with default hit position parameters (-100, -100).
Parameters:
- MonoBehaviour damageSender: The object causing the damage
- Unit unit: The unit to knock and damage
- int damage: Amount of damage to apply
- DamageType damageType: Type of damage being applied
- float xI: Horizontal knockback velocity
- float yI: Vertical knockback velocity
- int direction: Direction of the attack (-1 for left, 1 for right, 0 for no specific direction)
- bool knock: Whether to apply knockback to the unit
public static void KnockAndDamageUnit(MonoBehaviour damageSender, Unit unit, int damage, DamageType damageType, float xI, float yI, int direction, bool knock, float hitX, float hitY, bool sendPosAndVelocityAcrossNetwork = false)
Applies knockback and damage to a unit with full control over hit position. Handles damage policy validation to determine if damage should be applied based on the relationship between sender and target. Validates knockback velocity values to prevent NaN issues.
Parameters:
- MonoBehaviour damageSender: The object causing the damage
- Unit unit: The unit to knock and damage
- int damage: Amount of damage to apply
- DamageType damageType: Type of damage being applied
- float xI: Horizontal knockback velocity (will be set to 0 if NaN)
- float yI: Vertical knockback velocity (will be set to 0 if NaN)
- int direction: Direction of the attack (-1 for left, 1 for right, 0 for no specific direction)
- bool knock: Whether to apply knockback to the unit
- float hitX: X position where the hit occurred
- float hitY: Y position where the hit occurred
- bool sendPosAndVelocityAcrossNetwork: Whether to synchronize position and velocity (networking functionality excluded for modding)
public static bool KnockMooks(MonoBehaviour damageSender, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool livingUnits, bool onlyGroundUnits = true)
Applies knockback to enemy units (mooks) without dealing damage. Used for crowd control effects that push enemies away without harming them, such as sonic booms or force pushes.
Parameters:
- MonoBehaviour damageSender: The object that initiated the knockback.
- DamageType damageType: The type of force being applied (affects knockback behavior).
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the knockback center point.
- float y: The Y coordinate of the knockback center point.
- float xI: The horizontal impulse force to apply.
- float yI: The vertical impulse force to apply.
- bool penetrates: If true, knockback continues through units; if false, stops at the first unit hit.
- bool livingUnits: If true, only affects living units; if false, affects all units.
- bool onlyGroundUnits: If true, only affects units on the ground. Default is true.
Returns:
-
bool
: True if at least one unit was knocked back, false otherwise.
public static bool KnockUnits(MonoBehaviour damageSender, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, bool penetrates, bool livingUnits, bool onlyGroundUnits = true)
Applies knockback to all units (not just enemies) without dealing damage. More general version of KnockMooks that affects any unit regardless of allegiance, used for universal force effects.
Parameters:
- MonoBehaviour damageSender: The object that initiated the knockback.
- DamageType damageType: The type of force being applied (affects knockback behavior).
- float xRange: The horizontal radius from the center point for hit detection.
- float yRange: The vertical radius from the center point for hit detection.
- float x: The X coordinate of the knockback center point.
- float y: The Y coordinate of the knockback center point.
- float xI: The horizontal impulse force to apply.
- float yI: The vertical impulse force to apply.
- bool penetrates: If true, knockback continues through units; if false, stops at the first unit hit.
- bool livingUnits: If true, only affects living units; if false, affects all units.
- bool onlyGroundUnits: If true, only affects units on the ground. Default is true.
Returns:
-
bool
: True if at least one unit was knocked back, false otherwise.
Sets all blocks in the map to have extremely high health, making them virtually indestructible.
Creates a single explosion at the specified position using a pooled explosive object.
Parameters:
- Vector3 pos: The world position where the explosion should occur
Pre-allocates a pool of hidden explosive objects for use in the level-ending explosion sequence.
Registers an object that can be targeted by AI units, homing projectiles, or auto-aim systems. Targetable objects include enemies, destructible props, or any gameplay element that can be selected as a valid target for attacks.
Parameters:
- TargetableObject target: The TargetableObject to register for targeting systems.
Removes an object from the targetable tracking system, typically when it is destroyed or should no longer be considered a valid target. This prevents AI and homing projectiles from continuing to target defunct objects.
Parameters:
- TargetableObject target: The TargetableObject to remove from targeting consideration.
public static bool ReviveDeadUnits(float x, float y, float range, int playerNum, int maxReviveCount, bool isPlayerControlled, TestVanDammeAnim reviveSource, bool reviveBros = true)
Attempts to revive dead units or remove acid from acid-covered units within a circular range. Returns true if any units were successfully revived.
Parameters:
- float x: X position of the revival center
- float y: Y position of the revival center
- float range: Radius within which to revive units
- int playerNum: Player number to assign to revived units
- int maxReviveCount: Maximum number of units to revive
- bool isPlayerControlled: Whether revived units should be player-controlled
- TestVanDammeAnim reviveSource: The source object performing the revival
- bool reviveBros: Whether hero units (Bros) can be revived (default true)
Returns:
-
bool
: True if at least one unit was successfully revived, false otherwise
Causes units at the specified grid position to be rolled onto, applying the RollOnto effect to all non-heavy units in the area.
Parameters:
- int collumn: Grid column position
- int row: Grid row position
- int direction: Direction of the roll to apply to affected units
Begins the local level-ending explosion sequence on this client.
Initiates the level-ending explosion sequence across all networked clients.
Stuns all enemy units within range of a position. Only affects units that are enemies of the specified player number.
Parameters:
- int playerNum: Player number performing the stun
- float x: X position of the stun center
- float y: Y position of the stun center
- float range: Radius of the stun effect
- float stunTime: Duration of the stun in seconds
public static void TearGasUnits(int playerNum, float x, float y, float range, float tearGasTime = 9f)
Applies tear gas effect to all enemy units within range. Tear gas causes units to be temporarily incapacitated.
Parameters:
- int playerNum: Player number applying the tear gas
- float x: X position of the tear gas center
- float y: Y position of the tear gas center
- float range: Radius of the tear gas effect
- float tearGasTime: Duration of the tear gas effect in seconds (default 9)
public static bool WhipUnits(MonoBehaviour damageSender, MonoBehaviour avoidID, int playerNum, int damage, DamageType damageType, float xRange, float yRange, int whipDirection, float x, float y, float xI, float yI, bool penetrates, bool knock, bool canGib, ref float maxDamageM)
Specialized damage method for whip-like attacks that deal variable damage based on distance. Creates visual effects and applies damage that scales with the unit's position relative to the whip's reach, simulating the physics of a whip strike.
Parameters:
- MonoBehaviour damageSender: The object that is causing the damage. (typically the whip weapon).
- MonoBehaviour avoidID: Optional unit to exclude from damage.
- int playerNum: The player number who caused the damage, used for team damage rules.
- int damage: The base damage amount, which will be scaled by distance.
- DamageType damageType: The type of damage being inflicted (affects unit reactions and effects).
- float xRange: The horizontal reach of the whip attack.
- float yRange: The vertical reach of the whip attack.
- int whipDirection: The direction of the whip strike (1 for right, -1 for left).
- float x: The X coordinate of the whip's origin point.
- float y: The Y coordinate of the whip's origin point.
- float xI: The horizontal impulse force to apply to hit units.
- float yI: The vertical impulse force to apply to hit units.
- bool penetrates: If true, damage continues through units; if false, stops at the first unit hit.
- bool knock: Whether to apply knockback force to hit units.
- bool canGib: Whether dead units can be gibbed (blown apart) by this damage.
- out float maxDamageM: Output parameter that returns the maximum damage multiplier achieved during the whip strike.
Returns:
-
bool
: True if at least one unit was hit, false otherwise.
List of triggers that respond to enemy deaths. Listeners are registered via RegisterEnemyDeathListener and removed via RemoveEnemyDeathListener. Used for mission objectives, wave spawning, and event triggering based on enemy elimination. Initialized in Awake() and set to null in OnDestroy().
Tracks whether level end explosions have been initiated. Set to true when StartLevelEndExplosions is called to prevent multiple coroutines from running the continuous explosion effects. Used to ensure the explosion sequence only starts once per level.
Temporary storage for the nearest distance found during proximity searches. Used by various nearest entity search methods (GetNearestUnit, GetNearestCheckpoint, etc.) to track the shortest distance while iterating through candidates. Optimizes performance by avoiding repeated distance allocations.
List of objects that can be targeted by AI and auto-aim systems. Objects are registered via RegisterTargetableObject and removed via RemoveTargetableObject. Used by GetNearestTargetableObject for finding valid targets within range, considering player allegiance and boss target priorities. Initialized in Awake() and set to null in OnDestroy().
public static bool AddSlime(SlimeGroundCover slimePrefab, int slimeAmount, int collumn, int row, DirectionEnum direction)
Adds slime to a block surface in the specified direction if the block is solid, has an open face, and isn't immune to slime. Creates new slime or adds to existing slime coverage.
Parameters:
- SlimeGroundCover slimePrefab: The SlimeGroundCover prefab to instantiate if no slime exists on the surface.
- int slimeAmount: The amount of slime damage/thickness to add to the surface.
- int collumn: The column index of the block to add slime to.
- int row: The row index of the block to add slime to.
- DirectionEnum direction: The direction face of the block where slime should be added (Up, Down, Left, or Right).
Returns:
-
bool
: True if slime was successfully added; false if the block is invalid, immune to slime, or doesn't have an open face.
Registers a GameObject with a string tag for later retrieval. Tags are case-insensitive and stored in uppercase for consistent lookup.
Parameters:
- GameObject obj: The GameObject to register with the specified tag.
- string tag: The string identifier to associate with the object. Must not be null or empty.
Summons a fake helicopter to the specified position after a delay. The fake helicopter is a visual-only helicopter used for cinematic sequences that doesn't interact with gameplay.
Parameters:
- Vector2 position: The target position for the helicopter
- float delay: The delay in seconds before the helicopter appears
Summons a fake helicopter to the specified position after a delay. The fake helicopter is a visual-only helicopter used for cinematic sequences that doesn't interact with gameplay.
Parameters:
- Vector2 position: The target position for the helicopter
- float delay: The delay in seconds before the helicopter appears
Summons a fake helicopter to enter the scene at the specified position after a delay.
Parameters:
- Vector2 position: The target position where the helicopter should appear.
- float delay: The delay in seconds before the helicopter enters.
public static bool CheckCheckPoint(float xI, float x, float y, TestVanDammeAnim activatingCharacter)
Checks and activates checkpoints near a moving character. Considers character velocity for predictive checkpoint activation, triggers perks and time bonuses.
Parameters:
- float xI: The character's horizontal velocity
- float x: The character's X coordinate
- float y: The character's Y coordinate
- TestVanDammeAnim activatingCharacter: The character activating the checkpoint
Returns:
-
bool
: True if a visible checkpoint was newly activated, false otherwise
Checks whether blocks should be persisted after a level load and either maintains or destroys them accordingly. This method is called after level transitions to handle the persistence state.
Checks whether blocks should be persisted after a level load and either maintains or destroys them accordingly. This method is called after level transitions to handle the persistence state.
Checks and applies block persistence settings after a level load.
Immediately clears all persisted blocks without waiting for a level transition. This provides a way to force-clear persistence state during gameplay.
Immediately clears all persisted blocks without waiting for a level transition. This provides a way to force-clear persistence state during gameplay.
Immediately clears all persistent blocks without waiting for level transition.
Constrains movement to prevent objects from passing through solid blocks, calculating collision responses and bounce directions. Handles multi-frame movements by breaking them into smaller steps.
Parameters:
- MonoBehaviour obj: The MonoBehaviour object being constrained (used for special handling of grenades).
- float x: The current X position of the object.
- float y: The current Y position of the object.
- float size: The collision radius of the object.
- out float xIT: Input/Output: The attempted X movement. Modified to valid movement amount on collision.
- out float yIT: Input/Output: The attempted Y movement. Modified to valid movement amount on collision.
- out bool bounceX: Output: Set to true if horizontal movement should be reversed (bounce).
- out bool bounceY: Output: Set to true if vertical movement should be reversed (bounce).
- bool strictlyGround: If true, only collides with ground layer; if false, includes other collision layers.
Returns:
-
bool
: True if a collision occurred and movement was constrained; false if movement is unobstructed.
Creates a 2x2 arrangement of ammunition and revival crates at the specified position. The arrangement includes two ammo crates (top), one revive crate (bottom-left), and one damage crate (bottom-right).
Parameters:
- Vector3 pos: The position for the top-left crate
- int collumn: The column index for block array placement
- int row: The row index for block array placement
- bool setupBlocks: Whether to run block setup logic (connections to adjacent blocks)
Creates a 2x2 arrangement of ammunition and revival crates at the specified position. The arrangement includes two ammo crates (top), one revive crate (bottom-left), and one damage crate (bottom-right).
Parameters:
- Vector3 pos: The position for the top-left crate
- int collumn: The column index for block array placement
- int row: The row index for block array placement
- bool setupBlocks: Whether to run block setup logic (connections to adjacent blocks)
Creates a 2x2 arrangement of power-up crates at the specified position.
Parameters:
- Vector3 pos: The base position for the crate arrangement.
- int collumn: The column coordinate for block registration.
- int row: The row coordinate for block registration.
- bool setupBlocks: Whether to perform block setup and initialization.
Creates a hero level exit portal at the specified position, typically used for level completion.
Parameters:
- Vector2 position: The base position where the portal should be created.
Creates a hero level exit portal at the specified position. The portal is positioned with a vertical offset of 112 units and a horizontal offset of 16 units from the provided coordinates.
Parameters:
- Vector2 position: The base position where the portal should be created
Creates a hero level exit portal at the specified position. The portal is positioned with a vertical offset of 112 units and a horizontal offset of 16 units from the provided coordinates.
Parameters:
- Vector2 position: The base position where the portal should be created
Creates and networks a remote control explosive car at the specified position.
Parameters:
- float x: The x-coordinate for spawning the car
- float y: The y-coordinate for spawning the car
Returns:
-
RemoteControlExplosiveCar
: The created RemoteControlExplosiveCar instance
Calculates the 2D cross product (scalar) of vectors formed by three points.
Parameters:
- Vector2 pointA: The origin point for both vectors
- Vector2 pointB: The end point of the first vector
- Vector2 pointC: The end point of the second vector
Returns:
-
float
: The scalar cross product of vectors AB and AC
Damages all doodads (environmental objects) with the specified tag. Handles both Unit components and generic damage message receivers.
Parameters:
- string tag: The tag identifying which doodads to damage (case-insensitive).
- int damage: The amount of damage to apply to each matching doodad.
Returns:
-
bool
: True if at least one doodad with the tag was found (even if it couldn't be damaged); false if no matching doodads exist.
Destroys all persisted blocks and clears the persistence system. This removes both foreground and background persistent blocks and their container GameObject.
Destroys all persisted blocks and clears the persistence system. This removes both foreground and background persistent blocks and their container GameObject.
Destroys all persistent blocks and cleans up persistence-related data structures.
Calculates the Euclidean distance between two 2D points using manual calculation. This method provides a basic distance calculation used internally for geometric operations.
Parameters:
- Vector2 pointA: The first point in 2D space
- Vector2 pointB: The second point in 2D space
Returns:
-
float
: The Euclidean distance between the two points
Calculates the Euclidean distance between two 2D points using the standard distance formula.
Parameters:
- Vector2 pointA: The first point in 2D space.
- Vector2 pointB: The second point in 2D space.
Returns:
-
float
: The distance between the two points as a float value.
Calculates the Euclidean distance between two 2D points using manual calculation. This method provides a basic distance calculation used internally for geometric operations.
Parameters:
- Vector2 pointA: The first point in 2D space
- Vector2 pointB: The second point in 2D space
Returns:
-
float
: The Euclidean distance between the two points
Determines if a foreground block type should have a background layer rendered behind it. Most solid blocks have backgrounds, while bridges, ladders, and decorative elements do not.
Parameters:
- GroundType foregroundType: The ground type to check.
Returns:
-
bool
: True if this ground type should have a background; false for transparent or pass-through blocks like ladders, bridges, and decorative elements.
Determines if a foreground terrain type should have a background layer rendered behind it. Used during map generation to determine background placement.
Parameters:
- TerrainType foregroundType: The terrain type to check.
Returns:
-
bool
: True if this terrain type should have a background; false for transparent or pass-through terrain like ladders, bridges, and air.
Disables block persistence for the next level load. This prevents blocks from being maintained between level transitions, ensuring a fresh map state.
Disables block persistence for the next level load. This prevents blocks from being maintained between level transitions, ensuring a fresh map state.
Disables block persistence for the current level transition.
Calculates the dot product of vectors formed by three points, used for angle calculations.
Parameters:
- Vector2 pointA: The first point defining the start of the first vector
- Vector2 pointB: The second point, end of first vector and start of second vector
- Vector2 pointC: The third point defining the end of the second vector
Returns:
-
float
: The dot product of vectors AB and BC
public static bool FindHoleToJumpThroughAndAppear(float xPos, float yPos, ref float characterX, ref float characterY, ref int jumpDirection)
Searches for a suitable floor opening where a character can jump through and appear from below. Used for dramatic entrance animations and spawn mechanics.
Parameters:
- float xPos: The X coordinate around which to search for jump-through points.
- float yPos: The Y coordinate around which to search for jump-through points.
- out float characterX: When successful, contains the X coordinate where the character should appear (centered in the empty column).
- out float characterY: When successful, contains the Y coordinate where the character should appear (one block below the floor).
- out int jumpDirection: When successful, contains the horizontal direction to jump: 1 for right, -1 for left.
Returns:
-
bool
: True if a suitable jump-through location was found; false otherwise.
public static bool FindLadderNearPosition(float xPos, float yPos, int range, ref float characterX, ref float characterY)
Searches for a ladder block near the specified position and returns the optimal climbing position. Uses a default search range of 8 units, prioritizing ladders to the right of the position.
Parameters:
- float xPos: The X coordinate of the search origin position.
- float yPos: The Y coordinate of the search origin position.
- out float characterX: When successful, contains the X coordinate where the character should be positioned to climb the ladder (centered on the ladder at blockX + 8).
- out float characterY: When successful, contains the Y coordinate where the character should be positioned (same as yPos).
Returns:
-
bool
: True if a ladder was found within range; false if no ladder exists or the position is out of bounds.
public static bool FindLadderNearPosition(float xPos, float yPos, int range, ref float characterX, ref float characterY)
Searches for a ladder block near the specified position within a custom range and returns the optimal climbing position. Prioritizes ladders in front of the search position.
Parameters:
- float xPos: The X coordinate of the search origin position.
- float yPos: The Y coordinate of the search origin position.
- int range: The horizontal search range in grid units. The method searches from -range/4 to +range columns.
- out float characterX: When successful, contains the X coordinate where the character should be positioned to climb the ladder.
- out float characterY: When successful, contains the Y coordinate where the character should be positioned (same as yPos).
Returns:
-
bool
: True if a ladder was found within range; false if no ladder exists or the position is out of bounds.
protected void FindLargeBlockDimensions(int x, int y, ref int firstCollumn, ref int firstRow, ref int collumns, ref int rows, TerrainType currentTerrain, TerrainType[,] terrainTypes)
Analyzes a terrain region to find the dimensions of a contiguous area of the same terrain type. Used for optimizing terrain mesh generation by combining adjacent blocks.
Parameters:
- int x: The starting column position to analyze.
- int y: The starting row position to analyze.
- out int firstCollumn: Output parameter containing the leftmost column of the contiguous area.
- out int firstRow: Output parameter containing the bottom row of the contiguous area.
- out int collumns: Output parameter containing the width of the contiguous area in columns.
- out int rows: Output parameter containing the height of the contiguous area in rows.
- TerrainType currentTerrain: The terrain type to match when finding contiguous blocks.
- TerrainType[ terrainTypes: The 2D array of terrain types to analyze.
Determines the starting location for the level based on game mode and spawn point configuration. Handles different spawn strategies for various game modes.
Returns:
-
Vector3
: A Vector3 representing the world position where gameplay should begin.
Calculates the spawn frequency for ammunition crates based on game mode and player progression. Higher values mean less frequent spawns.
Returns:
-
float
: A float representing the spawn frequency multiplier for ammo crates.
Converts a grid point to its world position center coordinates.
Parameters:
- GridPoint gridPoint: The grid point containing column and row indices
Returns:
-
Vector3
: The world position at the center of the specified grid cell
Converts grid coordinates to world position using reference parameters. More efficient version for when you need both x and y coordinates.
Parameters:
- out float x: Reference parameter that will contain the world x coordinate
- out float y: Reference parameter that will contain the world y coordinate
- int row: The row index in the grid
- int collumn: The column index in the grid
Converts grid coordinates (column, row) to world position. Used for positioning objects on the map grid.
Parameters:
- int collumn: The column index in the grid
- int row: The row index in the grid
Returns:
-
Vector3
: A Vector3 representing the world position of the grid cell
Retrieves a checkpoint by its ID number. Performs bounds checking to ensure the requested ID is valid.
Parameters:
- int id: The checkpoint ID to retrieve (0-based index).
Returns:
-
CheckPoint
: The CheckPoint object with the specified ID, or null if the ID is out of bounds.
Retrieves the extra height offset for airdrop spawning at a specific checkpoint. This value is added to the default spawn height for airdrop checkpoints.
Parameters:
- int id: The checkpoint ID to query.
Returns:
-
float
: The airDropExtraHeight value from the checkpoint if it exists, or 16f as the default height if the ID is invalid.
Converts a world x coordinate to a grid column index. Each grid cell is 16 units wide.
Parameters:
- float x: The world x coordinate
Returns:
-
int
: The column index in the grid
Retrieves a single GameObject by its tag, searching both the persistent doodad list and dynamically tagged objects. Returns the first match found.
Parameters:
- string tag: The tag to search for (case-insensitive).
Returns:
-
GameObject
: The first GameObject found with the specified tag, or null if no object has that tag.
Retrieves all GameObjects with the specified tag, including both persistent doodads and dynamically tagged objects.
Parameters:
- string tag: The tag to search for (case-insensitive).
Returns:
-
List<GameObject>
: A List containing all GameObjects with the specified tag. Returns an empty list if no matches are found.
Finds the height of the ground directly below the specified position using raycasting. Performs multiple raycasts to ensure accurate ground detection even near edges.
Parameters:
- float x: The X coordinate from which to cast rays downward.
- float y: The Y coordinate from which to start the raycast.
Returns:
-
float
: The Y coordinate of the ground surface if found; 0 if no ground is detected below the position.
Gets the leaf color defined by the current map theme.
Returns:
-
Color
: The Color value for leaves in the active theme
Gets the maximum number of columns in the current map, representing the map's width in grid units.
Returns:
-
int
: The total number of columns in the map grid (Map.Width).
Gets the maximum number of rows in the current map, representing the map's height in grid units.
Returns:
-
int
: The total number of rows in the map grid (Map.Height).
Finds the nearest checkpoint within range that isn't blocked by a unit. Used for spawn point determination and checkpoint activation checks.
Parameters:
- float radius: The search radius
- float x: The X coordinate to search from
- float y: The Y coordinate to search from
Returns:
-
CheckPoint
: The nearest unblocked checkpoint within range, or null if none found
Finds the nearest checkpoint within range of a position using Manhattan distance. Searches through all registered checkpoints regardless of activation state.
Parameters:
- int range: Maximum search range
- float x: X position to search from
- float y: Y position to search from
Returns:
-
CheckPoint
: The nearest checkpoint, or null if none found within range
public static CheckPoint GetNearestCheckPointToRight(float x, float y, bool onlyUnactivatedCheckpoints)
Finds the nearest checkpoint that is to the right of the specified position. Used for checkpoint discovery and progression tracking.
Parameters:
- float x: The x coordinate of the starting position
- float y: The y coordinate of the starting position
- bool onlyUnactivatedCheckpoints: Whether to only consider checkpoints that haven't been activated yet
Returns:
-
CheckPoint
: The nearest checkpoint to the right, or null if none found
Finds the nearest rescue bro (caged prisoner) to the specified position. Used for locating prisoners that can be freed to gain extra lives.
Parameters:
- float x: The x coordinate of the search position
- float y: The y coordinate of the search position
Returns:
-
RescueBro
: The nearest RescueBro object, or null if none found or HeroController is not available
Converts a world y coordinate to a grid row index. Each grid cell is 16 units tall.
Parameters:
- float y: The world y coordinate
Returns:
-
int
: The row index in the grid
Converts world position to grid coordinates using reference parameters. Used to find which grid cell contains a given world position.
Parameters:
- float x: The world x coordinate
- float y: The world y coordinate
- out int row: Reference parameter that will contain the row index
- out int collumn: Reference parameter that will contain the column index
Retrieves the SpawnPoint object for the specified player number. Uses modulo arithmetic with spawnPointOffset to cycle through available spawn points if there are fewer spawn points than players.
Parameters:
- int playerNum: The player number (0-based) requesting a spawn point.
Returns:
-
SpawnPoint
: The SpawnPoint object for the player, or null if no valid spawn points exist or playerNum is negative.
Retrieves the world position of a spawn point for the specified player number. Uses modulo arithmetic with spawnPointOffset to cycle through available spawn points if there are fewer spawn points than players.
Parameters:
- int playerNum: The player number (0-based) requesting a spawn position.
Returns:
-
Vector3
: The Vector3 position of the spawn point, or (-1000, -1000, -1000) if no valid spawn points exist or playerNum is negative.
Generates a pseudo-random horizontal offset for unit positioning.
Returns:
-
float
: A horizontal offset value between -5 and +5 units with complex distribution
Checks whether the current map contains any sandstorm or sandworm trigger actions. This is used to determine if desert-specific environmental effects should be prepared.
Returns:
-
bool
: True if the map contains sandstorm or sandworm triggers, false otherwise
Checks whether the current map contains any sandstorm or sandworm trigger actions. This is used to determine if desert-specific environmental effects should be prepared.
Returns:
-
bool
: True if the map contains sandstorm or sandworm triggers, false otherwise
Checks if the current map contains any sandstorm or sandworm trigger actions.
Returns:
-
bool
: True if sandstorm or sandworm triggers exist; false otherwise.
Checks whether the current map contains alien enemies. This is used to determine if alien-specific gameplay mechanics should be enabled.
Returns:
-
bool
: True if the map contains aliens, false otherwise
Checks whether the current map contains alien enemies. This is used to determine if alien-specific gameplay mechanics should be enabled.
Returns:
-
bool
: True if the map contains aliens, false otherwise
Checks if the current map contains alien enemies.
Returns:
-
bool
: True if aliens are present in the map; false otherwise.
Checks if a position is inside a wall or solid terrain using a reduced radius collision check.
Parameters:
- float x: The X coordinate of the position to check.
- float y: The Y coordinate of the position to check.
- float size: The size of the object. The actual check uses size/2 as the radius.
- bool strictlyGround: If true, only checks ground layers; if false, includes additional collision layers.
Returns:
-
bool
: True if the position overlaps solid terrain; false if the position is clear.
Checks if a background block exists at the specified grid position. Background blocks are visual elements rendered behind the main terrain.
Parameters:
- int collumn: The column index to check.
- int row: The row index to check.
Returns:
-
bool
: True if a background block exists at this position; false if the position is out of bounds or no background block exists.
Checks if the terrain at the specified position is compatible with the given ground type for blending. Combines boundary checking with terrain compatibility rules.
Parameters:
- GroundType compareGroundType: The ground type to check compatibility with.
- int collumn: The column index to check.
- int row: The row index to check.
Returns:
-
bool
: True if the position is out of bounds or the terrain is compatible; false if incompatible terrain exists.
Checks if the block at the specified position has been destroyed. Destroyed blocks no longer provide collision or visual representation.
Parameters:
- int collumn: The column index to check.
- int row: The row index to check.
Returns:
-
bool
: True if the position is out of bounds, empty, or the block is marked as destroyed; false if an intact block exists.
Checks if the specified grid position has no block. Empty positions allow free movement and projectile passage.
Parameters:
- int collumn: The column index to check.
- int row: The row index to check.
Returns:
-
bool
: True if the position is empty (no block) or out of bounds; false if a block exists.
Checks if a solid block has an open (non-solid) adjacent block in the specified direction. Used for determining valid surfaces for slime attachment and other directional mechanics.
Parameters:
- int c: The column index of the block to check.
- int r: The row index of the block to check.
- DirectionEnum direction: The direction to check for an open adjacent block (Up, Down, Left, or Right).
Returns:
-
bool
: True if the block at (c,r) is solid and has a non-solid block in the specified direction; false otherwise.
Determines if a block position represents a floor tile by checking if it's solid with at least two empty blocks above it. Used for pathfinding and spawn placement.
Parameters:
- int c: The column index of the block to check.
- int r: The row index of the block to check.
Returns:
-
bool
: True if the block is solid and has two empty blocks directly above it; false otherwise.
Checks if the block at the specified position is a ladder that units can climb. Checks the original map data for any ladder terrain type.
Parameters:
- int collumn: The column index to check.
- int row: The row index to check.
Returns:
-
bool
: True if the position contains any type of climbable ladder; false otherwise.
Checks if the position contains a ladder that units can climb. Convenience overload that converts world coordinates to grid position.
Parameters:
- float x: The world X coordinate to check.
- float y: The world Y coordinate to check.
Returns:
-
bool
: True if the position contains any type of climbable ladder; false otherwise.
Checks if the block at the specified position is quicksand. Quicksand blocks slow movement and can trap units that stay too long.
Parameters:
- int collumn: The column index to check.
- int row: The row index to check.
Returns:
-
bool
: True if the position contains an intact quicksand block; false if out of bounds, empty, or destroyed.
Checks if the position contains quicksand. Convenience overload that converts world coordinates to grid position.
Parameters:
- float x: The world X coordinate to check.
- float y: The world Y coordinate to check.
Returns:
-
bool
: True if the position contains an intact quicksand block; false otherwise.
Checks if the block at the specified position is a sandbag. Sandbags provide cover and can be destroyed by explosions.
Parameters:
- int collumn: The column index to check (relative to current map offset).
- int row: The row index to check (relative to current map offset).
Returns:
-
bool
: True if the position contains a sandbag block; false otherwise.
Checks if the block at a grid point position is solid and blocks movement. Convenience overload that accepts a GridPoint structure.
Parameters:
- GridPoint gp: The grid point containing column and row coordinates.
Returns:
-
bool
: True if the block is solid and blocks movement; false if empty or passable.
Checks if the block at the specified grid position is solid and blocks movement. Solid blocks prevent units from passing through, except for ladder types which are climbable.
Parameters:
- int collumn: The column index to check.
- int row: The row index to check.
Returns:
-
bool
: True if the block is solid and blocks movement (including out-of-bounds positions); false if empty, destroyed, or a climbable ladder type.
Checks if the block at the specified position is solid terrain (earth, rock, metal, etc). Used to distinguish terrain blocks from other solid objects.
Parameters:
- int collumn: The column index to check.
- int row: The row index to check.
Returns:
-
bool
: True if the block is solid terrain or position is out of bounds; false if empty, destroyed, or non-terrain block type.
Checks if the block at the specified position is solid according to the ground type rules. Overload that accepts a ground type parameter (though it's not used in the implementation).
Parameters:
- GroundType groundType: The ground type parameter (unused in current implementation).
- int collumn: The column index to check.
- int row: The row index to check.
Returns:
-
bool
: True if the position is out of bounds or contains a solid ground type; false if empty or non-solid.
Checks if the block at the specified position blocks water flow. Bridges and ladders allow water to pass through, while solid blocks contain it.
Parameters:
- int collumn: The column index to check.
- int row: The row index to check.
Returns:
-
bool
: True if the block prevents water flow (including out-of-bounds); false if water can pass through or no block exists.
Determines whether a checkpoint with the specified ID is configured as an airdrop checkpoint. Airdrop checkpoints spawn players from above rather than on the ground.
Parameters:
- int id: The checkpoint ID to check.
Returns:
-
bool
: True if the checkpoint exists and has its airDropCheckPoint flag set, false otherwise.
Checks if any citizen (civilian NPC) is within a rectangular range of the specified position. Used for AI decisions and player actions that need to consider nearby civilians.
Parameters:
- float x: The X coordinate to check from
- float y: The Y coordinate to check from
- int xRange: The horizontal search range in world units
- int yRange: The vertical search range in world units
Returns:
-
bool
: True if at least one citizen is within the specified range, false otherwise
Checks if any citizen (civilian NPC) is within a rectangular range of the specified position. Used for AI decisions and player actions that need to consider nearby civilians.
Parameters:
- float x: The X coordinate to check from
- float y: The Y coordinate to check from
- int xRange: The horizontal search range in world units
- int yRange: The vertical search range in world units
Returns:
-
bool
: True if at least one citizen is within the specified range, false otherwise
Checks if any citizen (civilian NPC) is within the specified rectangular range.
Parameters:
- float x: The X coordinate of the search center.
- float y: The Y coordinate of the search center.
- int xRange: The horizontal search range in world units.
- int yRange: The vertical search range in world units.
Returns:
-
bool
: True if at least one citizen is found within range; false otherwise.
Checks if a vertical column of blocks is completely empty (non-solid) within the specified row span. Supports both upward and downward checking based on rowSpan sign.
Parameters:
- int c: The column index to check.
- int r: The starting row index.
- int rowSpan: The number of rows to check. Negative values check downward, positive values check upward.
Returns:
-
bool
: True if all blocks in the specified column range are non-solid or out of bounds; false if any solid block exists.
Checks if a foreground block exists at the specified grid position. Foreground blocks are the main terrain elements that units interact with.
Parameters:
- int collumn: The column index to check.
- int row: The row index to check.
Returns:
-
bool
: True if a foreground block exists at this position; false if the position is out of bounds or no foreground block exists.
Checks if a grid position contains solid ground by testing for colliders at the block's center position.
Parameters:
- int collumn: The column index of the grid position to check.
- int row: The row index of the grid position to check.
- bool strictlyGround: If true, only checks ground layers; if false, includes additional collision layers.
Returns:
-
bool
: True if ground exists at the specified grid position; false otherwise.
Checks if a pixel in a terrain texture represents empty space based on its alpha channel. Used during map generation from image data.
Parameters:
- Texture2D tex: The texture to sample.
- int x: The X coordinate of the pixel to check.
- int y: The Y coordinate of the pixel to check.
Returns:
-
bool
: True if the pixel's alpha value is less than 0.94 (mostly transparent); false if opaque.
Determines if a ground type represents solid terrain that blocks movement. Central method for defining which terrain types are considered solid obstacles.
Parameters:
- GroundType groundType: The ground type to check.
Returns:
-
bool
: True if the ground type is solid and blocks movement; false for passable types like ladders, bridges, and decorative elements.
Checks if the map area above a crate position is sufficiently open for gameplay purposes.
Parameters:
- int collumn: The column coordinate of the crate.
- int row: The row coordinate of the crate.
Returns:
-
bool
: True if the area above is open enough; false if too many solid blocks are present.
Determines if the map area above a crate position is sufficiently open for spawn mechanics. Checks if there are fewer than 5 solid blocks in the upper portion of the map above the specified position.
Parameters:
- int collumn: The column index of the crate position
- int row: The row index of the crate position
Returns:
-
bool
: True if the area above is considered open (less than 5 solid blocks), false if it's too enclosed
Determines if the map area above a crate position is sufficiently open for spawn mechanics. Checks if there are fewer than 5 solid blocks in the upper portion of the map above the specified position.
Parameters:
- int collumn: The column index of the crate position
- int row: The row index of the crate position
Returns:
-
bool
: True if the area above is considered open (less than 5 solid blocks), false if it's too enclosed
Checks if a position is near the current active checkpoint. Returns checkpoint position and airdrop status for spawn determination.
Parameters:
- float x: The X coordinate to check
- float y: The Y coordinate to check
- out Vector2 checkPointPos: Output parameter for the checkpoint position
- out bool spawnViaAirdrop: Output parameter indicating if spawn should be via airdrop
Returns:
-
bool
: True if near the current active checkpoint, false otherwise
Checks if a position is near the current active checkpoint. Simplified overload that doesn't return checkpoint details.
Parameters:
- float x: The X coordinate to check
- float y: The Y coordinate to check
Returns:
-
bool
: True if near the current active checkpoint, false otherwise
Checks if a position is near any activated checkpoint. Returns airdrop status but checks all activated checkpoints, not just the current one.
Parameters:
- float x: The X coordinate to check
- float y: The Y coordinate to check
- out bool spawnViaAirdrop: Output parameter indicating if spawn should be via airdrop
Returns:
-
bool
: True if near any activated checkpoint, false otherwise
Checks if a world position has a background block at its grid location. Note: parameters are named incorrectly in implementation.
Parameters:
- float x: The X coordinate in world units (despite being used as Y in GetCollumn).
- float y: The Y coordinate in world units (despite being used as Y in second GetCollumn).
Returns:
-
bool
: True if a background block exists at the calculated grid position; false otherwise.
Checks if a position with the specified radius overlaps any ground blocks. Used for collision detection and grounding checks.
Parameters:
- float x: The X coordinate of the center position to check.
- float y: The Y coordinate of the center position to check.
- float size: The radius of the sphere to check for ground overlap.
- bool strictlyGround: If true, only checks against ground layers; if false, includes additional collision layers.
Returns:
-
bool
: True if the sphere at the specified position overlaps any ground; false otherwise.
Determines if two ground types are compatible for terrain blending or connection. Compatible terrains can connect seamlessly without visual breaks.
Parameters:
- GroundType sourceGroundType: The first ground type to compare.
- GroundType otherGroundType: The second ground type to compare.
Returns:
-
bool
: True if the ground types are compatible and can blend together; false if they should remain separate.
Checks if the terrain at the specified position matches the given ground type. Used for terrain consistency checks during modifications.
Parameters:
- GroundType sourceGroundType: The ground type to compare against.
- int collumn: The column index to check.
- int row: The row index to check.
Returns:
-
bool
: True if the terrain at the position matches the source ground type; false if different or out of bounds.
private static float LineToPointDistance2D(Vector2 pointA, Vector2 pointB, Vector2 pointC, bool isSegment)
Calculates the minimum distance from a point to a line or line segment in 2D space. This method supports both infinite lines and finite line segments.
Parameters:
- Vector2 pointA: The first point defining the line
- Vector2 pointB: The second point defining the line
- Vector2 pointC: The point to measure distance from
- bool isSegment: If true, treats the line as a finite segment; if false, treats it as an infinite line
Returns:
-
float
: The minimum distance from pointC to the line/segment defined by pointA and pointB
private static float LineToPointDistance2D(Vector2 pointA, Vector2 pointB, Vector2 pointC, bool isSegment)
Calculates the shortest distance from a point to a line or line segment in 2D space.
Parameters:
- Vector2 pointA: The starting point of the line or line segment.
- Vector2 pointB: The ending point of the line or line segment.
- Vector2 pointC: The point to calculate the distance from.
- bool isSegment: If true, treats the line as a finite segment; if false, treats it as an infinite line.
Returns:
-
float
: The shortest distance from pointC to the line or line segment.
private static float LineToPointDistance2D(Vector2 pointA, Vector2 pointB, Vector2 pointC, bool isSegment)
Calculates the minimum distance from a point to a line or line segment in 2D space. This method supports both infinite lines and finite line segments.
Parameters:
- Vector2 pointA: The first point defining the line
- Vector2 pointB: The second point defining the line
- Vector2 pointC: The point to measure distance from
- bool isSegment: If true, treats the line as a finite segment; if false, treats it as an infinite line
Returns:
-
float
: The minimum distance from pointC to the line/segment defined by pointA and pointB
Handles the loading and offset management for map areas during level transitions. Updates the load offset values based on whether the map is in editing mode.
Marks a specific block for persistence by transferring it to the persistent blocks container. This is a helper method used by PersistBlocks to process individual blocks.
Parameters:
- Block block: The block to make persistent
Marks a specific block for persistence by transferring it to the persistent blocks container. This is a helper method used by PersistBlocks to process individual blocks.
Parameters:
- Block block: The block to make persistent
Marks a single block to persist across level transitions.
Parameters:
- Block block: The block to make persistent.
Transfers a GameObject to the persistent blocks container by changing its parent. This ensures the object survives scene transitions when persistence is enabled.
Parameters:
- GameObject go: The GameObject to make persistent
Transfers a GameObject to the persistent blocks container by changing its parent. This ensures the object survives scene transitions when persistence is enabled.
Parameters:
- GameObject go: The GameObject to make persistent
Moves a game object to the persistent blocks container to survive level transitions.
Parameters:
- GameObject go: The game object to make persistent.
Enables block persistence and transfers all current foreground and background blocks to the persistent storage system. This allows blocks to survive level transitions when loading time optimizations are active.
Enables block persistence and transfers all current foreground and background blocks to the persistent storage system. This allows blocks to survive level transitions when loading time optimizations are active.
Enables block persistence and prepares blocks to survive the next level transition.
public Block PlaceGround(GroundType placeGroundType, int x, int y, ref Block[,] newBlocks, bool addToRegistry = true)
Places a ground block of the specified type at the given grid position. Handles block instantiation, theme application, and map state updates.
Parameters:
- GroundType placeGroundType: The type of ground block to place (Earth, Metal, Wood, etc.).
- int x: The column index where the block should be placed.
- int y: The row index where the block should be placed.
- Block[ newBlocks: Reference to the 2D array of blocks being built/modified.
- out ] addToRegistry: Whether to add the block to the global block registry (default true).
Returns:
-
Block
: The newly created Block instance, or null if placing an empty block type.
Attempts to push a block at the specified grid position with the given horizontal force. Blocks can only be pushed if editing mode is disabled and the block supports push mechanics.
Parameters:
- int collumn: The column index of the block to push.
- int row: The row index of the block to push.
- float xI: The horizontal force to apply. Positive values push right, negative values push left.
Returns:
-
bool
: True if the block was successfully pushed; false if the block can't be pushed, is already broken, or editing mode is active.
Attempts to push a block by raycasting from a position in the specified direction. Uses physics raycasting to find pushable blocks along the ray.
Parameters:
- float x: The X coordinate to start the raycast from.
- float y: The Y coordinate to start the raycast from.
- float xI: The horizontal force to apply. Positive values raycast right, negative values raycast left.
- float distance: The maximum distance to check for pushable blocks.
Returns:
-
bool
: True if a block was found and successfully pushed; false if no pushable block was found or editing mode is active.
Registers a checkpoint with the map's checkpoint system and assigns it a sequential ID based on the current count of checkpoints. Checkpoints serve as respawn locations and progress markers throughout a level. Initializes the checkpoints list if it doesn't exist.
Parameters:
- CheckPoint checkPoint: The CheckPoint object to register, which will have its checkPointID set to the current checkpoint count.
Registers a spawn point with the map's spawn system. Spawn points determine where players respawn after death or at the start of a level. Initializes the spawn points list if it doesn't exist.
Parameters:
- SpawnPoint spawnPoint: The SpawnPoint object to register.
Removes a checkpoint from the map's checkpoint tracking system. Note that this may invalidate checkpoint IDs for checkpoints registered after the removed one.
Parameters:
- CheckPoint checkPoint: The CheckPoint object to remove.
Replaces all cages in the current map with ammunition and revival crates. This is typically used in specific game modes or when transitioning to different gameplay scenarios.
Replaces all cages in the current map with ammunition and revival crates. This is typically used in specific game modes or when transitioning to different gameplay scenarios.
Replaces all existing cages in the level with ammunition and revival crates.
Replaces a single cage with ammunition and revival crates at the same position. This helper method handles the transformation of individual cages.
Parameters:
- Cage cage: The cage to replace with crates
Replaces a single cage with ammunition and revival crates at the same position. This helper method handles the transformation of individual cages.
Parameters:
- Cage cage: The cage to replace with crates
Replaces a single cage with a 2x2 arrangement of ammunition and revival crates.
Parameters:
- Cage cage: The cage to replace with power-up crates.
Configures the map to start from a horizontal super checkpoint with a specific X-axis offset.
Parameters:
- int xLoadOffset: The horizontal offset in grid units for loading the level.
Sets up a horizontal super checkpoint with a specific X-axis load offset. This is used for horizontal level transitions where the map needs to load at a specific horizontal position.
Parameters:
- int xLoadOffset: The horizontal offset for loading the level, clamped to non-negative values
Sets up a horizontal super checkpoint with a specific X-axis load offset. This is used for horizontal level transitions where the map needs to load at a specific horizontal position.
Parameters:
- int xLoadOffset: The horizontal offset for loading the level, clamped to non-negative values
Configures the map to start from a super checkpoint on the next level load.
Marks that the next level load should start from a super checkpoint. This affects spawn positioning and level initialization.
Marks that the next level load should start from a super checkpoint. This affects spawn positioning and level initialization.
Configures the map to start from a vertical super checkpoint with a specific Y-axis offset.
Parameters:
- int yLoadOffset: The vertical offset in grid units for loading the level.
Sets up a vertical super checkpoint with a specific Y-axis load offset. This is used for vertical level transitions where the map needs to load at a specific vertical position.
Parameters:
- int yLoadOffset: The vertical offset for loading the level, clamped to non-negative values
Sets up a vertical super checkpoint with a specific Y-axis load offset. This is used for vertical level transitions where the map needs to load at a specific vertical position.
Parameters:
- int yLoadOffset: The vertical offset for loading the level, clamped to non-negative values
Enables or disables the loading time optimization system. When enabled, the map will attempt to persist certain blocks between level loads to reduce loading times.
Parameters:
- bool actuallyTry: True to enable loading time optimizations, false to disable them
Enables or disables the loading time optimization system. When enabled, the map will attempt to persist certain blocks between level loads to reduce loading times.
Parameters:
- bool actuallyTry: True to enable loading time optimizations, false to disable them
Enables or disables the loading time reduction optimization system.
Parameters:
- bool actuallyTry: True to enable optimization; false to disable.
Checks whether the loading time optimization system is currently active. Returns true only if optimizations are enabled, the level editor is not active, and the asset pool is not disabled.
Returns:
-
bool
: True if loading time optimizations are active and available, false otherwise
Checks whether the loading time optimization system is currently active. Returns true only if optimizations are enabled, the level editor is not active, and the asset pool is not disabled.
Returns:
-
bool
: True if loading time optimizations are active and available, false otherwise
Checks if the loading time reduction optimization is currently active.
Returns:
-
bool
: True if optimization is enabled and conditions are met; false otherwise.
Checks if the original map data at the specified position contained earth-like terrain. Uses map load offsets to check the original terrain type before any modifications.
Parameters:
- int collumn: The column index to check (relative to current map offset).
- int row: The row index to check (relative to current map offset).
Returns:
-
bool
: True if the original terrain was earth-like (including various earth, stone, and background types); false otherwise.
Checks if the original map data at the specified position was air or empty. Used to determine if a position was originally passable before modifications.
Parameters:
- int collumn: The column index to check (relative to current map offset).
- int row: The row index to check (relative to current map offset).
Returns:
-
bool
: True if the original terrain was air or empty; true for out-of-bounds positions.
Checks if the original map data at the specified position contained solid terrain. Comprehensive check for all solid terrain types in the original map data.
Parameters:
- int collumn: The column index to check (relative to current map offset).
- int row: The row index to check (relative to current map offset).
Returns:
-
bool
: True if the original terrain was any solid type or position is out of bounds; false if originally empty or air.
LayerMask for the MobileBarriers layer. Used to detect movable barriers and obstacles that can block movement or projectiles but may be pushable or destructible.
List of objects that block or influence camera movement. Camera blockers are registered via RegisterCameraBlocker and removed via RemoveCameraBlocker. Used by the camera system to prevent viewing certain areas or to create cinematic boundaries. Initialized in Awake() and set to null in OnDestroy().
Static list tracking all checkpoint objects in the current map. Checkpoints are added via RegisterCheckPoint() and removed via DeregisterCheckPoint(). Used for respawn mechanics and progress tracking.
LayerMask for Unity's Default layer. Used for general-purpose collision detection with objects that haven't been assigned to a specific gameplay layer.
Reference to the level exit portal prefab. Used by CreateExitPortal() to instantiate exit portals at specified positions. The portal is placed 112 units above the given position with a 16-unit horizontal offset.
LayerMask for the DirtyHippie layer. Despite the unusual name, this layer is used for fragile or easily breakable objects in the game world that can be destroyed by minimal force.
LayerMask combining Ground, IndestructibleGround, LargeObjects, and FLUI layers. Extended ground collision mask that includes damageable objects, used for comprehensive collision detection in combat and damage calculations.
LayerMask combining Ground, IndestructibleGround, and LargeObjects layers. Used for general ground collision detection including destructible terrain, permanent terrain, and large solid objects. This is the primary collision mask for most ground-based physics queries.
LayerMask combining only Ground and IndestructibleGround layers, excluding LargeObjects. Used for strict terrain-only collision detection when large objects should be ignored, such as certain movement or placement checks.
LayerMask for the Hanging layer. Used to detect overhead bars, ropes, and other objects that units can hang from or traverse hand-over-hand.
Tracks the Y coordinate of the highest solid block placed on the map. Updated during PlaceGround when placing solid blocks (excluding ladders and empty spaces). Used by CollapseTop to determine where to start collapsing terrain from the top. Minimum value is clamped to 11 during collapse operations.
Tracks the Y coordinate 5 blocks above the highest solid block. Updated alongside highestSolidBlock during PlaceGround operations. Set to highestSolidBlock + 5 when a new highest solid block is placed.
LayerMask for the Ladders layer. Used to detect climbable ladder objects that allow vertical movement when units interact with them.
LayerMask for the LargeObjects layer only. Used to specifically detect collision with large environmental objects that are separate from terrain, such as vehicles, large props, or destructible structures.
The rightmost column index currently active in the block deactivation system. Defaults to 256. Updated by RunDeactivationOffscreen() to optimize performance by deactivating off-screen blocks.
Maximum X position of active units used for extending the visible area. The offscreen deactivation system tracks unit positions to ensure blocks near active units remain loaded. Reset to -100001f when recalculating boundaries and updated via ExtendDisableToUnitPosition.
Maximum Y position of active units used for extending the visible area. The offscreen deactivation system tracks unit positions to ensure blocks near active units remain loaded. Reset to -100001f when recalculating boundaries and updated via ExtendDisableToUnitPosition.
The leftmost column index currently active in the block deactivation system. Updated by RunDeactivationOffscreen() to track which blocks should be active based on camera position.
The bottom row index currently active in the block deactivation system. Updated by RunDeactivationOffscreen() to track which blocks should be active based on camera position.
Minimum X position of active units used for extending the visible area. The offscreen deactivation system tracks unit positions to ensure blocks near active units remain loaded. Reset to 100001f when recalculating boundaries and updated via ExtendDisableToUnitPosition.
Minimum Y position of active units used for extending the visible area. The offscreen deactivation system tracks unit positions to ensure blocks near active units remain loaded. Reset to 100001f when recalculating boundaries and updated via ExtendDisableToUnitPosition.
Temporary storage for the nearest checkpoint found during proximity searches. Used by GetNearestCheckpoint methods to track the closest checkpoint while iterating through all checkpoints. This field optimizes performance during frequent checkpoint proximity checks.
LayerMask for the Platform layer. Used to detect one-way platforms that units can jump through from below but stand on from above, common in platformer gameplay mechanics.
Reference to the invisible spawn point prefab. Instantiated for spawn points that should function without visual indicators. Used via spawnPointInvisiblePrefabReference.Asset during map generation.
Random offset applied to spawn point selection to vary player starting positions. Initialized to a random value between 0 and 55 during map setup. Used when calculating spawn positions by adding this offset to the player number before modulo operation with total spawn points.
Reference to the standard visible spawn point prefab. Instantiated when placing regular spawn points that show a visual indicator. Typically paired with an empty cage doodad placed above it.
List of player spawn points in the map. Spawn points are registered via RegisterSpawnPoint. Used by GetSpawnPointPos and GetSpawnPoint to determine where players spawn, cycling through points based on player number and spawnPointOffset. Critical for multiplayer spawn distribution. Initialized in Awake() and set to null in OnDestroy().
Indicates whether the player should start from a super checkpoint position instead of normal spawn points. When true, uses superCheckpointStartPos for the player's starting location. Reset to false during ClearSuperCheckpointStatus.
The grid position where players spawn when starting from a super checkpoint. Used in conjunction with startFromSuperCheckPoint to override normal spawn behavior. Both column and row are set to -1 when cleared, indicating no super checkpoint is active.
LayerMask for the Switches layer. Used to detect interactive switch objects that can trigger events, open doors, or activate mechanisms when interacted with by units.
The size of a single tile in the map grid system, measured in world units. This constant defines the fundamental unit of measurement for the Map's grid-based coordinate system.
The standard tile size in pixels used throughout the map grid system.
The size of a single tile in the map grid system, measured in world units. This constant defines the fundamental unit of measurement for the Map's grid-based coordinate system.
LayerMask for the Units layer. Used to detect collision with units (enemies, players, NPCs) for combat targeting, movement blocking, and interaction checks.
Counter used by GetUnitXOffset() to generate pseudo-random X position offsets for units. Incremented each time an offset is requested to create variation in unit placement.
LayerMask for the Finish layer. Used to detect level completion triggers and victory zones that end the level when reached by players.
LayerMask for the Water layer. Used to detect water volumes for swimming mechanics, drowning checks, and water-specific physics interactions.
Applies blood effects to decal doodads within a circular range of the specified position. Iterates through decal doodads up to the count of destroyable doodads and calls the Bloody() method on doodads within range, decreasing the iteration index when a doodad is bloodied to account for potential list modifications.
Parameters:
- float x: The X coordinate of the blood effect center.
- float y: The Y coordinate of the blood effect center.
- float range: The radius within which doodads will be bloodied.
public static bool DamageDoodads(int damage, DamageType damageType, float x, float y, float xI, float yI, float range, int playerNum, out bool hitImpenetrableDoodad, MonoBehaviour sender = null)
Damages destroyable doodads within a circular range, applying damage based on player permissions and doodad properties. Checks if doodads can be damaged by mooks (if playerNum is negative) or heroes, respects immunity flags, and tracks whether impenetrable doodads were hit.
Parameters:
- int damage: The amount of damage to apply to doodads.
- DamageType damageType: The type of damage being applied.
- float x: The X coordinate of the damage center.
- float y: The Y coordinate of the damage center.
- float xI: The horizontal force component for the damage.
- float yI: The vertical force component for the damage.
- float range: The radius within which doodads will be damaged.
- int playerNum: The player number causing the damage (negative values indicate mook damage).
- out bool hitImpenetrableDoodad: Output parameter set to true if an impenetrable doodad was hit.
- MonoBehaviour sender: The MonoBehaviour that caused the damage (optional).
Returns:
-
bool
: True if at least one doodad was damaged, false otherwise.
public static bool DamageStaticDoodads(float x, float y, float xI, float yI, float range, MonoBehaviour sender = null)
Damages static doodads within a circular range by causing them to collapse. Iterates through the static doodads list in reverse order and collapses any doodads within the specified range.
Parameters:
- float x: The X coordinate of the damage center.
- float y: The Y coordinate of the damage center.
- float xI: The horizontal force component (currently unused in implementation).
- float yI: The vertical force component (currently unused in implementation).
- float range: The radius within which static doodads will be damaged.
- MonoBehaviour sender: The MonoBehaviour that caused the damage (optional, currently unused).
Returns:
-
bool
: True if at least one static doodad was damaged, false otherwise.
Alerts alien eggs within a 64-unit radius of a position. Used to trigger alien egg reactions when players get too close.
Parameters:
- float x: The X coordinate to check from
- float y: The Y coordinate to check from
- int playerNum: The player number disturbing the eggs (unused in current implementation)
Disturbs wildlife and alerts units within hearing range of a sound. Wildlife uses hearing range multipliers, units check their hearing capabilities and player allegiance.
Parameters:
- float x: The X coordinate of the disturbance
- float y: The Y coordinate of the disturbance
- float range: The base range of the disturbance
- int playerNum: The player number causing the disturbance (-1 skips unit alerts)
public static List<TargetableObject> GeTargetableObjectsInRange(int playerNum, float range, float x, float y)
Gets all enemy targetable objects within a circular range. Uses Manhattan distance (sum of X and Y distances) for range calculation.
Parameters:
- int playerNum: The player number searching for targets
- float range: The maximum Manhattan distance to search within
- float x: The X position to search from
- float y: The Y position to search from
Returns:
-
List<TargetableObject>
: A list of all targetable objects within range that are enemies of the specified player
Gets the number of available variations for a specific doodad type. Used to determine valid variation indices when spawning doodads.
Parameters:
- DoodadType type: The type of doodad to check variations for
Returns:
-
int
: The number of available variations for the doodad type
Finds any switch that can be activated by mooks (enemies) within range. Filters for switches with mook activation permissions.
Parameters:
- float x: The X position to search from
- float y: The Y position to search from
Returns:
-
Switch
: The nearest mook-activatable switch, checking both registered list and physics overlaps, or null if none found
Finds any switch within interaction range of the specified position. Checks both registered switches list and physics overlaps.
Parameters:
- float x: The X position to search from
- float y: The Y position to search from
Returns:
-
Switch
: The nearest switch within 16 units horizontally and 24 units vertically, or null if none found
Finds any teleport door within interaction range of the specified position. Used for teleporter entrance detection.
Parameters:
- float x: The X position to search from
- float y: The Y position to search from
Returns:
-
TeleportDoor
: The nearest teleport door within 32 units horizontally and 24 units vertically, or null if none found
Finds the nearest acid pool within the specified range that doesn't fully submerge units. Iterates through all registered acid pools and returns the first one within range that either is null or doesn't submerge units (SubMergesUnit returns false).
Parameters:
- float x: The X coordinate to search from.
- float y: The Y coordinate to search from.
- float range: The maximum distance to search for acid pools.
Returns:
-
DoodadAcidPool
: The nearest DoodadAcidPool within range that doesn't fully submerge units, or null if none found.
public static TargetableObject GetNextClosestTargetableObject(int playerNum, DirectionEnum direction, float xRange, float yRange, float x, float y, List<TargetableObject> alreadyFoundTargets)
Finds the next closest targetable object (destructible environment pieces) in a specified direction. Used for target cycling systems.
Parameters:
- int playerNum: The player number searching for targets
- DirectionEnum direction: The direction to search in (Up, Down, Left, Right, or Any)
- float xRange: The horizontal search range
- float yRange: The vertical search range
- float x: The X position to search from
- float y: The Y position to search from
- System.Collections.Generic.List{TargetableObject} alreadyFoundTargets: List of targets to exclude from the search
Returns:
-
TargetableObject
: The next closest targetable object in the specified direction, or null if none found
public static TargetableObject GetNextClosestTargetableObjectOnScreen(int playerNum, float xRange, float yRange, float x, float y, bool onlyBossTargets = false)
Finds the closest targetable object that is currently visible on screen. Can optionally filter for boss-specific targets only.
Parameters:
- int playerNum: The player number searching for targets
- float xRange: The horizontal search range
- float yRange: The vertical search range
- float x: The X position to search from
- float y: The Y position to search from
- bool onlyBossTargets: If true, only returns objects marked as boss targets
Returns:
-
TargetableObject
: The closest on-screen targetable object, or null if none found
Finds and returns the paired endpoint for a given zipline point.
Parameters:
- ZiplinePoint zipLinePoint: The zipline point to find a pair for
Returns:
-
ZiplinePoint
: The other endpoint of the zipline, or null if no valid pair exists
Retrieves a static doodad at the specified grid coordinates. Iterates through all registered static doodads to find one matching the given column and row position.
Parameters:
- int collumn: The column coordinate in the map grid to search. Note: Parameter name contains a typo ("collumn").
- int row: The row coordinate in the map grid to search.
Returns:
-
Doodad
: The Doodad at the specified grid position, or null if no static doodad exists at that location.
Damages wildlife within range of a position. Only affects already disturbed wildlife, with vertical range 3x the horizontal range.
Parameters:
- float x: The X coordinate of the damage source
- float y: The Y coordinate of the damage source
- float range: The horizontal range for damaging wildlife
Checks if a position is within a substance (submerging) doodad like water, acid, or quicksand. Iterates through all grass/blood doodads and finds those that submerge units within range.
Parameters:
- float x: The X coordinate to check
- float y: The Y coordinate to check
- float range: The range to check for substance doodads
Returns:
-
Doodad
: The first substance doodad found at the position, or null if none found
Applies jiggle physics to doodads within range of a position. Forces are calculated based on distance from center and applied to grass/blood doodads, also triggers slime jiggling.
Parameters:
- float x: The X coordinate of the jiggle origin
- float y: The Y coordinate of the jiggle origin
- float xRange: The horizontal range of the jiggle effect
- float yRange: The vertical range of the jiggle effect
- float force: The force multiplier (multiplied by 100 before applying)
Jiggles slime doodads that contain a position within their bounds. Checks if position is within slime bounds (accounting for width/height) and applies horizontal force.
Parameters:
- float x: The X coordinate to check for slime
- float y: The Y coordinate to check for slime
- float xRange: The horizontal range (unused in current implementation)
- float yRange: The vertical range (unused in current implementation)
Checks if a position passes through damageable scenery and knocks it. Used to interact with destructible environmental objects like crates or barrels.
Parameters:
- float x: The X coordinate to check
- float y: The Y coordinate to check
- float xI: The horizontal velocity for knocking
- float yI: The vertical velocity for knocking
Returns:
-
bool
: True if any scenery was knocked, false otherwise
Places a doodad (decorative or interactive object) in the map based on the provided doodad information. Handles spawning of all doodad types including enemies, traps, checkpoints, cages, vehicles, decorations, and special objects. Applies variation selection, position adjustment, and game mode specific modifications.
Parameters:
- DoodadInfo doodad: The doodad information containing type, position, variation, and other spawn data
Returns:
-
GameObject
: The instantiated GameObject for the doodad, or null if spawning conditions aren't met
Registers an alien egg explosive with the map's tracking system. Alien eggs are environmental hazards that can explode when damaged or triggered, spawning facehuggers or dealing area damage to nearby units.
Parameters:
- AlienEggExplosive egg: The AlienEggExplosive object to register.
Registers an alien telepathy trigger with the map's tracking system. These triggers are special environmental objects that activate telepathic alien behaviors when players enter their trigger zones, potentially alerting or controlling nearby alien units.
Parameters:
- AlienTelepathyTrigger alien: The AlienTelepathyTrigger object to register.
Registers a cage object with the map's tracking system. Cages are interactive objects that typically contain prisoners or power-ups that can be freed by destroying the cage. Initializes the cages list if it doesn't exist.
Parameters:
- Cage cage: The Cage object to register for tracking.
Registers a camera blocker object that restricts camera movement in specific areas. Camera blockers are used to create boundaries that prevent the camera from moving beyond certain points, typically used for level boundaries or cinematic sequences.
Parameters:
- CameraBlockers cB: The CameraBlockers object to register.
Registers a DamageableScenery object with the map's scenery tracking system. Prevents duplicate registrations and initializes the damageableScenery list if it doesn't exist. Note: Method name contains a typo ("Scenerye").
Parameters:
- DamageableScenery tree: The DamageableScenery to register.
Registers a decal doodad with the map's tracking system. Decal doodads are visual elements like blood splatters or burn marks that can be applied to surfaces and affected by environmental effects. Initializes the decal doodads list if it doesn't exist.
Parameters:
- Doodad doodad: The Doodad object representing a decal to register.
Registers a destroyable doodad (decorative object) with the map's tracking system. Doodads include environmental props like barrels, crates, signs, and other destructible scenery that adds visual detail and can be destroyed for effect.
Parameters:
- Doodad doodad: The Doodad object to register as destroyable.
Registers a grass or blood doodad with the map's substance tracking system. If the doodad is an acid pool (DoodadAcidPool), it is also added to the specialized acid pools list for additional tracking. Prevents duplicate registrations by checking if the doodad already exists in the list.
Parameters:
- Doodad doodad: The Doodad object to register, which can be grass, blood, acid, or other liquid substances.
Registers a helicopter with the map by setting it as the newest helicopter reference. This static reference is used by various systems to interact with the most recently spawned helicopter on the map.
Parameters:
- Helicopter heli: The Helicopter object to register as the newest helicopter.
Registers a jiggly slime doodad with the map's tracking system. Jiggly bits are special doodads that exhibit physics-based jiggling behavior when affected by explosions or other forces.
Parameters:
- Doodad doodad: The Doodad object representing jiggly slime to register.
Registers a MookDoor with the map's door tracking system. Initializes the mookDoors list if it doesn't exist.
Parameters:
- MookDoor door: The MookDoor to register.
Registers a static doodad with the map's tracking system. Static doodads are non-moving environmental objects that can be damaged or collapsed but don't have special behaviors like jiggly physics. Initializes the static doodads list if it doesn't exist.
Parameters:
- Doodad doodad: The Doodad object to register as a static environmental element.
Registers a Switch with the map's switch tracking system. Initializes the switches list if it doesn't exist.
Parameters:
- Switch swit: The Switch to register.
Registers a TeleportDoor with the map's teleport system. Adds the door to the general teleportDoors list and also to either entranceDoors or exitDoors based on the door's isEntranceDoor property.
Parameters:
- TeleportDoor teleportDoor: The TeleportDoor to register.
Registers a tree foliage object with the map's tracking system for environmental effects. Tree foliage includes palm trees and other vegetation that can shake when affected by explosions or other forces, creating visual feedback for nearby impacts.
Parameters:
- TreeFoliage tree: The TreeFoliage object to register for tracking.
Removes an alien egg explosive from the map's tracking system, typically after it has exploded or been destroyed. This ensures the egg is no longer considered for gameplay interactions or AI targeting.
Parameters:
- AlienEggExplosive egg: The AlienEggExplosive object to remove from tracking.
Removes an alien telepathy trigger from the map's tracking system, typically when the trigger is destroyed or no longer needed. This prevents the trigger from continuing to affect alien behavior after it should be inactive.
Parameters:
- AlienTelepathyTrigger alien: The AlienTelepathyTrigger object to remove from tracking.
Removes a cage from the map's tracking system, typically after it has been destroyed and its contents freed. Checks if the cages list exists before attempting removal.
Parameters:
- Cage cage: The Cage object to remove from tracking.
Removes a camera blocker from the map's tracking system, allowing the camera to move freely through the previously blocked area. This is typically called when a blocker is destroyed or when transitioning between level sections.
Parameters:
- CameraBlockers cB: The CameraBlockers object to remove from tracking.
Removes a decal doodad from the map's tracking system, typically when cleaning up visual effects or when the decal is no longer needed.
Parameters:
- Doodad doodad: The Doodad object representing a decal to remove.
Removes a destroyable doodad from the map's tracking system. This method is typically called when a doodad is destroyed or no longer needs to be tracked for damage calculations.
Parameters:
- Doodad doodad: The Doodad object to remove from the destroyable doodads list.
Removes a grass or blood doodad from the map's substance tracking system. If the doodad is an acid pool, it is also removed from the specialized acid pools list. Only removes the doodad if it exists in the tracking list.
Parameters:
- Doodad doodad: The Doodad object to remove from substance tracking.
Removes a jiggly slime doodad from the map's tracking system, typically when the jiggly bit is destroyed or no longer needs physics simulation.
Parameters:
- Doodad doodad: The Doodad object representing jiggly slime to remove.
Removes a MookDoor from the map's door tracking system.
Parameters:
- MookDoor door: The MookDoor to remove.
Removes a static doodad from the map's tracking system, typically when it has been destroyed or collapsed.
Parameters:
- Doodad doodad: The Doodad object to remove from static doodad tracking.
Removes a Switch from the map's switch tracking system. This method can be called via network RPC.
Parameters:
- Switch swit: The Switch to remove.
Removes a TeleportDoor from all relevant tracking lists (teleportDoors, entranceDoors, or exitDoors based on the door's type).
Parameters:
- TeleportDoor teleportDoor: The TeleportDoor to remove.
Resets all ziplines in the map and re-establishes their connections.
Sets oil particles on fire by raycasting in a specific direction from an origin point. Used internally by explosions to ignite nearby oil.
Parameters:
- Vector2 direction: Direction to check for oil particles
- Vector3 origin: Starting position for the raycast
Shakes tree foliage within a specified range from a position. Applies force to trees based on their distance from the center position, also triggers doodad jiggling.
Parameters:
- float x: The X coordinate of the shake origin
- float y: The Y coordinate of the shake origin
- float xRange: The horizontal range of the shake effect
- float yRange: The vertical range of the shake effect
- float force: The force multiplier for the shake effect
List of acid pool hazards that damage units on contact. Acid pools are registered via RegisterAcidPool and removed via RemoveAcidPool. Used for environmental hazard mechanics and damage-over-time effects. Initialized in Awake() and set to null in OnDestroy().
List of triggers for alien telepathy events. Triggers are registered via RegisterAlienTelepathyTrigger and removed via RemoveAlienTelepathyTrigger. Used for alien-specific gameplay mechanics and mind control effects. Initialized in Awake() and set to null in OnDestroy().
Static list tracking all cage objects containing prisoners or collectibles. Cages are registered via RegisterCage() and removed via RemoveCage(). Used for rescue objectives and collectible tracking.
List of scenery objects that can take damage and be destroyed. Scenery is registered via RegisterDamageableScenery and removed via RemoveDamageableScenery. Used for destructible environment elements larger than doodads. Initialized in Awake() and set to null in OnDestroy().
List of decorative doodads that render as decals (e.g., blood splatters, scorch marks). Doodads are registered via RegisterDecalDoodad and removed via RemoveDecalDoodad. Used for visual environmental effects that don't affect gameplay. Initialized in Awake() and set to null in OnDestroy().
List of doodads that can be destroyed by damage (e.g., crates, barrels, destructible props). Doodads are registered via RegisterDestroyableDoodad and removed via RemoveDestroyableDoodad. Used for environmental destruction and chain reaction mechanics. Initialized in Awake() and set to null in OnDestroy().
Subset of teleportDoors that serve as entrance portals. Entrance doors are added when RegisterTeleportDoor is called with an entrance-type door and removed via RemoveTeleportDoor. Used for level transitions and spawn point mechanics. Initialized in Awake() and set to null in OnDestroy().
Subset of teleportDoors that serve as exit portals. Exit doors are added when RegisterTeleportDoor is called with an exit-type door and removed via RemoveTeleportDoor. Used for level completion and transition mechanics. Initialized in Awake() and set to null in OnDestroy().
Network ID for the level exit portal. Allocated deterministically during map setup and used to register the exit portal GameObject when created via CreateExitPortal. The portal spawns at the specified position offset by (16, 112) pixels.
List of grass and blood effect doodads. These are visual elements registered via RegisterGrassAndBloodDoodad and removed via RemoveGrassAndBloodDoodad. Used for organic environmental decoration and gore effects. Initialized in Awake() and set to null in OnDestroy().
List of jiggly slime doodads with physics-based movement. Slime doodads are registered via RegisterJigglySlime and removed via RemoveJigglySlime. Used for organic environmental effects with bouncy physics properties. Initialized in Awake() and set to null in OnDestroy().
private static List<HiddenExplosives> LevelEndExplosionActiveList = new List<HiddenExplosives>(10)
List of currently active HiddenExplosives objects creating level end explosion effects. Objects are moved here from the bank when MakeLevelEndExplosion is called and returned to the bank during map cleanup. Initialized with capacity of 10.
private static List<HiddenExplosives> LevelEndExplosionBank = new List<HiddenExplosives>(10)
Pool of inactive HiddenExplosives objects used for level end explosion effects. Pre-populated with 10 instances during map initialization to avoid runtime instantiation. Objects are moved to the active list when triggered and returned to this bank when the map is destroyed.
The initial size and increment value for the level end explosion object pool. Set to 10, this determines how many HiddenExplosives objects are pre-instantiated in the bank during initialization.
Static list of all MookDoor objects in the map. Doors are registered via RegisterMookDoor() and removed via DeRegisterMookDoor(). Used for managing interactive door mechanics that enemies can open or players can destroy.
Reference to the remote control explosive car prefab. This prefab reference allows the map to instantiate remote controlled explosive vehicles when required by map data or gameplay events.
Reference to the Predabro rope prefab used for spawning rope objects in the map. This prefab reference allows the map to instantiate rope elements when needed for gameplay mechanics.
List of static non-interactive doodads for decoration. Static doodads are registered via RegisterStaticDoodad and removed via RemoveStaticDoodad. Used for immutable environmental props that provide visual detail. Initialized in Awake() and set to null in OnDestroy().
List of all interactive switches in the map. Switches are registered via RegisterSwitch (which includes null-check initialization) and removed via RemoveSwitch. Used for puzzle mechanics and triggered events. The RegisterSwitch method initializes this list if null. Set to null in OnDestroy().
Master list of all teleport doors regardless of type. Doors are registered via RegisterTeleportDoor and removed via RemoveTeleportDoor. This list contains all doors, while entranceDoors and exitDoors contain type-specific subsets. Initialized in Awake() and set to null in OnDestroy().
List of tree foliage objects for jungle/forest environments. Tree foliage is registered via RegisterTreeFoliage and removed via RemoveTreeFoliage. Used for environmental decoration with potential physics interactions. Initialized in Awake() and set to null in OnDestroy().
public static Unit GetNearestEnemyUnit(int playerNum, int xRange, int yRange, float x, float y, bool includeDead, int xDirection = 0, Unit ignoreUnit = null)
Finds the nearest enemy unit that can be damaged by the specified player. This is a convenience overload that calls the full GetNearestEnemyUnit with equal X and Y ranges.
Parameters:
- int playerNum: Player number for damage checking
- int range: Maximum search range (used for both X and Y)
- float x: X position to search from
- float y: Y position to search from
- bool includeDead: Whether to include dead units in the search
Returns:
-
Unit
: The nearest enemy unit, or null if none found
public static Unit GetNearestEnemyUnit(int playerNum, int xRange, int yRange, float x, float y, bool includeDead, int xDirection = 0, Unit ignoreUnit = null)
Finds the nearest enemy unit within specified X and Y ranges that can be damaged by the player. Supports directional filtering and unit exclusion.
Parameters:
- int playerNum: Player number for damage checking
- int xRange: Maximum horizontal search range
- int yRange: Maximum vertical search range
- float x: X position to search from
- float y: Y position to search from
- bool includeDead: Whether to include dead units in the search
- int xDirection: Direction filter (1 for right only, -1 for left only, 0 for both)
- Unit ignoreUnit: Optional unit to exclude from the search
Returns:
-
Unit
: The nearest enemy unit matching all criteria, or null if none found
Finds the nearest evil unit (enemy) within range that is still alive. Uses Manhattan distance for proximity calculations and checks the IsEvil() flag on units.
Parameters:
- int range: Maximum search range
- float x: X position to search from
- float y: Y position to search from
Returns:
-
Unit
: The nearest evil unit, or null if none found
public static Unit GetNearestHero(Unit ignore, int direction, int xRange, int yRange, float x, float y, bool includeDead)
Finds the nearest hero (player character) within specified ranges, with optional direction filtering. Searches through the BroBase.bros list rather than general units.
Parameters:
- Unit ignore: Unit to exclude from the search
- int direction: Direction filter (1 for right only, -1 for left only, 0 for both)
- int xRange: Maximum horizontal search range
- int yRange: Maximum vertical search range
- float x: X position to search from
- float y: Y position to search from
- bool includeDead: Whether to include dead heroes in the search
Returns:
-
Unit
: The nearest hero matching the criteria, or null if none found
Finds the nearest unit belonging to a specific player within range using Manhattan distance. Similar to GetNearestUnitWithXBias but uses a local variable for tracking instead of static fields.
Parameters:
- int playerNum: Player number to match
- int range: Maximum search range
- float x: X position to search from
- float y: Y position to search from
- bool includeDead: Whether to include dead units in the search
Returns:
-
Unit
: The nearest unit matching the criteria, or null if none found
public static Unit GetNearestUnitWithXBias(int playerNum, int range, float x, float y, bool includeDead)
Finds the nearest unit belonging to a specific player within range, using Manhattan distance (sum of X and Y distances) for calculations. Biases search horizontally.
Parameters:
- int playerNum: Player number to match
- int range: Maximum search range
- float x: X position to search from
- float y: Y position to search from
- bool includeDead: Whether to include dead units in the search
Returns:
-
Unit
: The nearest unit matching the criteria, or null if none found
Finds the nearest dead unit belonging to a specific player that has line of sight from the search position. Uses raycasting to ensure no solid terrain blocks the path.
Parameters:
- int playerNum: Player number to match
- int range: Maximum search range
- float x: X position to search from
- float y: Y position to search from
Returns:
-
Unit
: The nearest visible dead unit, or null if none found
public static Unit GetNearestVisibleUnit(int playerNum, int range, float x, float y, bool includeDead)
Finds the nearest unit belonging to a specific player that has line of sight from the search position. Uses raycasting to ensure visibility.
Parameters:
- int playerNum: Player number to match
- int range: Maximum search range
- float x: X position to search from
- float y: Y position to search from
- bool includeDead: Whether to include dead units in the search
Returns:
-
Unit
: The nearest visible unit, or null if none found
public static Unit GetNearestVisibleUnitDamagebleBy(int playerNum, int range, float x, float y, bool includeDead)
Finds the nearest enemy unit that has line of sight from the search position and can be damaged by the specified player. Combines visibility checking with damage relationship checking.
Parameters:
- int playerNum: Player number for damage checking
- int range: Maximum search range
- float x: X position to search from
- float y: Y position to search from
- bool includeDead: Whether to include dead units in the search
Returns:
-
Unit
: The nearest visible enemy unit, or null if none found
public static Unit GetNextClosestUnit(int playerNum, DirectionEnum direction, float xRange, float yRange, float x, float y, List<Unit> alreadyFoundUnits)
Finds the next closest enemy unit in a specified direction, excluding units already found. Used for cycling through targets.
Parameters:
- int playerNum: The player number searching for enemies
- DirectionEnum direction: The direction to search in (Up, Down, Left, Right, or Any)
- float xRange: The horizontal search range
- float yRange: The vertical search range
- float x: The X position to search from
- float y: The Y position to search from
- System.Collections.Generic.List{Unit} alreadyFoundUnits: List of units to exclude from the search
Returns:
-
Unit
: The next closest unit in the specified direction, or null if none found
public static Unit GetNextClosestUnitOnScreen(int playerNum, float xRange, float yRange, float x, float y)
Finds the closest enemy unit that is currently visible on screen. Used for auto-targeting systems that should only target visible enemies.
Parameters:
- int playerNum: The player number searching for enemies
- float xRange: The horizontal search range
- float yRange: The vertical search range
- float x: The X position to search from
- float y: The Y position to search from
Returns:
-
Unit
: The closest on-screen enemy unit, or null if none found
public static int GetUnitCountInRange(float xRange, float yRange, float x, float y, bool includeDead)
Counts the number of units within a rectangular range without creating a list. More efficient than GetUnitsInRange when only the count is needed.
Parameters:
- float xRange: Maximum horizontal distance from center
- float yRange: Maximum vertical distance from center
- float x: X position of rectangle center
- float y: Y position of rectangle center
- bool includeDead: Whether to include dead units in the count
Returns:
-
int
: Number of units within the specified range
public static List<Unit> GetUnitsInRange(float xRange, float yRange, float x, float y, bool includeDead)
Populates a list with all units within a circular range of a position. Uses squared distance for efficiency and adds a 6 unit vertical offset to unit positions for center-of-mass calculations.
Parameters:
- int range: Radius of the search circle
- float x: X position of circle center
- float y: Y position of circle center
- bool includeDead: Whether to include dead units
- System.Collections.Generic.List{Unit} unitsInRange: List to populate with found units (not cleared before adding)
public static List<Unit> GetUnitsInRange(float xRange, float yRange, float x, float y, bool includeDead)
Returns a new list containing all units within a circular range of a position. Creates and returns a new list rather than populating an existing one.
Parameters:
- int range: Radius of the search circle
- float x: X position of circle center
- float y: Y position of circle center
- bool includeDead: Whether to include dead units
Returns:
-
List<Unit>
: New list containing all units within range
public static List<Unit> GetUnitsInRange(float xRange, float yRange, float x, float y, bool includeDead)
Populates a list with all units within a rectangular range of a position. Uses separate X and Y ranges for rectangular area searches.
Parameters:
- float xRange: Maximum horizontal distance from center
- float yRange: Maximum vertical distance from center
- float x: X position of rectangle center
- float y: Y position of rectangle center
- bool includeDead: Whether to include dead units
- System.Collections.Generic.List{Unit} unitsInRange: List to populate with found units (not cleared before adding)
public static List<Unit> GetUnitsInRange(float xRange, float yRange, float x, float y, bool includeDead)
Returns a new list containing all units within a rectangular range of a position. Creates and returns a new list rather than populating an existing one.
Parameters:
- float xRange: Maximum horizontal distance from center
- float yRange: Maximum vertical distance from center
- float x: X position of rectangle center
- float y: Y position of rectangle center
- bool includeDead: Whether to include dead units
Returns:
-
List<Unit>
: New list containing all units within the rectangular range
public static bool IsEnemyUnitNearby(int playerNum, float x, float y, float xRange, float yRange, bool includeDeadUnits)
Checks if any enemy unit exists within a directional range with optional line of sight checking. Used for AI threat detection.
Parameters:
- int playerNum: The player number searching for enemies
- float x: The X position to search from
- float y: The Y position to search from
- int xDirection: The horizontal direction constraint (-1 for left only, 1 for right only, 0 for both)
- float xRange: The horizontal search range
- float yRange: The vertical search range
- bool includeDeadUnits: Whether to include dead units in the search
- bool testForVisible: If true, performs line of sight check to each potential target
Returns:
-
bool
: True if at least one enemy unit is found that meets all criteria, false otherwise
public static bool IsEnemyUnitNearby(int playerNum, float x, float y, float xRange, float yRange, bool includeDeadUnits)
Checks if any enemy unit exists within the specified range in any direction. Simplified version without directional constraints.
Parameters:
- int playerNum: The player number searching for enemies
- float x: The X position to search from
- float y: The Y position to search from
- float xRange: The horizontal search range
- float yRange: The vertical search range
- bool includeDeadUnits: Whether to include dead units in the search
Returns:
-
bool
: True if at least one enemy unit is found within range, false otherwise
Checks if a specific unit is within range of a position using Manhattan distance. Adds 6 units to the unit's Y position for center-of-mass calculations.
Parameters:
- Unit unit: The unit to check
- int range: Maximum allowed distance
- float x: X position to measure from
- float y: Y position to measure from
Returns:
-
bool
: True if the unit is within range, false otherwise
public static bool IsUnitNearby(int playerNum, float x, float y, float xRange, float yRange, bool includeDeadUnits, out Unit nearestUnit)
Checks if any allied unit (same player number) exists within the specified range. Used for proximity detection of friendly units.
Parameters:
- int playerNum: The player number to check for (finds units with same player number)
- float x: The X position to search from
- float y: The Y position to search from
- float xRange: The horizontal search range
- float yRange: The vertical search range
- bool includeDeadUnits: Whether to include dead units in the search
Returns:
-
bool
: True if at least one allied unit is found within range, false otherwise
public static bool IsUnitNearby(int playerNum, float x, float y, float xRange, float yRange, bool includeDeadUnits, out Unit nearestUnit)
Checks for allied units within range and returns the nearest one found. Extended version that provides access to the found unit.
Parameters:
- int playerNum: The player number to check for (finds units with same player number)
- float x: The X position to search from
- float y: The Y position to search from
- float xRange: The horizontal search range
- float yRange: The vertical search range
- bool includeDeadUnits: Whether to include dead units in the search
- out Unit nearestUnit: Output parameter that will contain the nearest allied unit found
Returns:
-
bool
: True if at least one allied unit is found within range, false otherwise
Registers a citizen NPC with the map's unit tracking system. Citizens are non-combatant NPCs that can be rescued by players, react to danger, and contribute to level objectives or scoring.
Parameters:
- Citizen citizen: The Citizen object to register for tracking.
Registers a wildlife creature as disturbed, indicating it has been startled or agitated by player actions, explosions, or other disturbances. Disturbed wildlife may flee, make noise, or exhibit other panic behaviors.
Parameters:
- WildLife wildLifeObject: The WildLife object to register as disturbed.
Registers a Unit with the map's unit tracking system. If the unit is a Mook and addToStatistics is true, also registers it with the StatisticsController for kill tracking.
Parameters:
- Unit unit: The Unit to register.
- bool addToStatistics: If true and the unit is a Mook, registers it with StatisticsController for kill tracking.
Registers a wildlife creature with the map's tracking system. Wildlife includes passive animals like pigs, chickens, and other creatures that populate levels and can react to player actions or explosions.
Parameters:
- WildLife wildLifeObject: The WildLife object to register.
Removes a citizen from the map's unit tracking system, typically when they are rescued, killed, or otherwise removed from gameplay. This ensures they are no longer considered for AI targeting or rescue objectives.
Parameters:
- Citizen citizen: The Citizen object to remove from tracking.
Removes a wildlife creature from the disturbed wildlife tracking list, typically when it has calmed down, been killed, or is no longer in a disturbed state. This allows the creature to return to normal behavior patterns.
Parameters:
- WildLife wildLifeObject: The WildLife object to remove from disturbed tracking.
Removes a Unit from the map's unit tracking system.
Parameters:
- Unit unit: The Unit to remove.
Removes a wildlife creature from the map's general tracking system, typically when the creature is killed, leaves the level, or is no longer needed for gameplay purposes.
Parameters:
- WildLife wildLifeObject: The WildLife object to remove from tracking.
Spawns an alien baneling (face hugger variant) at the specified position with initial velocity. These aliens climb on walls and ceilings to ambush players.
Parameters:
- float x: The x coordinate to spawn at
- float y: The y coordinate to spawn at
- float xI: The initial x velocity
- float yI: The initial y velocity
Returns:
-
AlienClimber
: The spawned AlienClimber instance
Spawns an alien face hugger at the specified position with initial velocity. These aliens jump at players and attach to their faces.
Parameters:
- float x: The x coordinate to spawn at
- float y: The y coordinate to spawn at
- float xI: The initial x velocity
- float yI: The initial y velocity
Returns:
-
AlienClimber
: The spawned AlienClimber instance
Static list tracking all alien egg explosives in the current map. Used to manage alien spawn points that can hatch facehuggers when disturbed or destroyed by player actions.
List of civilian NPCs that need rescuing or protection. Citizens are registered via RegisterCitizen and removed via RemoveCitizen. Used for rescue missions and civilian AI behavior. The registration method prevents duplicate entries. Initialized in Awake() and set to null in OnDestroy().
Static list of wildlife that have been disturbed by explosions or player actions. Wildlife are added via RegisterDisturbedWildLife() when startled and removed via RemoveDisturbedWildLife() when calmed or killed.
List of objects that monitor or react to hero presence. Watchers are registered via RegisterHeroWatcher and removed via RemoveHeroWatcher. Used for triggering events, cinematics, or AI behaviors based on player proximity. The registration method prevents duplicate entries. Initialized in Awake() and set to null in OnDestroy().
Temporary storage for the nearest unit found during proximity searches. Used by GetNearestUnit methods to track the closest unit while iterating through all units. This field is used for optimization to avoid allocating new variables during frequent proximity checks.
Static list containing all active Unit objects in the map. This is the primary registry for all enemies, NPCs, and other unit types. Units are added during spawn/creation and removed when destroyed. Used for AI targeting and game state management.
Static list tracking all wildlife creatures in the map (pigs, chickens, etc). Wildlife are registered via RegisterWildLife() and removed via RemoveWildLife(). Separate from the disturbed wildlife tracking.
Activates alien telepathy triggers within sensing range of the specified grid position.
Parameters:
- int collumn: The column index of the activation source
- int row: The row index of the activation source
- int chainCount: The current chain reaction count for limiting propagation
Adds a bro (player character) to the appropriate hero transport vehicle. Determines transport type based on game mode and map settings, then adds the bro to either the helicopter, portal, or truck transport.
Parameters:
- TestVanDammeAnim Bro: The bro character to add to the transport
Fully alerts all enemy units within a rectangular range, making them aware of a player at the specified position. The GridPoint parameter appears to be unused in the implementation.
Parameters:
- float x: X position of the alert source
- float y: Y position of the alert source
- float xRange: Half-width of the rectangular alert area
- float yRange: Half-height of the rectangular alert area
- int playerNum: Player number that triggered the alert
- GridPoint startPoint: Grid point where the alert originated (unused in implementation)
Fully alerts all living enemy units within a rectangular range, making them aware of a player at the specified position. Only affects units with negative player numbers and positive health.
Parameters:
- float x: X position of the alert source
- float y: Y position of the alert source
- float xRange: Half-width of the rectangular alert area
- float yRange: Half-height of the rectangular alert area
- int playerNum: Player number that triggered the alert
Attracts all alien units within a rectangular range to move toward the specified position. Affects units with playerNum of -2 or units that are instances of the Alien class.
Parameters:
- float x: X position to attract aliens toward
- float y: Y position to attract aliens toward
- float xRange: Half-width of the rectangular attraction area
- float yRange: Half-height of the rectangular attraction area
Attracts all enemy units (mooks) within a rectangular range to move toward the specified position. Only affects units with negative player numbers (enemies).
Parameters:
- float x: X position to attract units toward
- float y: Y position to attract units toward
- float xRange: Half-width of the rectangular attraction area
- float yRange: Half-height of the rectangular attraction area
Makes a sound that bothers nearby enemy units, causing them to investigate. Only affects living enemy units that have the ability to hear (CanHear property is true).
Parameters:
- float x: X position of the sound source
- float y: Y position of the sound source
- float xRange: Half-width of the rectangular sound area
- float yRange: Half-height of the rectangular sound area
- int playerNum: Player number making the sound (currently unused in implementation)
Forces the hero transport to be called in regardless of current state. Handles different spawn modes (Portal, Truck, Helicopter) and calls the appropriate transport if it hasn't already entered the level.
public static void CallInTransport(Vector3 startLocation, bool ArriveByHelicopter, bool ArriveByPortal)
Initiates the hero transport arrival sequence. Sends an RPC to all clients to synchronize the transport arrival.
Parameters:
- Vector3 startLocation: The position where the transport should arrive
- bool ArriveByHelicopter: Whether to use helicopter transport
- bool ArriveByPortal: Whether to use portal transport
private void CallInTransport_RPC(Vector3 startLocation, bool ArriveByHelicopter, bool ArriveByPortal)
RPC handler that executes the transport arrival on all clients. Activates the appropriate transport type and initiates its entry sequence.
Parameters:
- Vector3 startLocation: The position where the transport should arrive
- bool ArriveByHelicopter: Whether to use helicopter transport
- bool ArriveByPortal: Whether to use portal transport
internal static bool CanSeeNPCEnemyUnit(float x, float y, int FacingDirection, int sightRangeX, int sightRangeY, int playerNum)
Searches for visible enemy units within a directional sight range with no vertical direction preference. Wrapper that calls the full overload with yDirection set to 0.
Parameters:
- float x: The X position to search from
- float y: The Y position to search from
- int FacingDirection: The direction to search in (-1 for left, 1 for right)
- int sightRangeX: The horizontal search range in units
- int sightRangeY: The vertical search range in units
- int playerNum: The player number of the searching unit
- out int seenEnemyNum: Output parameter for the seen enemy's player number
- out float enemyX: Output parameter for the seen enemy's X position
- out float enemyY: Output parameter for the seen enemy's Y position
Returns:
-
bool
: True if an enemy unit was found, false otherwise
internal static bool CanSeeNPCEnemyUnit(float x, float y, int FacingDirection, int sightRangeX, int sightRangeY, int playerNum)
Searches for visible enemy units within a directional sight range with optional vertical direction filtering. Full implementation that checks line of sight and stealth status.
Parameters:
- float x: The X position to search from
- float y: The Y position to search from
- int FacingDirection: The horizontal direction to search in (-1 for left, 1 for right)
- int yDirection: The vertical direction preference (-1 for down, 1 for up, 0 for no preference)
- int sightRangeX: The horizontal search range in units
- int sightRangeY: The vertical search range in units
- int playerNum: The player number of the searching unit
- out int seenEnemyNum: Output parameter for the seen enemy's player number
- out float enemyX: Output parameter for the seen enemy's X position
- out float enemyY: Output parameter for the seen enemy's Y position
Returns:
-
bool
: True if an enemy unit was found that meets all criteria, false otherwise
internal static bool CanSeeNPCEnemyUnit(float x, float y, int FacingDirection, int sightRangeX, int sightRangeY, int playerNum)
Checks if any enemy unit is visible within a directional sight range without returning position information. Simplified version for basic visibility checks.
Parameters:
- float x: The X position to search from
- float y: The Y position to search from
- int FacingDirection: The direction to search in (-1 for left, 1 for right)
- int sightRangeX: The horizontal search range in units
- int sightRangeY: The vertical search range in units
- int playerNum: The player number of the searching unit
Returns:
-
bool
: True if any enemy unit is visible within range, false otherwise
public static bool CanSeeNPCEnemyUnitWithPosition(float x, float y, int FacingDirection, int sightRangeX, int sightRangeY, int playerNum, ref int seenEnemyNum, ref float seenPositionX, ref float seenPositionY)
Searches for visible enemy units within a directional sight range and returns the first found enemy's position. Used by AI to detect player units in their field of view.
Parameters:
- float x: The X position to search from
- float y: The Y position to search from
- int FacingDirection: The direction to search in (-1 for left, 1 for right, 0 for both directions)
- int sightRangeX: The horizontal search range in units
- int sightRangeY: The vertical search range in units
- int playerNum: The player number of the searching unit (will find enemies of this player)
- out int seenEnemyNum: Output parameter that will contain the player number of the seen enemy
- out float seenPositionX: Output parameter that will contain the X position of the seen enemy
- out float seenPositionY: Output parameter that will contain the Y position of the seen enemy
Returns:
-
bool
: True if an enemy unit was found within the sight range, false otherwise
public static bool CanSeePosition(float fromPositionX, float fromPositionY, float seenPositionX, float seenPositionY)
Checks if there is a clear line of sight between two grid positions using raycast collision detection. Tests visibility between the center points of two grid blocks.
Parameters:
- int fromCollumn: The starting column position in the grid
- int fromRow: The starting row position in the grid
- int seenCollumn: The target column position to check visibility to
- int seenRow: The target row position to check visibility to
Returns:
-
bool
: True if there is a clear line of sight between the positions (no ground or fragile terrain blocking), false otherwise
public static bool CanSeePosition(float fromPositionX, float fromPositionY, float seenPositionX, float seenPositionY)
Checks if there is a clear line of sight between two world positions using raycast collision detection. Tests direct visibility between exact coordinates.
Parameters:
- float fromPositionX: The starting X position in world coordinates
- float fromPositionY: The starting Y position in world coordinates
- float seenPositionX: The target X position to check visibility to
- float seenPositionY: The target Y position to check visibility to
Returns:
-
bool
: True if there is a clear line of sight between the positions (no ground or fragile terrain blocking), false otherwise
public static bool CheckHighFive(int playerNum, float x, float y, float xRange, float yRange, int direction)
Checks if a player can perform a high five with another player within range. Players must be facing each other (opposite directions) and both must be player-controlled units.
Parameters:
- int playerNum: Player number attempting the high five
- float x: X position to check from
- float y: Y position to check from
- float xRange: Maximum horizontal distance for high five
- float yRange: Maximum vertical distance for high five
- int direction: Direction the initiating player is facing
Returns:
-
bool
: True if a high five connection was successfully made, false otherwise
Broadcasts an enemy death event to all registered death listeners. This method is called when an enemy unit dies and notifies all triggers that are monitoring for enemy eliminations, allowing them to evaluate their conditions.
Parameters:
- Unit unit: The Unit that has died, passed to listeners for evaluation.
public static void ForgetPlayer(int playerNum, float x, float y, float xRange, float yRange, bool confuseMooks, bool amuseMooks)
Makes all AI units on the map forget about a specific player. Affects all units regardless of distance.
Parameters:
- int playerNum: The player number (0-3) to forget.
- bool confuseMooks: If true, makes AI units lose sight of the player; if false and amuseMooks is false, makes them forget the player entirely.
- bool amuseMooks: If true, makes AI units laugh at the dead player.
public static void ForgetPlayer(int playerNum, float x, float y, float xRange, float yRange, bool confuseMooks, bool amuseMooks)
Makes AI units within a circular range forget about a specific player.
Parameters:
- int playerNum: The player number (0-3) to forget.
- float x: The X coordinate of the range center.
- float y: The Y coordinate of the range center.
- float range: The radius of the circular area of effect.
- bool confuseMooks: If true, makes AI units lose sight of the player; if false and amuseMooks is false, makes them forget the player entirely.
- bool amuseMooks: If true, makes AI units laugh at the dead player.
public static void ForgetPlayer(int playerNum, float x, float y, float xRange, float yRange, bool confuseMooks, bool amuseMooks)
Makes AI units within a rectangular range forget about a specific player.
Parameters:
- int playerNum: The player number (0-3) to forget.
- float x: The X coordinate of the range center.
- float y: The Y coordinate of the range center.
- float xRange: The horizontal half-width of the rectangular area of effect.
- float yRange: The vertical half-height of the rectangular area of effect.
- bool confuseMooks: If true, makes AI units lose sight of the player; if false and amuseMooks is false, makes them forget the player entirely.
- bool amuseMooks: If true, makes AI units laugh at the dead player.
Finds and returns a nearby enemy unit (Mook) that has never been alerted. Used for stealth gameplay mechanics to identify unaware enemies.
Parameters:
- float x: X position to search from
- float y: Y position to search from
- float xRange: Half-width of the rectangular search area
- float yRange: Half-height of the rectangular search area
Returns:
-
Mook
: The first unalerted Mook found in range, or null if none exist
Finds the nearest intact mook door to a given grid position using Manhattan distance. This method uses LINQ to order all doors by distance and returns the first one that hasn't been destroyed, used by AI for pathfinding through door checkpoints.
Parameters:
- int col: The column coordinate in the map grid to search from.
- int row: The row coordinate in the map grid to search from.
Returns:
-
MookDoor
: The nearest non-destroyed MookDoor to the specified position, or null if no intact doors exist.
Finds the nearest scout mook interest point to a given grid position using Manhattan distance calculation. This is used by scout mook AI to determine the closest point to investigate during patrol or alert behaviors.
Parameters:
- int col: The column coordinate in the map grid to search from.
- int row: The row coordinate in the map grid to search from.
Returns:
-
ScoutMookInterestPoint
: The nearest ScoutMookInterestPoint to the specified position, or null if no points exist.
Checks whether any hero transport has entered the level and released heroes. Checks all three transport types (truck, helicopter, portal) to see if any have completed their entry sequence.
Returns:
-
bool
: True if any transport has released heroes, false otherwise
Makes all enemy units (mooks) within a rectangular range dance for a specified duration. Dancing units are temporarily incapacitated.
Parameters:
- float x: X position of the dance effect center
- float y: Y position of the dance effect center
- float xRange: Half-width of the rectangular dance area
- float yRange: Half-height of the rectangular dance area
- float time: Duration of the dance in seconds
public static void PanicUnits(float x, float y, float xRange, float yRange, int direction, float time, bool forgetPlayer)
Causes all enemy units within a circular range to panic and flee. Units will run away from the panic source for 0.1 seconds.
Parameters:
- float x: X position of the panic source
- float y: Y position of the panic source
- float range: Radius of the panic effect
- bool forgetPlayer: Whether panicked units should forget about players they were tracking
public static void PanicUnits(float x, float y, float xRange, float yRange, int direction, float time, bool forgetPlayer)
Causes enemy units within range to panic and flee from a specific player. Only affects units that can be damaged by the specified player number. Units panic for 2 seconds.
Parameters:
- int playernum: Player number causing the panic
- float x: X position of the panic source
- float y: Y position of the panic source
- float range: Radius of the panic effect
- bool forgetPlayer: Whether panicked units should forget about players they were tracking
public static void PanicUnits(float x, float y, float xRange, float yRange, int direction, float time, bool forgetPlayer)
Causes enemy units within range to panic for a specified duration. This overload converts circular range to rectangular range internally.
Parameters:
- float x: X position of the panic source
- float y: Y position of the panic source
- float range: Radius of the panic effect (used for both X and Y range)
- float time: Duration of the panic in seconds
- bool forgetPlayer: Whether panicked units should forget about players they were tracking
- bool runRandomDirection: Whether units should run in random directions or away from the source
public static void PanicUnits(float x, float y, float xRange, float yRange, int direction, float time, bool forgetPlayer)
Causes enemy units within a rectangular range to panic for a specified duration. Units can either flee away from the source or run in random directions.
Parameters:
- float x: X position of the panic source
- float y: Y position of the panic source
- float xRange: Half-width of the rectangular panic area
- float yRange: Half-height of the rectangular panic area
- float time: Duration of the panic in seconds
- bool forgetPlayer: Whether panicked units should forget about players they were tracking
- bool runRandomDirection: If true, units run in random directions; if false, they run away from the source
public static void PanicUnits(float x, float y, float xRange, float yRange, int direction, float time, bool forgetPlayer)
Causes enemy units within a rectangular range to panic in a specific direction for a specified duration. If direction is 0, units will flee away from the source.
Parameters:
- float x: X position of the panic source
- float y: Y position of the panic source
- float xRange: Half-width of the rectangular panic area
- float yRange: Half-height of the rectangular panic area
- int direction: Forced panic direction (-1 left, 1 right, 0 for away from source)
- float time: Duration of the panic in seconds
- bool forgetPlayer: Whether panicked units should forget about players they were tracking
Registers a trigger that responds to enemy death events. These listeners are notified whenever an enemy unit dies, allowing for gameplay mechanics like kill counters, wave completion detection, or triggered events based on eliminations.
Parameters:
- Trigger trig: The Trigger object that will listen for enemy death events.
public static void RegisterFetchObject(float x, float y, float xRange, float yRange, Transform fetchTransform)
Registers an object for nearby enemy units to fetch. Only affects living enemy units that can hear. Unlike other range checks, this method uses exact range comparison rather than accounting for unit width/height.
Parameters:
- float x: X position to check from
- float y: Y position to check from
- float xRange: Maximum horizontal distance to fetch object
- float yRange: Maximum vertical distance to fetch object
- Transform fetchTransform: The transform of the object to fetch
Registers an object that monitors hero (player) activity and position. Hero watchers are typically used by AI systems, traps, or environmental elements that need to react to player presence or actions within their awareness range.
Parameters:
- BroforceObject watcher: The BroforceObject that will watch for hero activity.
Registers a point of interest for scout mook AI behavior. These points represent locations that scout mooks will investigate, patrol to, or use as waypoints during their scouting patterns, often including doors or strategic positions.
Parameters:
- ScoutMookInterestPoint pointObject: The ScoutMookInterestPoint to register.
Removes a trigger from the enemy death listener system, typically when the trigger is destroyed or its conditions have been met. This prevents the trigger from continuing to receive death notifications.
Parameters:
- Trigger trig: The Trigger object to remove from death event listening.
Removes an object from the hero watcher tracking system, typically when the watcher is destroyed or no longer needs to monitor player activity. This prevents unnecessary processing of defunct watchers.
Parameters:
- BroforceObject watcher: The BroforceObject to remove from hero watching.
Removes a scout mook interest point from the tracking system, typically when the point has been used, destroyed, or is no longer relevant for AI pathing. Some interest points are configured to remove themselves after first use.
Parameters:
- ScoutMookInterestPoint pointObject: The ScoutMookInterestPoint to remove from tracking.
Stuns all enemy units (mooks) within a rectangular range for a specified duration. Only affects units with negative player numbers.
Parameters:
- float x: X position of the stun center
- float y: Y position of the stun center
- float xRange: Half-width of the rectangular stun area
- float yRange: Half-height of the rectangular stun area
- float time: Duration of the stun in seconds
List of points of interest for scout mook AI pathfinding. Interest points are registered via RegisterMookInterestPoint and removed via RemoveMookInterestPoint. Used by GetNearestMookInterestPoint to find the closest point based on grid coordinates for AI navigation decisions. Initialized in Awake() and set to null in OnDestroy().
public static void DamageProjectile(Projectile projectile, int damage, DamageType damageType, float xI, float yI, float delay, int newPlayerNum)
Applies damage to a projectile, potentially destroying or redirecting it. Used when projectiles collide with attacks or explosions.
Parameters:
- Projectile projectile: The projectile to damage
- int damage: The amount of damage to apply
- DamageType damageType: The type of damage being applied
- float xI: The horizontal force to apply
- float yI: The vertical force to apply
- float delay: Delay before applying the damage
- int newPlayerNum: The new owner player number (for redirected projectiles)
public static bool DeflectProjectiles(MonoBehaviour newOwner, int playerNum, float range, float x, float y, float xI, bool giveDeflectAchievementOnMookKill)
Deflects enemy projectiles within range back at enemies. Changes projectile ownership, reverses direction, adds scatter, and can trigger achievements.
Parameters:
- MonoBehaviour newOwner: The new owner of deflected projectiles
- int playerNum: The player number doing the deflection
- float range: The deflection range
- float x: The X coordinate of the deflection source
- float y: The Y coordinate of the deflection source
- float xI: The horizontal direction indicator for deflection
- bool giveDeflectAchievementOnMookKill: Whether to award achievement for mook kills with deflected projectiles
Returns:
-
bool
: True if any projectiles were deflected, false otherwise
Gets all active grenades within Manhattan distance that can be damaged by the player. Checks game mode rules for friendly fire and filters by active state.
Parameters:
- int playerNum: The player number to check damage rules for
- float range: The Manhattan distance range
- float x: The X coordinate to search from
- float y: The Y coordinate to search from
Returns:
-
List<Grenade>
: List of grenades within range that can be damaged
Finds the nearest active grenade within range using Manhattan distance. Returns the single closest grenade regardless of player ownership.
Parameters:
- float range: The maximum search range
- float x: The X coordinate to search from
- float y: The Y coordinate to search from
Returns:
-
Grenade
: The nearest grenade within range, or null if none found
Finds the nearest active satchel pack within range using Manhattan distance. Used for remote detonation and chain explosion mechanics.
Parameters:
- int playerNum: The player number (unused in current implementation)
- float range: The maximum search range
- float x: The X coordinate to search from
- float y: The Y coordinate to search from
Returns:
-
SachelPack
: The nearest satchel pack within range, or null if none found
Gets all projectiles within Manhattan distance that can damage the specified player. Respects game mode damage rules for team damage and friendly fire.
Parameters:
- int playerNum: The player number to check damage rules against
- float range: The Manhattan distance range
- float x: The X coordinate to search from
- float y: The Y coordinate to search from
Returns:
-
List<Projectile>
: List of projectiles within range that can damage the player
public static bool HitGrenades(int playerNum, float range, float x, float y, float xI, float yI, ref float grenadeX, ref float grenadeY)
Checks for grenade hits within range and knocks the first one found. Special handling for coconuts with RPC synchronization for knockback.
Parameters:
- int playerNum: The player number performing the hit check
- float range: The hit detection range
- float x: The X coordinate of the hit origin
- float y: The Y coordinate of the hit origin
- float xI: The horizontal force to apply
- float yI: The vertical force to apply
- out float grenadeX: Output parameter for the hit grenade's X position
- out float grenadeY: Output parameter for the hit grenade's Y position
Returns:
-
bool
: True if a grenade was hit, false otherwise
public static bool HitProjectiles(int playerNum, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, float delay)
Damages damageable projectiles within a square range. Simple overload that uses same range for both X and Y axes.
Parameters:
- int playerNum: The player number dealing damage
- int damage: The damage amount to deal
- DamageType damageType: The type of damage being dealt
- float range: The damage range (used for both axes)
- float x: The X coordinate of the damage source
- float y: The Y coordinate of the damage source
- float xI: The horizontal impact force
- float yI: The vertical impact force
- float delay: The damage delay
Returns:
-
bool
: True if any projectiles were hit, false otherwise
public static bool HitProjectiles(int playerNum, int damage, DamageType damageType, float xRange, float yRange, float x, float y, float xI, float yI, float delay)
Damages damageable projectiles within a rectangular range. Checks projectile size for precise collision and respects damage rules.
Parameters:
- int playerNum: The player number dealing damage
- int damage: The damage amount to deal
- DamageType damageType: The type of damage being dealt
- float xRange: The horizontal damage range
- float yRange: The vertical damage range
- float x: The X coordinate of the damage source
- float y: The Y coordinate of the damage source
- float xI: The horizontal impact force
- float yI: The vertical impact force
- float delay: The damage delay
Returns:
-
bool
: True if any projectiles were hit, false otherwise
Registers a Projectile in the damageable projectiles list, marking it as a projectile that can take damage.
Parameters:
- Projectile projectile: The Projectile to register as damageable.
Registers a Grenade with the map's grenade tracking system.
Parameters:
- Grenade grenade: The Grenade to register.
Registers a Projectile with the map's projectile tracking system.
Parameters:
- Projectile projectile: The Projectile to register.
Registers a SachelPack with the map's satchel pack tracking system.
Parameters:
- SachelPack sachelPack: The SachelPack to register.
Registers a Grenade in the shootable grenades list, marking it as a grenade that can be damaged by gunfire.
Parameters:
- Grenade shootableGrenade: The Grenade to register as shootable.
Removes a Grenade from the map's grenade tracking system.
Parameters:
- Grenade grenade: The Grenade to remove.
Removes a Projectile from both the regular projectiles list and the damageable projectiles list if present.
Parameters:
- Projectile projectile: The Projectile to remove.
Removes a SachelPack from the map's satchel pack tracking system.
Parameters:
- SachelPack sachelPack: The SachelPack to remove.
Removes a Grenade from the shootable grenades list.
Parameters:
- Grenade shootableGrenade: The Grenade to remove from shootable tracking.
List of projectiles that can be destroyed by damage (e.g., rockets that can be shot down). Projectiles are added via RegisterDamageableProjectile and removed via RemoveDamageableProjectile. Used for advanced projectile interaction mechanics. Initialized in Awake() and set to null in OnDestroy().
Master list of all active grenades in the map. Grenades are registered via RegisterGrenade when thrown and removed via RemoveGrenade when they explode or are destroyed. Used for grenade-specific collision detection and detonation logic. Initialized in Awake() and set to null in OnDestroy().
Static counter tracking the number of helicopter calls made during gameplay. Reset to 0 during map initialization. Used to limit or track helicopter usage in levels.
Static reference to a fake helicopter object used for visual effects or scripted sequences where a full helicopter entity isn't needed. Separate from the functional newestHelicopter reference.
public HiddenExplosivesReference hiddenExplosivePrefabReference
Reference to the hidden explosives prefab used for trap mechanics. Instantiated via hiddenExplosivePrefabReference.Asset during map generation to create explosive traps that trigger when players get near.
Static reference to the most recently spawned helicopter in the game. Updated whenever a new helicopter is created, allowing other systems to reference the current active helicopter for extraction or attack sequences.
Master list of all active projectiles in the map. Projectiles are registered via RegisterProjectile when spawned and removed via RemoveProjectile when destroyed. Used by various systems to iterate through all projectiles for collision detection, updates, and cleanup. Initialized in Awake() and set to null in OnDestroy().
List of all placed satchel pack explosives. Satchel packs are registered via RegisterSachelPack when placed and removed via RemoveSachelPack when detonated. Used for remote detonation functionality and chain explosion mechanics. Initialized in Awake() and set to null in OnDestroy().
Subset of grenades that can be detonated by shooting them. Grenades are added via RegisterShootableGrenade and removed via RemoveShootableGrenade. Used by projectile collision systems to check if a grenade should explode when hit. Initialized in Awake() and set to null in OnDestroy().
Initializes the Map singleton when it awakens. Sets up layer masks for collision detection, initializes all tracking lists for game objects, allocates network IDs for deterministic spawning, and prepares the level loading system.
Clears all super checkpoint related data. Resets the super checkpoint position and load offsets to their default values.
Resets level continuation state after loading from a super checkpoint. Clears super checkpoint status to allow normal gameplay to resume.
Cleans up level data when exiting a level. Nullifies the blocks array to free up memory and prepare for the next level.
Checks whether the current level has been completed. Used to determine when to trigger level end sequences and transitions.
Returns:
-
bool
: True if the level is marked as finished, false otherwise
Cleans up all map resources when the Map object is destroyed. Returns all pooled effects to their pools, clears all tracking lists to prevent memory leaks, and properly nullifies all references to allow garbage collection.
Sets up the level blocks and initializes the game world. Handles random seed synchronization for deterministic gameplay, loads the appropriate map data based on game mode, spawns parallax backgrounds and clouds, initializes wind and quicksand controllers, and creates hero transport vehicles based on spawn mode settings.
Determines whether heroes should arrive by helicopter based on the level's starting area. Checks if there are solid blocks or gaps near the start location that would require aerial insertion.
Parameters:
- Vector3 startLocation: The starting position to check from
Returns:
-
bool
: True if helicopter arrival is needed, false if ground-based arrival is possible
Completes map initialization after all objects are awake. Instantiates the helicopter for the host, triggers FirstFrame on all blocks to initialize their state, and sets up any additional level-specific components.
Gets the singleton instance of the Map class using lazy initialization. If no instance exists, searches for a Map object in the scene using Unity's FindObjectOfType.
Tracks whether the editor force start level functionality has already been applied. Used in the editor to ensure that the startLevel field is only applied once when starting the game outside of the main menu. Set to true after the first application to prevent repeated level changes.
Indicates whether the map has completed its setup process. Set to true at the end of SetupBlocksCoroutine after all map initialization is complete, including terrain loading, spawn point setup, and random seed generation.
Static backing field for the singleton Map instance. Used by the Instance property to implement lazy initialization of the Map singleton pattern.
The level number to force start at when running in the editor. When set to a value
= 0 and the game is started outside the main menu in the editor, this overrides the default starting level. Also supports random level selection when randomLevel is enabled, adding a random offset based on randomRange.
Indicates whether the map is waiting for network seed synchronization. Set to false after random seeds are generated for spawn point offset, wood block count, and barrel block count during map setup.
Indicates whether the map is waiting for network synchronization. Used to coordinate map state across networked games before proceeding with initialization.
Assigns a block to the specified grid coordinates. Will only assign if the position is within bounds and either empty, destroyed, or contains a ladder-type block.
Parameters:
- Block block: The block to assign to the grid position
- int collumn: The column index in the grid
- int row: The row index in the grid
Returns:
-
bool
: True if the block was successfully assigned, false if the position is invalid or already contains a solid block
Destroys and removes the background block at the specified grid coordinates if it exists.
Parameters:
- int c: The column index in the grid
- int r: The row index in the grid
Destroys and removes the foreground block at the specified grid coordinates. Also handles clearing the upper part of 2-unit tall blocks.
Parameters:
- int c: The column index in the grid
- int r: The row index in the grid
Collapses the top row of the map by destroying blocks and lowering the ceiling.
Returns:
-
int
: The new highest solid block row index after collapse
Specifically collapses ladder blocks from the top of the map.
Returns:
-
int
: The highest solid block value (not the ladder-specific value)
Deactivates the right half of the map by disabling all blocks beyond the midpoint.
Extends the active area bounds to include the specified unit position with a buffer.
Parameters:
- float x: The x-coordinate of the unit
- float y: The y-coordinate of the unit
- float buffer: The buffer distance around the unit (default: 48 units)
Retrieves the background block at the specified grid coordinates.
Parameters:
- int collumn: The column index in the grid
- int row: The row index in the grid
Returns:
-
Block
: The background block at the specified position, or null if the position is out of bounds or empty
public static GroundType GetBackgroundGroundType(int collumn, int row, GroundType currentGroundType = GroundType.Empty)
Retrieves the ground type of the background block at the specified grid coordinates, falling back to the foreground block if no background block exists.
Parameters:
- int collumn: The column index in the grid
- int row: The row index in the grid
- GroundType currentGroundType: The default ground type to return if the position is out of bounds or both background and foreground are empty
Returns:
-
GroundType
: The ground type of the background block if it exists, otherwise the foreground block's ground type, or currentGroundType if both are empty
Retrieves the foreground block at the specified grid coordinates.
Parameters:
- int collumn: The column index in the grid
- int row: The row index in the grid
Returns:
-
Block
: The block at the specified position, or null if the position is out of bounds or empty
Retrieves the foreground block at the specified world coordinates. Note: This method incorrectly uses the y component of the Vector2 for row calculation instead of column.
Parameters:
- Vector2 worldXY: The world coordinates to check
Returns:
-
Block
: The block at the specified world position, or null if the position is out of bounds or empty
Gets the 2D world position of the center of a block at the specified grid coordinates.
Parameters:
- int collumn: The column index in the grid
- int row: The row index in the grid
Returns:
-
Vector3
: A Vector2 representing the center position of the block
Gets the world x coordinate of the center of a block at the specified column. Each column is 16 units wide.
Parameters:
- int collumn: The column index in the grid
Returns:
-
float
: The world x coordinate of the center of the block
Gets the world y coordinate of the center of a block at the specified row. Each row is 16 units tall.
Parameters:
- int row: The row index in the grid
Returns:
-
float
: The world y coordinate of the center of the block
Retrieves the foreground block at the specified world coordinates, excluding blocks that are marked as destroyed. Note: This method incorrectly uses the y component of the Vector2 for row calculation instead of column.
Parameters:
- Vector2 worldXY: The world coordinates to check
Returns:
-
Block
: The block at the specified world position if it exists and is not destroyed, or null if the position is out of bounds, empty, or contains a destroyed block
Converts a column index to its left world x coordinate. Each column is 16 units wide, with an offset of -8 units.
Parameters:
- int collumn: The column index in the grid
Returns:
-
float
: The world x coordinate of the left edge of the block at the specified column
Converts a row index to its bottom world y coordinate. Each row is 16 units tall, with an offset of -8 units.
Parameters:
- int row: The row index in the grid
Returns:
-
float
: The world y coordinate of the bottom edge of the block at the specified row
Gets the world position of the center of a block at the specified grid coordinates.
Parameters:
- int collumn: The column index in the grid
- int row: The row index in the grid
Returns:
-
Vector3
: A Vector3 representing the center position of the block (z is always 0)
Returns the current descent offset value without modification.
Parameters:
- bool forceCollapse: Whether to force a collapse (parameter is not used)
- int current: The current offset value to return
Returns:
-
int
: The current offset value unchanged
Converts a world position to a grid coordinate point.
Parameters:
- Vector3 pos: The world position to convert
Returns:
-
GridPoint
: A GridPoint containing the column and row indices for the given world position
Converts world x and y coordinates to a grid coordinate point.
Parameters:
- float x: The world x coordinate
- float y: The world y coordinate
Returns:
-
GridPoint
: A GridPoint containing the column and row indices for the given coordinates
public static GroundType GetGroundType(int collumn, int row, GroundType currentGroundType = GroundType.Empty)
Retrieves the ground type of the foreground block at the specified grid coordinates.
Parameters:
- int collumn: The column index in the grid
- int row: The row index in the grid
- GroundType currentGroundType: The default ground type to return if the position is out of bounds or empty
Returns:
-
GroundType
: The ground type of the block at the specified position, or currentGroundType if no block exists
Gets the row index of the highest solid block in the map.
Returns:
-
int
: The row index of the highest solid block
Gets the world position of the bottom-left corner of a block at the specified grid coordinates.
Parameters:
- int collumn: The column index in the grid
- int row: The row index in the grid
Returns:
-
Vector3
: A Vector3 representing the bottom-left corner position of the block (z is always 0)
Initializes the offscreen deactivation system to its default state covering the entire map.
Checks if a block at the specified grid coordinates is invulnerable (made of steel).
Parameters:
- int collumn: The column index in the grid
- int row: The row index in the grid
Returns:
-
bool
: True if the block exists and has a ground type of Steel, false otherwise
Checks if a block at the specified world coordinates is solid. This method converts world coordinates to grid coordinates and checks if a solid block exists at that location.
Parameters:
- float x: The world x coordinate to check
- float y: The world y coordinate to check
Returns:
-
bool
: True if a solid block exists at the specified coordinates, false otherwise
Checks if there are any invulnerable blocks in the column above the specified position.
Parameters:
- float x: The x-coordinate to check
- float y: The y-coordinate to start checking from
Returns:
-
bool
: True if any invulnerable block exists above this position; false otherwise
Checks if the specified world position is within the map boundaries.
Parameters:
- Vector3 pos: The world position to check
Returns:
-
bool
: True if the position is within the map's width and height bounds, false otherwise
Checks if the specified grid coordinates are within the map boundaries.
Parameters:
- int c: The column index to check
- int r: The row index to check
Returns:
-
bool
: True if the coordinates are within the map's width and height bounds, false otherwise
Rotates the foreground block at the specified grid coordinates if it exists.
Parameters:
- int c: The column index in the grid
- int r: The row index in the grid
- int direction: The rotation direction to apply to the block
Updates the active area of the map based on camera position and unit locations, deactivating distant blocks.
Removes a specific block from the background grid if it matches the provided block reference.
Parameters:
- Block block: The block instance to remove (must match the block at the position)
- int collumn: The column index in the grid
- int row: The row index in the grid
Returns:
-
bool
: True if the block matched and was removed, false if a different block exists at that position
Removes a specific block from the foreground grid if it matches the provided block reference or if the position is already empty.
Parameters:
- Block block: The block instance to remove (must match the block at the position)
- int collumn: The column index in the grid
- int row: The row index in the grid
Returns:
-
bool
: True if the block was removed or position was already empty, false if a different block exists at that position
Gets or sets the currently active theme holder that defines all block prefabs, environmental objects, and visual assets for the current level. This property is set based on the map's theme data during map generation and controls which set of prefabs are used for blocks, backgrounds, crates, vehicles, and other theme-specific elements. The theme determines visual appearance and available prefab types for elements like earth blocks, bridges, cages, and special objects. Common themes include jungle, city, desert, forest, hell, america, and burning jungle variations.
Gets a value indicating whether the map has completed its initialization process.
Gets or sets a value indicating whether flex power items have been spawned on the map. Used to ensure flex power items are only spawned once per map.
Gets or sets the current map's data structure. When setting, automatically updates the static Map.Width and Map.Height fields based on the MapData dimensions (or sets them to 0 if MapData is null).
Private backing field for the HasSpawnedFlexPower property. Tracks whether flex power items have been spawned on the current map to prevent duplicate spawning.
Static backing field for the current map's data structure. Stores the MapData object that contains level layout, dimensions, and configuration. Used by the MapData property.
Reference to the America/patriotic theme assets holder. Selected as activeTheme when MapData.theme is LevelTheme.America. Features American-themed decorations and environments.
A randomized counter used to determine barrel variant spawning. Initialized to a random value between 0 and 100 during map setup. Used in calculations to determine whether to spawn propane tanks, oil barrels, or acid barrels based on the map's configured spawn probabilities.
Reference to the burning jungle theme assets holder. Selected as activeTheme when MapData.theme is LevelTheme.BurningJungle. Features fire effects, burned vegetation, and destruction-themed assets.
Counts the number of potential cage spawn locations passed since the last hardcore cage was placed. Defaults to 3. When this exceeds 5, forces a cage placement regardless of random chance.
Reference to the city theme assets holder. Selected as activeTheme when MapData.theme is LevelTheme.City. Contains urban environment prefabs including buildings, streets, and city-specific enemies.
Temporary reference to the current background block being instantiated during map generation. Used for blocks that have both foreground and background components.
Temporary reference to the current foreground block being instantiated during map generation. Used throughout the PlaceBlock method to hold the newly created block before placement.
Tracks the number of helicopters spawned in death match mode. Every even-numbered helicopter spawns at a different X position (minX + 48f).
Reference to the desert theme assets holder. Selected as activeTheme when MapData.theme is LevelTheme.Desert. Contains sand terrain, desert structures, and arid environment assets.
Prevents block persistence for the current level when set to true. Used to disable persistence for specific levels or game modes.
Indicates whether the current level has been completed. Set to false during map initialization and checked by IsFinished().
Transform reference used by parallax background elements to follow camera movement. Passed to ParallaxFollow components via SetFollow() to create depth-based scrolling effects for clouds, fog, and background decorations.
Forces a specific game mode when running in the Unity editor. When set to a value other than GameMode.NotSet, overrides the normal game mode selection process. Supports modes like ExplosionRun, DeathMatch, Race, and SuicideHorde for testing.
When true, forces the map to load the test level specified in testLevelFileName instead of the normal level. Instance field used for editor testing workflows.
When true in the Unity editor, sets this scene as the default campaign scene in LevelSelectionController. Instance field used for development workflow to override the normal campaign scene selection.
Instance-specific override to enable loading time optimizations. When true, forces SetTryReduceLoadingTimes(true) during map initialization.
Reference to the forest theme assets holder. Selected as activeTheme when MapData.theme is LevelTheme.Forest. Includes forest-specific terrain, vegetation, and wildlife assets.
Defines half the size of a standard tile in pixels. Used for center-point calculations and sub-tile positioning operations. Equal to 8 pixels (half of TileSize).
Indicates whether the current map contains alien enemies. Set to true during map loading when any DoodadInfo with DoodadType.Alien is found in MapData.DoodadList. Used by HasThisMapGotAliens() for gameplay logic.
Tracks whether blocks were actually persisted from the previous level. Used to determine if persistent blocks need to be handled during map generation.
Tracks whether a cage has been placed in the current hardcore game session. Used to control cage spawning frequency in hardcore mode.
Reference to the hell theme assets holder. Selected as activeTheme when MapData.theme is LevelTheme.Hell. Contains demonic enemies, lava effects, and underworld environment assets.
Indicates whether the map is currently in editor mode. When true, enables special editor-only functionality and bypasses certain gameplay restrictions (such as hard mode requirements for specific doodads). Also affects terrain interaction behavior and visual feedback.
Reference to the jungle theme assets holder. Selected as activeTheme when MapData.theme is LevelTheme.Jungle. Contains prefabs for blocks, enemies, doodads, and environmental elements specific to jungle levels.
The X coordinate offset of the currently loaded map section. Updated from nextXLoadOffset when loading new map sections. Used to translate between absolute map coordinates and local loaded section coordinates when spawning doodads and other map elements.
The Y coordinate offset of the currently loaded map section. Updated from nextYLoadOffset when loading new map sections. Used to translate between absolute map coordinates and local loaded section coordinates when spawning doodads and other map elements.
The filename of the currently loaded level. Used by the level loading system and editor to track which level file is active. Referenced by various game systems including the level editor and selection controller.
The current level number in a sequence. Protected field used internally for level progression tracking, though its specific usage appears limited in the decompiled code.
The total number of levels in the current sequence. Protected field used internally for level progression management, though its specific usage appears limited in the decompiled code.
Stores the total number of levels available in the game. Currently unused in the decompiled code.
Maximum active row index for block visibility optimization. Used by the offscreen deactivation system to track the highest row that should remain active. Blocks beyond this row are deactivated to improve performance. Initialized to 256 and updated dynamically as the camera moves through the level.
The X coordinate offset for the next map section to be loaded. Used in conjunction with streaming map loading to determine which horizontal section of the map should be loaded next. Reset to 0 during map initialization.
The Y coordinate offset for the next map section to be loaded. Used in conjunction with streaming map loading to determine which vertical section of the map should be loaded next. Always initialized to 0.
The GameObject that holds persistent map elements between level loads. Created as "Persistent Map" when block persistence is first enabled.
Controls whether certain map elements should persist when loading the next level. Used by the block persistence system to maintain state between levels.
Stores the ground type to be placed during map generation operations. Used as a temporary variable during block placement.
Determines whether the map should add a random offset to the starting level number. When true, adds a random value between 0 and randomRange to startLevel during initialization.
Tracks whether the random level offset has been applied during map initialization. Used to ensure the random level adjustment only happens once per session.
Instance-specific random offset value used during map generation. Purpose unclear from available code.
The maximum random offset that can be added to the starting level when randomLevel is enabled. Defaults to 3, meaning the start level can be increased by 0-2.
Indicates whether the offscreen deactivation system has been initialized. Set to true after InitializeDeactivationOffscreen completes setup of active area boundaries. When false, RunDeactivationOffscreen will not execute its optimization logic.
Reference to shared level objects that are used across multiple themes. Accessed via sharedObjectsReference.Asset to instantiate common objects like treasure mooks, special vehicles, alien bosses, and theme-agnostic gameplay elements.
Temporary color storage used during map texture processing. Currently unused in the decompiled code.
Temporary color value used by IsGroundEmpty to check pixel transparency. Cached to avoid repeated color allocations during texture parsing.
Temporary ground type storage used during map generation. Currently unused in the decompiled code.
Filename for a test level that can be loaded in editor mode. Instance field used in conjunction with forceTestLevel to override normal level loading for testing purposes.
Global flag controlling whether the game should use optimizations to reduce loading times. Defaults to true, but disabled in level editor or when asset pooling is disabled.
Counter used for procedural variation in crate spawning. Initialized to a random value (0-144) on map setup and incremented when placing wood blocks. Used with modulo operations to determine when to spawn special crates (ammo, time, airstrike) based on spawn chance calculations.