This commit is contained in:
CortexCore
2024-03-31 23:31:00 +08:00
parent e179d2eb53
commit b7b89ee71a
641 changed files with 31286 additions and 22134 deletions

View File

@@ -4,7 +4,8 @@
"references": [
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
"GUID:9c184a1e5cc20654384071dfebc106ed",
"GUID:bdb069e155d2f944cb1bf28602b6d4c1"
"GUID:bdb069e155d2f944cb1bf28602b6d4c1",
"GUID:1193c2664d97cc049a6e4c486c6bce71"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -1,41 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Pinwheel.Griffin;
using UnityEngine;
namespace BITKit.WorldChunk
{
public class PolarisTerrainChunk : WorldChunk
{
private GStylizedTerrain terrain;
private Vector2 _position;
private void Start()
{
terrain = GetComponent<GStylizedTerrain>();
var pos = terrain.transform.position;
_position = new Vector2(pos.x, pos.z);
Add(this);
destroyCancellationToken.Register(() => { Remove(this); });
}
public override Rect GetRect()
{
return new Rect(
_position,
new Vector2()
{
x = terrain.TerrainData.Geometry.Width,
y = terrain.TerrainData.Geometry.Length,
}
);
}
public override void SetActive(bool active)
{
terrain.gameObject.SetActive(active);
}
}
}

View File

@@ -1,20 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Pinwheel.Griffin;
using UnityEngine;
namespace BITKit.WorldChunk
{
public class PolarisTerrainChunkManager : MonoBehaviour
{
private void Start()
{
foreach (var x in GetComponentsInChildren<GStylizedTerrain>())
{
x.gameObject.AddComponent<PolarisTerrainChunk>();
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 76b35e3b11d92e34b85b4e1551c250a6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,59 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Pinwheel.Griffin;
using Quadtree;
using UnityEngine;
namespace BITKit.OpenWorld
{
public class PolarisTerrainChunkService : WorldChunkService<PolarisTerrainChunkService>
{
private class ChunkData:IWorldChunkObject
{
public Collider Collider { get; set; }
public Bounds GetBounds() => Bounds;
public Bounds Bounds { get; set; }
public Node<IWorldChunkObject> ParentNode { get; set; }
public void QuadTree_Root_Initialized(IQuadtreeRoot<IWorldChunkObject, Node<IWorldChunkObject>> root)
{
}
public int Id { get; set; }
public int Lod
{
get => lod;
set
{
Collider.enabled = value is 0;
lod = value;
}
}
private int lod=-1;
}
[SerializeField] private GStylizedTerrain[] terrains;
protected override void Start()
{
base.Start();
var reporter = new StringBuilder();
foreach (var terrain in terrains)
{
reporter.AppendLine($"正在注册地形 {terrain.name},尺寸:{terrain.TerrainData.Geometry.Width}x{terrain.TerrainData.Geometry.Length}");
foreach (var chunk in terrain.GetChunks())
{
var data =new ChunkData()
{
Collider = chunk.MeshColliderComponent,
Bounds = chunk.MeshColliderComponent.bounds
};
data.Collider.enabled = false;
Register(data);
reporter.AppendLine($"注册地形碰撞体 {chunk.name},尺寸:{data.Bounds.size}");
}
}
Debug.Log(reporter);
OnTick(Time.deltaTime);
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b40a268bf2a87494ab84df06a292ebfd
guid: 196335990c4123f46b440b909e1536d3
MonoImporter:
externalObjects: {}
serializedVersion: 2