mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-22 12:03:04 +00:00
if specified, disable objects out of given radius
This commit is contained in:
parent
301db837b8
commit
e6ce4c16c9
1 changed files with 7 additions and 4 deletions
|
@ -83,8 +83,11 @@ namespace SanAndreasUnity.Editor
|
|||
Cell.Singleton.Water.CreateCollisionObjects = true;
|
||||
Cell.Singleton.Water.Initialize(Cell.Singleton.WorldSize * Vector2.one);
|
||||
|
||||
// TODO: just some testing, remove ...
|
||||
DisableObjects();
|
||||
yield return null;
|
||||
|
||||
// if specified, disable objects out of given radius
|
||||
if (CmdLineUtils.TryGetUshortArgument("navMeshGenerationObjectsIncludeRadius", out ushort objectsRadius))
|
||||
DisableObjectsOutOfRadius(objectsRadius);
|
||||
|
||||
// now fire up NavMeshGenerator
|
||||
|
||||
|
@ -120,11 +123,11 @@ namespace SanAndreasUnity.Editor
|
|||
EditorApplication.Exit(1);
|
||||
}
|
||||
|
||||
static void DisableObjects()
|
||||
static void DisableObjectsOutOfRadius(ushort radius)
|
||||
{
|
||||
Cell.Singleton.gameObject.GetFirstLevelChildrenSingleComponent<MapObject>().ForEach(mapObject =>
|
||||
{
|
||||
if (mapObject.transform.Distance(Vector3.zero) > 400)
|
||||
if (mapObject.transform.Distance(Vector3.zero) > radius)
|
||||
mapObject.gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue