Example #1
0
    /// <summary>
    /// Teleports the player to a location specified by Portal Buddy.
    /// </summary>
    /// <param name="i"></param>
    void Teleport(int i)
    {
        overThreshold = glitchyEffectScript.OverThreshold;

        if (overThreshold)
        {
            player.transform.position         = portalBuddy.transform.position;
            glitchyEffectScript.OverThreshold = false;
            if (!hasPlayedTeleportSound)
            {
                portalAudio.clip   = teleportSound;
                portalAudio.volume = 1;
                portalAudio.loop   = false;
                portalAudio.Play();
                hasPlayedTeleportSound = true;
            }
            if (PlayerTeleported != null)
            {
                PlayerTeleported.Invoke();
            }

            if (RotatePlayerOnArrival)
            {
                playerController.mouseLook.RotatePlayerTo(RotateXAxis, RotateYAxis);
            }
        }
    }
Example #2
0
        public void Teleport(Vector3 destination)
        {
            PlayerTeleported playerTeleported = new PlayerTeleported(Name, Position, destination);

            SendPacket(playerTeleported);
            Position           = playerTeleported.DestinationTo;
            LastStoredPosition = playerTeleported.DestinationFrom;
        }
Example #3
0
        public void Teleport(NitroxVector3 destination, Optional <NitroxId> subRootID)
        {
            PlayerTeleported playerTeleported = new PlayerTeleported(Name, Position, destination, subRootID);

            Position            = playerTeleported.DestinationTo;
            LastStoredPosition  = playerTeleported.DestinationFrom;
            LastStoredSubRootID = subRootID;
            SendPacket(playerTeleported);
        }
Example #4
0
 private static void onPlayerCreated(Player player)
 {
     if (player.channel.isOwner)
     {
         Player   player2            = Player.player;
         Delegate onPlayerTeleported = player2.onPlayerTeleported;
         if (LevelObjects.< > f__mg$cache0 == null)
         {
             LevelObjects.< > f__mg$cache0 = new PlayerTeleported(LevelObjects.onPlayerTeleported);
         }
         player2.onPlayerTeleported = (PlayerTeleported)Delegate.Combine(onPlayerTeleported, LevelObjects.< > f__mg$cache0);
         PlayerMovement movement        = Player.player.movement;
         Delegate       onRegionUpdated = movement.onRegionUpdated;
         if (LevelObjects.< > f__mg$cache1 == null)
         {
             LevelObjects.< > f__mg$cache1 = new PlayerRegionUpdated(LevelObjects.onRegionUpdated);
         }
         movement.onRegionUpdated = (PlayerRegionUpdated)Delegate.Combine(onRegionUpdated, LevelObjects.< > f__mg$cache1);
     }
 }
Example #5
0
        public void HandleTeleported(NetworkMessage msg)
        {
            MsgTeleport tp = msg as MsgTeleport;

            TeleportEventArgs args = new Game.Client.TeleportEventArgs();

            args.PortingPlayer = PlayerList.GetPlayerByID(tp.PlayerID);
            if (args.PortingPlayer == null)
            {
                return;
            }

            args.From = Map.GetTeleporterByID(tp.FromTPID);
            args.To   = Map.GetTeleporterByID(tp.ToTPID);

            args.PortingPlayer.SetTeleport(Clock.StepTime, args.From, args.To);

            if (PlayerTeleported != null)
            {
                PlayerTeleported.Invoke(this, args);
            }
        }
Example #6
0
 public virtual void Teleport(Vector3 position)
 {
     Debug.Log($"Teleport player to {position}");
     PlayerTeleported?.Invoke(position);
 }