@@ -28,7 +28,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly WPos CenterPosition;
|
public readonly WPos CenterPosition;
|
||||||
public readonly Rectangle Bounds;
|
public readonly Rectangle Bounds;
|
||||||
readonly Actor actor;
|
readonly Actor actor;
|
||||||
readonly Func<MPos, bool> isVisibleTest;
|
readonly Shroud shroud;
|
||||||
|
|
||||||
public Player Owner;
|
public Player Owner;
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ namespace OpenRA.Traits
|
|||||||
public FrozenActor(Actor self, MPos[] footprint, Shroud shroud)
|
public FrozenActor(Actor self, MPos[] footprint, Shroud shroud)
|
||||||
{
|
{
|
||||||
actor = self;
|
actor = self;
|
||||||
isVisibleTest = shroud.IsVisibleTest;
|
this.shroud = shroud;
|
||||||
|
|
||||||
// Consider all cells inside the map area (ignoring the current map bounds)
|
// Consider all cells inside the map area (ignoring the current map bounds)
|
||||||
Footprint = footprint
|
Footprint = footprint
|
||||||
@@ -79,6 +79,7 @@ namespace OpenRA.Traits
|
|||||||
void UpdateVisibility()
|
void UpdateVisibility()
|
||||||
{
|
{
|
||||||
var wasVisible = Visible;
|
var wasVisible = Visible;
|
||||||
|
var isVisibleTest = shroud.IsVisibleTest;
|
||||||
|
|
||||||
// We are doing the following LINQ manually for performance since this is a hot path.
|
// We are doing the following LINQ manually for performance since this is a hot path.
|
||||||
// Visible = !Footprint.Any(isVisibleTest);
|
// Visible = !Footprint.Any(isVisibleTest);
|
||||||
|
|||||||
@@ -325,6 +325,11 @@ namespace OpenRA.Traits
|
|||||||
return explored[uv] && (generatedShroudCount[uv] == 0 || visibleCount[uv] > 0);
|
return explored[uv] && (generatedShroudCount[uv] == 0 || visibleCount[uv] > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a fast exploration lookup that skips the usual validation.
|
||||||
|
/// The return value should not be cached across ticks, and should not
|
||||||
|
/// be called with cells outside the map bounds.
|
||||||
|
/// </summary>
|
||||||
public Func<MPos, bool> IsExploredTest
|
public Func<MPos, bool> IsExploredTest
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -371,6 +376,11 @@ namespace OpenRA.Traits
|
|||||||
return visibleCount[uv] > 0;
|
return visibleCount[uv] > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a fast visibility lookup that skips the usual validation.
|
||||||
|
/// The return value should not be cached across ticks, and should not
|
||||||
|
/// be called with cells outside the map bounds.
|
||||||
|
/// </summary>
|
||||||
public Func<MPos, bool> IsVisibleTest
|
public Func<MPos, bool> IsVisibleTest
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
Reference in New Issue
Block a user