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 onOccupantArrived; [SerializeField]private UnityEvent onOccupantChanged; public event Action OnOccupantArrived { add => onOccupantArrived.AddListener(value.Invoke); remove => onOccupantArrived.RemoveListener(value.Invoke); } public event Action OnOccupantChanged { add => onOccupantChanged.AddListener(value.Invoke); remove => onOccupantChanged.RemoveListener(value.Invoke); } public float CameraDistance => cameraDistance; #endif } }