This commit is contained in:
CortexCore
2025-03-03 18:43:55 +08:00
parent 54f40090c9
commit 4402ae533b
32 changed files with 337 additions and 73 deletions

View File

@@ -3,9 +3,7 @@ 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
@@ -14,43 +12,13 @@ namespace Net.Project.B.WorldNode
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 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
}