public static void QuantumObject_SetIsQuantum(QuantumObject __instance)
 {
     if (QSBWorldSync.AllObjectsReady)
     {
         __instance.GetWorldObject <IQSBQuantumObject>().SendMessage(new SetIsQuantumMessage(__instance.IsQuantum()));
     }
 }
        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);
        }
        public static bool QuantumObject_IsLockedByPlayerContact(out bool __result, QuantumObject __instance)
        {
            var playersEntangled = QuantumManager.GetEntangledPlayers(__instance);

            __result = playersEntangled.Count() != 0 && __instance.IsIlluminated();
            return(false);
        }
        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;
            }
        }
        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;
            }
        }
Exemple #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));
        }
Exemple #7
0
    void Start()
    {
        objectRenderer = GetComponent <Renderer>();

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

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