public void OnTriggerEnter(Collider coll) { GameObject go = coll.gameObject; if (go.GetComponent <BasePlayer>()) { PortalPlayerHandler handler = go.GetComponent <PortalPlayerHandler>(); if (handler) { if (point.PointType == PortalPointType.Exit && info.OneWay) { return; } if (handler.player.IsSleeping()) { return; } if (!info.CanUse(handler.player)) { Instance.PrintToChat(handler.player, Instance.GetMsg("No Permission Portal")); return; } Instance.PrintToChat(handler.player, Instance.GetMsg("Teleporting").Replace("{time}", info.TeleportationTime.ToString())); handler.timer = Instance.timer.Once(info.TeleportationTime, () => handler.Teleport(this)); } } }
public void OnTriggerEnter(Collider coll) { if (!Instance.initialized) { return; } isEntered = true; GameObject go = coll.gameObject; var player = coll.ToBaseEntity() as BasePlayer; if (player != null) { PortalPlayerHandler handler = player?.gameObject?.GetComponent <PortalPlayerHandler>(); if (handler == null) { handler = player.gameObject.AddComponent <PortalPlayerHandler>(); } if (player != null && handler != null) { if (point.PointType == PortalPointType.Secondary && info.OneWay) { return; } if (info.Secondary.Location.Vector3 == Vector3.zero || info.Primary.Location.Vector3 == Vector3.zero) { if (player.IPlayer != null) { Instance.Message(player.IPlayer, "PortalIncomplete", info.ID); } return; } if (handler.player.IsSleeping()) { return; } if (!info.CanUse(handler.player)) { if (player.IPlayer != null) { Instance.Message(player.IPlayer, "NoPermissionPortal"); } return; } if (Instance.configData.playEffects) { EnterEffects(player, info.TeleportationTime); } if (player.IPlayer != null) { Instance.Message(player.IPlayer, "Teleporting", info.ID, info.TeleportationTime.ToString()); } handler.timer = Instance.timer.Once(info.TeleportationTime, () => handler.Teleport(this)); } } }