1
This commit is contained in:
38
Assets/Artists/Scripts/WorldOptimizeService.cs
Normal file
38
Assets/Artists/Scripts/WorldOptimizeService.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using MeshCombineStudio;
|
||||
using NGS.AdvancedCullingSystem.Dynamic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Net.Like.Xue.Tokyo
|
||||
{
|
||||
public class WorldOptimizeService : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Transform[] sources;
|
||||
[SerializeField] private Camera minimapCamera;
|
||||
private void Awake()
|
||||
{
|
||||
GetComponent<MeshCombiner>().onCombiningReady += OnReady;
|
||||
}
|
||||
private void OnReady(MeshCombiner meshcombiner)
|
||||
{
|
||||
minimapCamera.Render();
|
||||
minimapCamera.enabled = false;
|
||||
|
||||
|
||||
var controller = gameObject.AddComponent<DC_Controller>();
|
||||
controller.AddCamera(Camera.main,3000);
|
||||
foreach (var x in sources)
|
||||
{
|
||||
foreach (var renderer in x.GetComponentsInChildren<MeshRenderer>())
|
||||
{
|
||||
if (renderer.gameObject.activeInHierarchy)
|
||||
controller.AddObjectForCulling(renderer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user