示例#1
0
        private static bool Prefix(Scp106PlayerScript __instance)
        {
            if (!__instance._interactRateLimit.CanExecute(false) || !__instance.GetComponent <FallDamage>().isGrounded)
            {
                return(false);
            }

            var ev = new TeleportingEventArgs(API.Features.Player.Get(__instance.gameObject), __instance.portalPosition);

            Scp106.OnTeleporting(ev);

            __instance.portalPosition = ev.PortalPosition;

            if (!ev.IsAllowed)
            {
                return(false);
            }

            if (__instance.iAm106 && __instance.portalPosition != Vector3.zero && !__instance.goingViaThePortal)
            {
                Timing.RunCoroutine(__instance._DoTeleportAnimation(), Segment.Update);
            }

            return(true);
        }
示例#2
0
        private static bool Prefix(CharacterClassManager __instance)
        {
            var ev = new ContainingEventArgs(API.Features.Player.Get(__instance.gameObject));

            Scp106.OnContaining(ev);

            return(ev.IsAllowed);
        }
示例#3
0
        /// <summary>
        /// Prefix of <see cref="Scp106PlayerScript.CallCmdMakePortal"/>.
        /// </summary>
        /// <param name="__instance">The <see cref="Scp106PlayerScript"/> instance.</param>
        /// <returns>Returns a value indicating whether the original method has to be executed or not.</returns>
        private static bool Prefix(Scp106PlayerScript __instance)
        {
            if (!__instance._interactRateLimit.CanExecute(true) || !__instance.GetComponent <FallDamage>().isGrounded)
            {
                return(false);
            }

            bool rayCastHit = Physics.Raycast(new Ray(__instance.transform.position, -__instance.transform.up), out RaycastHit raycastHit, 10f, __instance.teleportPlacementMask);

            var ev = new CreatingPortalEventArgs(API.Features.Player.Get(__instance.gameObject), raycastHit.point - Vector3.up);

            Scp106.OnCreatingPortal(ev);

            Debug.DrawRay(__instance.transform.position, -__instance.transform.up, Color.red, 10f);

            if (ev.IsAllowed && __instance.iAm106 && !__instance.goingViaThePortal && rayCastHit)
            {
                __instance.SetPortalPosition(ev.Position);
            }

            return(false);
        }