This commit is contained in:
CortexCore
2025-02-24 23:02:49 +08:00
parent 9775bdd099
commit b07ae4fea7
82 changed files with 1021 additions and 386 deletions

View File

@@ -4,7 +4,8 @@
"references": [
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
"GUID:d750d221812bb1d48baff92e6ef73e28",
"GUID:49b49c76ee64f6b41bf28ef951cb0e50"
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
"GUID:f51ebe6a0ceec4240a699833d6309b23"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
using BITKit.WorldNode;
namespace Net.Project.B.WorldNode
{
[Serializable]
public struct UnityBuyStationNode : IWorldNode
{
public int Id { get; set; }
public object WorldObject { get; set; }
}
}

View File

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

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections;
using System.Collections.Generic;
using BITKit.WorldNode;
#if UNITY_5_3_OR_NEWER
using UnityEngine;
#endif
namespace Net.Project.B.WorldNode
{
[Serializable]
public class UnityElevatorNode : IWorldNode
{
public int Id { get; set; }
public object WorldObject { get; set; }
#if UNITY_5_3_OR_NEWER
[SerializeField] private GameObject[] floors;
[SerializeField] private GameObject[] floorButtons;
[SerializeField] private Rigidbody platform;
public Rigidbody Platform => platform;
public readonly Dictionary<int, (GameObject floor, GameObject button)> Floors = new();
public void Initialize()
{
for (var index = 0; index < floors.Length; index++)
{
var floor = floors[index];
}
}
#endif
}
}

View File

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

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections;
using System.Collections.Generic;
using BITKit;
using BITKit.WorldNode;
using UnityEngine;
namespace Net.Project.B.WorldNode
{
[Serializable]
public struct UnityEntityFactoryNode : IWorldNode
{
public int Id { get; set; }
public object WorldObject { get; set; }
public string address;
public string Address => address;
}
}

View File

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

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using BITKit;
using UnityEngine;
namespace Net.Project.B.WorldNode
{
public class UnityEnvironmentController : MonoBehaviour
{
[SerializeField] private GameObject[] staticGameObjects;
private void OnEnable()
{
if(Application.isEditor)return;
foreach (var staticGameObject in staticGameObjects)
{
staticGameObject.isStatic = true;
}
Debug.Log($"已设置{staticGameObjects.Length}个物体为isStatic");
Destroy(this);
}
private void Start()
{
foreach (var staticGameObject in staticGameObjects)
{
staticGameObject.isStatic = true;
}
Debug.Log($"已设置{staticGameObjects.Length}个物体为isStatic");
}
[ContextMenu("Build Index")]
public void Rebuild()
{
staticGameObjects = GetComponentsInChildren<Transform>().Where(x=>x.gameObject.isStatic).Select(x=>x.gameObject).ToArray();
Debug.Log($"已获取到{staticGameObjects.Length}个物体");
}
}
}

View File

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

View File

@@ -17,6 +17,11 @@ namespace Net.Project.B.WorldNode
[SerializeReference, SubclassSelector]
#endif
private IReference itemPath;
public string ItemPath => itemPath.Value;
public string ItemPath
{
get => itemPath.Value;
set => itemPath = new Reference(value);
}
}
}

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections;
using System.Collections.Generic;
using BITKit.WorldNode;
#if UNITY_5_3_OR_NEWER
using BITKit.Entities;
using UnityEngine;
using UnityEngine.Events;
#endif
namespace Net.Project.B.WorldNode
{
[Serializable]
public class UnitySeatNode :IWorldNode
{
public int Id { get; set; }
public object WorldObject { get; set; }
#if UNITY_5_3_OR_NEWER
[SerializeField]private float cameraDistance= 2;
public Rigidbody Rigidbody;
public Transform SeatObject;
public Transform CameraObject;
public Transform ExitObject;
public IEntity Occupant
{
get => _occupant;
set
{
if(Equals(_occupant,value))return;
_occupant = value;
onOccupantChanged.Invoke(_occupant);
onOccupantArrived.Invoke(_occupant!=null);
}
}
private IEntity _occupant;
[SerializeField]private UnityEvent<bool> onOccupantArrived;
[SerializeField]private UnityEvent<IEntity> onOccupantChanged;
public event Action<bool> OnOccupantArrived
{
add => onOccupantArrived.AddListener(value.Invoke);
remove => onOccupantArrived.RemoveListener(value.Invoke);
}
public event Action<IEntity> OnOccupantChanged
{
add => onOccupantChanged.AddListener(value.Invoke);
remove => onOccupantChanged.RemoveListener(value.Invoke);
}
public float CameraDistance => cameraDistance;
#endif
}
}

View File

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