Compare commits

..

3 Commits

5 changed files with 21 additions and 8 deletions

2
.gitignore vendored
View File

@ -4,6 +4,8 @@
## ##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
project/Terkoiz.MapZoneHighlighter/key.snk
# User-specific files # User-specific files
*.rsuser *.rsuser
*.suo *.suo

View File

@ -1,7 +1,7 @@
{ {
"name": "ZoneHighlighter", "name": "ZoneHighlighter",
"author": "Terkoiz", "author": "Terkoiz",
"version": "1.0.0", "version": "1.0.1",
"license": "NCSA Open Source", "license": "NCSA Open Source",
"dependencies": {} "dependencies": {}
} }

View File

@ -52,6 +52,11 @@ namespace Terkoiz.MapZoneHighlighter.BoundedBoxes
private void OnGUI() private void OnGUI()
{ {
if (Camera.main == null)
{
return;
}
ScreenPosition = UIDrawingUtil.WorldPointToScreenPoint(transform.position); ScreenPosition = UIDrawingUtil.WorldPointToScreenPoint(transform.position);
IsOnScreen = UIDrawingUtil.IsScreenPointVisible(ScreenPosition); IsOnScreen = UIDrawingUtil.IsScreenPointVisible(ScreenPosition);
DistanceToCamera = Vector3.Distance(Camera.main.transform.position, transform.position); DistanceToCamera = Vector3.Distance(Camera.main.transform.position, transform.position);

View File

@ -30,13 +30,10 @@ namespace Terkoiz.MapZoneHighlighter
return; return;
} }
if (_mainCamera != null) if (_mainCamera != null && _mainCamera.gameObject.GetComponent<ColliderBoundsRenderer>() == null)
{
if (_mainCamera.gameObject.GetComponent<ColliderBoundsRenderer>() == null)
{ {
_mainCamera.gameObject.AddComponent<ColliderBoundsRenderer>(); _mainCamera.gameObject.AddComponent<ColliderBoundsRenderer>();
} }
}
_boundsControllers = new List<ColliderBoundsController>(); _boundsControllers = new List<ColliderBoundsController>();
foreach (var mapZone in FindObjectsOfType<EFT.Interactive.TriggerWithId>().Select(x => x.gameObject).ToList()) foreach (var mapZone in FindObjectsOfType<EFT.Interactive.TriggerWithId>().Select(x => x.gameObject).ToList())
@ -44,8 +41,9 @@ namespace Terkoiz.MapZoneHighlighter
if (mapZone.GetComponent<ColliderBoundsController>() == null) if (mapZone.GetComponent<ColliderBoundsController>() == null)
{ {
mapZone.AddComponent<ColliderBoundsController>(); mapZone.AddComponent<ColliderBoundsController>();
_boundsControllers.Add(mapZone.GetComponent<ColliderBoundsController>());
} }
_boundsControllers.Add(mapZone.GetComponent<ColliderBoundsController>());
} }
} }

View File

@ -30,6 +30,12 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Assembly-CSharp"> <Reference Include="Assembly-CSharp">
<HintPath>..\Shared\References\Assembly-CSharp.dll</HintPath> <HintPath>..\Shared\References\Assembly-CSharp.dll</HintPath>
@ -81,6 +87,8 @@
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<None Include="key.snk" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>