コード例 #1
0
 public static void QuantumObject_SetIsQuantum(QuantumObject __instance)
 {
     if (QSBWorldSync.AllObjectsReady)
     {
         __instance.GetWorldObject <IQSBQuantumObject>().SendMessage(new SetIsQuantumMessage(__instance.IsQuantum()));
     }
 }
コード例 #2
0
        public static IQSBQuantumObject GetObject(QuantumObject unityObject)
        {
            IQSBQuantumObject worldObj = null;

            if (unityObject.GetType() == typeof(SocketedQuantumObject) || unityObject.GetType() == typeof(QuantumShrine))
            {
                worldObj = QSBWorldSync.GetWorldFromUnity <QSBSocketedQuantumObject, SocketedQuantumObject>((SocketedQuantumObject)unityObject);
            }
            else if (unityObject.GetType() == typeof(MultiStateQuantumObject))
            {
                worldObj = QSBWorldSync.GetWorldFromUnity <QSBMultiStateQuantumObject, MultiStateQuantumObject>((MultiStateQuantumObject)unityObject);
            }
            else if (unityObject.GetType() == typeof(QuantumShuffleObject))
            {
                worldObj = QSBWorldSync.GetWorldFromUnity <QSBQuantumShuffleObject, QuantumShuffleObject>((QuantumShuffleObject)unityObject);
            }
            else if (unityObject.GetType() == typeof(QuantumMoon))
            {
                worldObj = QSBWorldSync.GetWorldFromUnity <QSBQuantumMoon, QuantumMoon>((QuantumMoon)unityObject);
            }
            else if (unityObject.GetType() == typeof(EyeProxyQuantumMoon))
            {
                worldObj = QSBWorldSync.GetWorldFromUnity <QSBEyeProxyQuantumMoon, EyeProxyQuantumMoon>((EyeProxyQuantumMoon)unityObject);
            }
            else
            {
                DebugLog.ToConsole($"Warning - couldn't work out type of QuantumObject {unityObject.name}.", MessageType.Warning);
            }
            return(worldObj);
        }
コード例 #3
0
        public static bool QuantumObject_IsLockedByPlayerContact(out bool __result, QuantumObject __instance)
        {
            var playersEntangled = QuantumManager.GetEntangledPlayers(__instance);

            __result = playersEntangled.Count() != 0 && __instance.IsIlluminated();
            return(false);
        }
コード例 #4
0
        private void Update()
        {
            if (!QSBCore.IsInMultiplayer)
            {
                return;
            }

            if (!QSBWorldSync.AllObjectsReady)
            {
                return;
            }

            var controller = Locator.GetPlayerController();

            if (controller == null)
            {
                return;
            }

            var collidingQuantumObject = controller._collidingQuantumObject;

            if (_previousCollidingQuantumObject != collidingQuantumObject)
            {
                var objectId = collidingQuantumObject != null
                                        ? collidingQuantumObject.GetWorldObject <IQSBQuantumObject>().ObjectId
                                        : -1;

                new PlayerEntangledMessage(objectId).Send();
                _previousCollidingQuantumObject = collidingQuantumObject;
            }
        }
コード例 #5
0
        private void Update()
        {
            if (!QSBCore.IsInMultiplayer)
            {
                return;
            }
            var controller = Locator.GetPlayerController();

            if (controller == null)
            {
                return;
            }
            var collidingQuantumObject = controller.GetValue <QuantumObject>("_collidingQuantumObject");

            if (_previousCollidingQuantumObject != collidingQuantumObject)
            {
                var objectIndex = (collidingQuantumObject != null)
                                        ? QSBWorldSync.GetIdFromTypeSubset(QuantumManager.GetObject(collidingQuantumObject))
                                        : -1;

                QSBEventManager.FireEvent(
                    EventNames.QSBPlayerEntangle,
                    objectIndex);
                _previousCollidingQuantumObject = collidingQuantumObject;
            }
        }
コード例 #6
0
        public static IEnumerable <PlayerInfo> GetEntangledPlayers(QuantumObject obj)
        {
            if (!QSBWorldSync.AllObjectsReady)
            {
                return(Enumerable.Empty <PlayerInfo>());
            }

            var worldObj = obj.GetWorldObject <IQSBQuantumObject>();

            return(QSBPlayerManager.PlayerList.Where(x => x.EntangledObject == worldObj));
        }
コード例 #7
0
    void Start()
    {
        objectRenderer = GetComponent <Renderer>();

        foreach (Transform child in transform.parent)
        {
            if (child.CompareTag("QuantumObject"))
            {
                quantumObjectGO = child.gameObject;
                quantumObject   = quantumObjectGO.GetComponent <QuantumObject>();
            }
        }
    }
コード例 #8
0
        public static IEnumerable <PlayerInfo> GetEntangledPlayers(QuantumObject obj)
        {
            var worldObj = GetObject(obj);

            return(QSBPlayerManager.PlayerList.Where(x => x.EntangledObject == worldObj));
        }