Ejemplo n.º 1
0
        internal static void Postfix()
        {
            try
            {
                if (PhotonNetworkController.instance?.currentGameType != null && MapLoader._lobbyName != null && PhotonNetworkController.instance.currentGameType.Contains(MapLoader._lobbyName))
                {
                    GorillaTagManager __instance = GorillaTagManager.instance;

                    object currentlyTag;
                    __instance.currentRoom.CustomProperties.TryGetValue("isCurrentlyTag", out currentlyTag);

                    object gameEnded;
                    __instance.currentRoom.CustomProperties.TryGetValue("timeInfectedGameEnded", out gameEnded);

                    if ((bool)currentlyTag)
                    {
                        TriggerRoundEndEvents();
                    }
                    if (RoundEndActions._instance != null && gameEnded != null && (double)gameEnded > lastGameEnd)
                    {
                        //it's proper. do whatever with the Room Settings.
                        lastGameEnd = __instance.timeInfectedGameEnded;
                        TriggerRoundEndEvents();
                    }
                }
            }
            catch (Exception e)
            {
                Logger.LogText("Error when triggering room events:");
                Logger.LogException(e);
            }
        }
Ejemplo n.º 2
0
        internal static bool Prefix(Player __instance, ref Vector3 ___lastPosition, ref Vector3[] ___velocityHistory, ref Vector3 ___lastHeadPosition, ref Vector3 ___lastLeftHandPosition, ref Vector3 ___lastRightHandPosition, ref Vector3 ___currentVelocity, ref Vector3 ___denormalizedVelocityAverage)
        {
            if (_isTeleporting)
            {
                var playerRigidBody = __instance.GetComponent <Rigidbody>();
                if (playerRigidBody != null)
                {
                    Vector3 correctedPosition = _teleportDestination.position - __instance.bodyCollider.transform.position + __instance.transform.position;

                    playerRigidBody.velocity      = Vector3.zero;
                    playerRigidBody.isKinematic   = true;
                    __instance.transform.position = correctedPosition;
                    Debug.Log(__instance.bodyCollider.transform.position);

                    //__instance.transform.rotation = _teleportDestination.rotation;

                    //__instance.transform.rotation = Quaternion.Euler(__instance.transform.rotation.eulerAngles.x, _teleportDestination.rotation.eulerAngles.y,
                    //    __instance.transform.rotation.eulerAngles.z);
                    __instance.Turn(_teleportDestination.rotation.eulerAngles.y - __instance.headCollider.transform.rotation.eulerAngles.y);

                    ___lastPosition    = correctedPosition;
                    ___velocityHistory = new Vector3[__instance.velocityHistorySize];

                    ___lastHeadPosition = __instance.headCollider.transform.position;
                    var leftHandMethod = typeof(Player).GetMethod("CurrentLeftHandPosition",
                                                                  BindingFlags.NonPublic | BindingFlags.Instance);
                    ___lastLeftHandPosition = (Vector3)leftHandMethod.Invoke(__instance, new object[] { });

                    var rightHandMethod = typeof(Player).GetMethod("CurrentRightHandPosition",
                                                                   BindingFlags.NonPublic | BindingFlags.Instance);
                    ___lastRightHandPosition       = (Vector3)rightHandMethod.Invoke(__instance, new object[] { });
                    ___currentVelocity             = Vector3.zero;
                    ___denormalizedVelocityAverage = Vector3.zero;
                    playerRigidBody.isKinematic    = false;
                }
                Logger.LogText("Teleported player to: " + _teleportDestination.position);
                _isTeleporting = false;
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
 public virtual void Trigger(Collider collider)
 {
     // override this method to do stuff
     Logger.LogText("Triggered: " + collider.gameObject.name + "   Filter: " + TouchType);
 }