Processes the level data with shadowcasting algorithm, and updates the FogField object accordingly.
324 {
325
327
328
329 quadrantIterator.originPoint = revealerPoint;
330
331
332 foreach (int cardinal in System.Enum.GetValues(typeof(QuadrantIterator.ECardinal)))
333 {
334 quadrantIterator.cardinal = (QuadrantIterator.ECardinal)cardinal;
335
336
337 Queue<ColumnIterator> columnIterators = new Queue<ColumnIterator>();
338
339
340 columnIterators.Enqueue(new ColumnIterator(1, sightRange, -1, 1));
341
342 while (columnIterators.Count > 0)
343 {
344 ColumnIterator columnIterator = columnIterators.Dequeue();
345
346
347 List<Vector2Int> quadrantPoints = columnIterator.GetTiles();
348
349
350 Vector2Int lastQuadrantPoint = new Vector2Int();
351
352
353 bool firstStepFlag = true;
354
355 foreach (Vector2Int quadrantPoint in quadrantPoints)
356 {
357 if (IsTileObstacle(quadrantPoint) == true || IsTileVisible(columnIterator, quadrantPoint))
358 {
359 RevealTileIteratively(quadrantPoint, sightRange);
360 }
361
362 if (firstStepFlag == false)
363 {
364 if (IsTileObstacle(lastQuadrantPoint) == true && IsTileEmpty(quadrantPoint) == true)
365 {
366 columnIterator.startSlope = GetQuadrantSlope(quadrantPoint);
367 }
368
369 if (IsTileEmpty(lastQuadrantPoint) == true && IsTileObstacle(quadrantPoint) == true)
370 {
371 if (columnIterator.IsProceedable() == false)
372 {
373 continue;
374 }
375
376 ColumnIterator nextColumnIterator = new ColumnIterator(
377 columnIterator.depth,
378 sightRange,
379 columnIterator.startSlope,
380 GetQuadrantSlope(quadrantPoint));
381
382 nextColumnIterator.ProceedIfPossible();
383
384 columnIterators.Enqueue(nextColumnIterator);
385 }
386 }
387
388 lastQuadrantPoint = quadrantPoint;
389
390 firstStepFlag = false;
391 }
392
393 if (IsTileEmpty(lastQuadrantPoint) == true && columnIterator.IsProceedable() == true)
394 {
395 columnIterator.ProceedIfPossible();
396
397 columnIterators.Enqueue(columnIterator);
398 }
399 }
400 }
401 }
Vector3 GetWorldVector(Vector2Int worldCoordinates)
Converts level coordinates into world coordinates.
Definition: csFogWar.cs:716
Vector2Int WorldToLevel(Vector3 worldCoordinates)
Converts unit (divided by unitScale, then rounded) world coordinates to level coordinates.
Definition: csFogWar.cs:704