protected override void OnCreate() { entityManager = World.Active.EntityManager; playerSystem = World.Active.GetOrCreateSystem <PlayerEntitySystem>(); UpdateCurrentCellIndex(); previousCellIndex = new int2(100); sectorArchetype = entityManager.CreateArchetype( ComponentType.ReadWrite <LocalToWorld>(), ComponentType.ReadWrite <Translation>(), ComponentType.ReadWrite <RenderMeshProxy>() ); float3 matrixRoot = new float3(currentCellIndex.x, 0, currentCellIndex.y); sectorMatrix = new Matrix <Entity>(5, Allocator.Persistent, matrixRoot); cellMatrix = new Matrix <CellMatrixItem>(5, Allocator.Persistent, matrixRoot); EntityQueryDesc sectorSortQueryDesc = new EntityQueryDesc { All = new ComponentType[] { typeof(AdjacentCell), typeof(SectorCell), typeof(WorleyNoise.PointData) }, None = new ComponentType[] { typeof(Tags.TerrainEntity) } }; sectorSortQuery = GetEntityQuery(sectorSortQueryDesc); worley = TerrainSettings.CellWorley(); topologyUtil = new TopologyUtil().Construct(); }
protected override void OnCreate() { entityManager = World.Active.EntityManager; playerSystem = World.Active.GetOrCreateSystem <PlayerEntitySystem>(); cellSystem = World.Active.GetOrCreateSystem <CellSystem>(); monoBehaviour = GameObject.FindObjectOfType <DebugMonoBehaviour>(); debugWorley = TerrainSettings.CellWorley(); topologyUtil = new TopologyUtil().Construct(); worleyCurrentMarker = CreateCube(float3.zero, new float4(0, 1, 0, 1)); worleyAdjacentMarker = CreateCube(float3.zero, new float4(0, 0, 1, 1)); }