2023-12-22 22:51:17 +00:00
using System.Collections ;
using GameNetcodeStuff ;
using Unity.Netcode ;
using UnityEngine ;
2023-12-23 00:30:32 +00:00
using UnityEngine.SceneManagement ;
2023-12-22 22:51:17 +00:00
public class ShipTeleporter : NetworkBehaviour
{
2023-12-23 00:30:32 +00:00
public bool isInverseTeleporter ;
public Transform teleportOutPosition ;
[Space(5f)]
2023-12-22 22:51:17 +00:00
public Transform teleporterPosition ;
public Animator teleporterAnimator ;
public Animator buttonAnimator ;
public AudioSource buttonAudio ;
public AudioSource shipTeleporterAudio ;
public AudioClip buttonPressSFX ;
public AudioClip teleporterSpinSFX ;
public AudioClip teleporterBeamUpSFX ;
public AudioClip beamUpPlayerBodySFX ;
private Coroutine beamUpPlayerCoroutine ;
2023-12-23 00:30:32 +00:00
public int teleporterId = 1 ;
private int [ ] playersBeingTeleported ;
private float cooldownTime ;
public float cooldownAmount ;
public InteractTrigger buttonTrigger ;
private void Awake ( )
{
playersBeingTeleported = new int [ 4 ] { - 1 , - 1 , - 1 , - 1 } ;
buttonTrigger . interactable = false ;
cooldownTime = cooldownAmount ;
}
private void Update ( )
{
if ( ! buttonTrigger . interactable )
{
if ( cooldownTime < = 0f )
{
buttonTrigger . interactable = true ;
return ;
}
buttonTrigger . disabledHoverTip = $"[Cooldown: {(int)cooldownTime} sec.]" ;
cooldownTime - = Time . deltaTime ;
}
}
private void OnDisable ( )
{
for ( int i = 0 ; i < playersBeingTeleported . Length ; i + + )
{
if ( playersBeingTeleported [ i ] = = teleporterId )
{
StartOfRound . Instance . allPlayerScripts [ playersBeingTeleported [ i ] ] . shipTeleporterId = - 1 ;
}
}
}
2023-12-22 22:51:17 +00:00
public void PressTeleportButtonOnLocalClient ( )
{
2023-12-23 00:30:32 +00:00
if ( ! isInverseTeleporter | | ( ! StartOfRound . Instance . inShipPhase & & SceneManager . sceneCount > 1 ) )
{
PressTeleportButtonServerRpc ( ) ;
}
2023-12-22 22:51:17 +00:00
}
[ServerRpc(RequireOwnership = false)]
public void PressTeleportButtonServerRpc ( )
{
NetworkManager networkManager = base . NetworkManager ;
if ( ( object ) networkManager ! = null & & networkManager . IsListening )
{
if ( __rpc_exec_stage ! = __RpcExecStage . Server & & ( networkManager . IsClient | | networkManager . IsHost ) )
{
ServerRpcParams serverRpcParams = default ( ServerRpcParams ) ;
FastBufferWriter bufferWriter = __beginSendServerRpc ( 389447712 u , serverRpcParams , RpcDelivery . Reliable ) ;
__endSendServerRpc ( ref bufferWriter , 389447712 u , serverRpcParams , RpcDelivery . Reliable ) ;
}
if ( __rpc_exec_stage = = __RpcExecStage . Server & & ( networkManager . IsServer | | networkManager . IsHost ) )
{
PressTeleportButtonClientRpc ( ) ;
}
}
}
[ClientRpc]
public void PressTeleportButtonClientRpc ( )
{
NetworkManager networkManager = base . NetworkManager ;
if ( ( object ) networkManager = = null | | ! networkManager . IsListening )
{
return ;
}
if ( __rpc_exec_stage ! = __RpcExecStage . Client & & ( networkManager . IsServer | | networkManager . IsHost ) )
{
ClientRpcParams clientRpcParams = default ( ClientRpcParams ) ;
FastBufferWriter bufferWriter = __beginSendClientRpc ( 2773756087 u , clientRpcParams , RpcDelivery . Reliable ) ;
__endSendClientRpc ( ref bufferWriter , 2773756087 u , clientRpcParams , RpcDelivery . Reliable ) ;
}
2023-12-23 00:30:32 +00:00
if ( __rpc_exec_stage ! = __RpcExecStage . Client | | ( ! networkManager . IsClient & & ! networkManager . IsHost ) )
{
return ;
}
PressButtonEffects ( ) ;
if ( beamUpPlayerCoroutine ! = null )
{
StopCoroutine ( beamUpPlayerCoroutine ) ;
}
cooldownTime = cooldownAmount ;
buttonTrigger . interactable = false ;
if ( isInverseTeleporter )
2023-12-22 22:51:17 +00:00
{
2023-12-23 00:30:32 +00:00
if ( CanUseInverseTeleporter ( ) )
2023-12-22 22:51:17 +00:00
{
2023-12-23 00:30:32 +00:00
beamUpPlayerCoroutine = StartCoroutine ( beamOutPlayer ( ) ) ;
2023-12-22 22:51:17 +00:00
}
2023-12-23 00:30:32 +00:00
}
else
{
2023-12-22 22:51:17 +00:00
beamUpPlayerCoroutine = StartCoroutine ( beamUpPlayer ( ) ) ;
}
}
private void PressButtonEffects ( )
{
buttonAnimator . SetTrigger ( "press" ) ;
buttonAnimator . SetBool ( "GlassOpen" , value : false ) ;
buttonAnimator . GetComponentInChildren < AnimatedObjectTrigger > ( ) . boolValue = false ;
2023-12-23 00:30:32 +00:00
if ( isInverseTeleporter )
{
if ( CanUseInverseTeleporter ( ) )
{
teleporterAnimator . SetTrigger ( "useInverseTeleporter" ) ;
}
else
{
Debug . Log ( $"Using inverse teleporter was not allowed; {StartOfRound.Instance.inShipPhase}; {StartOfRound.Instance.currentLevel.PlanetName}" ) ;
}
}
else
{
teleporterAnimator . SetTrigger ( "useTeleporter" ) ;
}
2023-12-22 22:51:17 +00:00
buttonAudio . PlayOneShot ( buttonPressSFX ) ;
WalkieTalkie . TransmitOneShotAudio ( buttonAudio , buttonPressSFX ) ;
}
2023-12-23 00:30:32 +00:00
private bool CanUseInverseTeleporter ( )
{
if ( ! StartOfRound . Instance . inShipPhase )
{
return StartOfRound . Instance . currentLevel . spawnEnemiesAndScrap ;
}
return false ;
}
private IEnumerator beamOutPlayer ( )
{
if ( GameNetworkManager . Instance . localPlayerController = = null )
{
yield break ;
}
if ( StartOfRound . Instance . inShipPhase )
{
Debug . Log ( "Attempted using teleporter while in ship phase" ) ;
yield break ;
}
shipTeleporterAudio . PlayOneShot ( teleporterSpinSFX ) ;
for ( int b = 0 ; b < 5 ; b + + )
{
for ( int i = 0 ; i < StartOfRound . Instance . allPlayerObjects . Length ; i + + )
{
PlayerControllerB playerControllerB = StartOfRound . Instance . allPlayerScripts [ i ] ;
Vector3 position = playerControllerB . transform . position ;
if ( playerControllerB . deadBody ! = null )
{
position = playerControllerB . deadBody . bodyParts [ 5 ] . transform . position ;
}
if ( Vector3 . Distance ( position , teleportOutPosition . position ) > 2f )
{
if ( playerControllerB . shipTeleporterId ! = 1 )
{
if ( playerControllerB . deadBody ! = null )
{
playerControllerB . deadBody . beamOutParticle . Stop ( ) ;
playerControllerB . deadBody . bodyAudio . Stop ( ) ;
}
else
{
playerControllerB . beamOutBuildupParticle . Stop ( ) ;
playerControllerB . movementAudio . Stop ( ) ;
}
}
2023-12-23 00:55:14 +00:00
continue ;
2023-12-23 00:30:32 +00:00
}
2023-12-23 00:55:14 +00:00
if ( playerControllerB . shipTeleporterId = = 1 )
2023-12-23 00:30:32 +00:00
{
2023-12-23 00:55:14 +00:00
Debug . Log ( $"Cancelled teleporting #{playerControllerB.playerClientId} with inverse teleporter; {playerControllerB.shipTeleporterId}" ) ;
continue ;
}
SetPlayerTeleporterId ( playerControllerB , 2 ) ;
if ( playerControllerB . deadBody ! = null )
{
if ( playerControllerB . deadBody . beamUpParticle = = null )
2023-12-23 00:30:32 +00:00
{
2023-12-23 00:55:14 +00:00
yield break ;
2023-12-23 00:30:32 +00:00
}
2023-12-23 00:55:14 +00:00
if ( ! playerControllerB . deadBody . beamOutParticle . isPlaying )
2023-12-23 00:30:32 +00:00
{
2023-12-23 00:55:14 +00:00
playerControllerB . deadBody . beamOutParticle . Play ( ) ;
playerControllerB . deadBody . bodyAudio . PlayOneShot ( beamUpPlayerBodySFX ) ;
2023-12-23 00:30:32 +00:00
}
}
2023-12-23 00:55:14 +00:00
else if ( ! playerControllerB . beamOutBuildupParticle . isPlaying )
{
playerControllerB . beamOutBuildupParticle . Play ( ) ;
playerControllerB . movementAudio . PlayOneShot ( beamUpPlayerBodySFX ) ;
}
2023-12-23 00:30:32 +00:00
}
yield return new WaitForSeconds ( 1f ) ;
}
for ( int j = 0 ; j < StartOfRound . Instance . allPlayerObjects . Length ; j + + )
{
PlayerControllerB playerControllerB = StartOfRound . Instance . allPlayerScripts [ j ] ;
if ( playerControllerB . shipTeleporterId = = 1 )
{
Debug . Log ( $"Player #{playerControllerB.playerClientId} is in teleport 1, skipping" ) ;
continue ;
}
SetPlayerTeleporterId ( playerControllerB , - 1 ) ;
if ( playerControllerB . deadBody ! = null )
{
playerControllerB . deadBody . beamOutParticle . Stop ( ) ;
playerControllerB . deadBody . bodyAudio . Stop ( ) ;
}
else
{
playerControllerB . beamOutBuildupParticle . Stop ( ) ;
playerControllerB . movementAudio . Stop ( ) ;
}
if ( playerControllerB ! = GameNetworkManager . Instance . localPlayerController | | StartOfRound . Instance . inShipPhase )
{
continue ;
}
Vector3 position2 = playerControllerB . transform . position ;
if ( playerControllerB . deadBody ! = null )
{
position2 = playerControllerB . deadBody . bodyParts [ 5 ] . transform . position ;
}
if ( Vector3 . Distance ( position2 , teleportOutPosition . position ) < 2f )
{
if ( RoundManager . Instance . insideAINodes . Length ! = 0 )
{
Vector3 position3 = RoundManager . Instance . insideAINodes [ Random . Range ( 0 , RoundManager . Instance . insideAINodes . Length ) ] . transform . position ;
Debug . DrawRay ( position3 , Vector3 . up * 1f , Color . red ) ;
position3 = RoundManager . Instance . GetRandomNavMeshPositionInRadiusSpherical ( position3 ) ;
Debug . DrawRay ( position3 + Vector3 . right * 0.01f , Vector3 . up * 3f , Color . green ) ;
SetPlayerTeleporterId ( playerControllerB , 2 ) ;
if ( playerControllerB . deadBody ! = null )
{
TeleportPlayerBodyOutServerRpc ( ( int ) playerControllerB . playerClientId , position3 ) ;
continue ;
}
TeleportPlayerOutWithInverseTeleporter ( ( int ) playerControllerB . playerClientId , position3 ) ;
TeleportPlayerOutServerRpc ( ( int ) playerControllerB . playerClientId , position3 ) ;
}
}
else
{
Debug . Log ( $"Player #{playerControllerB.playerClientId} is not close enough to teleporter to beam out" ) ;
}
}
}
[ServerRpc(RequireOwnership = false)]
public void TeleportPlayerOutServerRpc ( int playerObj , Vector3 teleportPos )
{
NetworkManager networkManager = base . NetworkManager ;
if ( ( object ) networkManager ! = null & & networkManager . IsListening )
{
if ( __rpc_exec_stage ! = __RpcExecStage . Server & & ( networkManager . IsClient | | networkManager . IsHost ) )
{
ServerRpcParams serverRpcParams = default ( ServerRpcParams ) ;
FastBufferWriter bufferWriter = __beginSendServerRpc ( 3033548568 u , serverRpcParams , RpcDelivery . Reliable ) ;
BytePacker . WriteValueBitPacked ( bufferWriter , playerObj ) ;
bufferWriter . WriteValueSafe ( in teleportPos ) ;
__endSendServerRpc ( ref bufferWriter , 3033548568 u , serverRpcParams , RpcDelivery . Reliable ) ;
}
if ( __rpc_exec_stage = = __RpcExecStage . Server & & ( networkManager . IsServer | | networkManager . IsHost ) )
{
TeleportPlayerOutClientRpc ( playerObj , teleportPos ) ;
}
}
}
[ClientRpc]
public void TeleportPlayerOutClientRpc ( int playerObj , Vector3 teleportPos )
{
NetworkManager networkManager = base . NetworkManager ;
if ( ( object ) networkManager ! = null & & networkManager . IsListening )
{
if ( __rpc_exec_stage ! = __RpcExecStage . Client & & ( networkManager . IsServer | | networkManager . IsHost ) )
{
ClientRpcParams clientRpcParams = default ( ClientRpcParams ) ;
FastBufferWriter bufferWriter = __beginSendClientRpc ( 3527914562 u , clientRpcParams , RpcDelivery . Reliable ) ;
BytePacker . WriteValueBitPacked ( bufferWriter , playerObj ) ;
bufferWriter . WriteValueSafe ( in teleportPos ) ;
__endSendClientRpc ( ref bufferWriter , 3527914562 u , clientRpcParams , RpcDelivery . Reliable ) ;
}
if ( __rpc_exec_stage = = __RpcExecStage . Client & & ( networkManager . IsClient | | networkManager . IsHost ) & & ! StartOfRound . Instance . inShipPhase & & ! StartOfRound . Instance . allPlayerScripts [ playerObj ] . IsOwner )
{
TeleportPlayerOutWithInverseTeleporter ( playerObj , teleportPos ) ;
}
}
}
private void TeleportPlayerOutWithInverseTeleporter ( int playerObj , Vector3 teleportPos )
{
if ( StartOfRound . Instance . allPlayerScripts [ playerObj ] . isPlayerDead )
{
StartCoroutine ( teleportBodyOut ( playerObj , teleportPos ) ) ;
return ;
}
PlayerControllerB playerControllerB = StartOfRound . Instance . allPlayerScripts [ playerObj ] ;
SetPlayerTeleporterId ( playerControllerB , - 1 ) ;
playerControllerB . DropAllHeldItems ( ) ;
if ( ( bool ) Object . FindObjectOfType < AudioReverbPresets > ( ) )
{
Object . FindObjectOfType < AudioReverbPresets > ( ) . audioPresets [ 2 ] . ChangeAudioReverbForPlayer ( playerControllerB ) ;
}
playerControllerB . isInElevator = false ;
playerControllerB . isInHangarShipRoom = false ;
playerControllerB . isInsideFactory = true ;
playerControllerB . averageVelocity = 0f ;
playerControllerB . velocityLastFrame = Vector3 . zero ;
StartOfRound . Instance . allPlayerScripts [ playerObj ] . TeleportPlayer ( teleportPos ) ;
StartOfRound . Instance . allPlayerScripts [ playerObj ] . beamOutParticle . Play ( ) ;
shipTeleporterAudio . PlayOneShot ( teleporterBeamUpSFX ) ;
StartOfRound . Instance . allPlayerScripts [ playerObj ] . movementAudio . PlayOneShot ( teleporterBeamUpSFX ) ;
if ( playerControllerB = = GameNetworkManager . Instance . localPlayerController )
{
Debug . Log ( "Teleporter shaking camera" ) ;
HUDManager . Instance . ShakeCamera ( ScreenShakeType . Big ) ;
}
}
[ServerRpc(RequireOwnership = false)]
public void TeleportPlayerBodyOutServerRpc ( int playerObj , Vector3 teleportPos )
{
NetworkManager networkManager = base . NetworkManager ;
if ( ( object ) networkManager ! = null & & networkManager . IsListening )
{
if ( __rpc_exec_stage ! = __RpcExecStage . Server & & ( networkManager . IsClient | | networkManager . IsHost ) )
{
ServerRpcParams serverRpcParams = default ( ServerRpcParams ) ;
FastBufferWriter bufferWriter = __beginSendServerRpc ( 660932683 u , serverRpcParams , RpcDelivery . Reliable ) ;
BytePacker . WriteValueBitPacked ( bufferWriter , playerObj ) ;
bufferWriter . WriteValueSafe ( in teleportPos ) ;
__endSendServerRpc ( ref bufferWriter , 660932683 u , serverRpcParams , RpcDelivery . Reliable ) ;
}
if ( __rpc_exec_stage = = __RpcExecStage . Server & & ( networkManager . IsServer | | networkManager . IsHost ) )
{
TeleportPlayerBodyOutClientRpc ( playerObj , teleportPos ) ;
}
}
}
[ClientRpc]
public void TeleportPlayerBodyOutClientRpc ( int playerObj , Vector3 teleportPos )
{
NetworkManager networkManager = base . NetworkManager ;
if ( ( object ) networkManager ! = null & & networkManager . IsListening )
{
if ( __rpc_exec_stage ! = __RpcExecStage . Client & & ( networkManager . IsServer | | networkManager . IsHost ) )
{
ClientRpcParams clientRpcParams = default ( ClientRpcParams ) ;
FastBufferWriter bufferWriter = __beginSendClientRpc ( 1544539621 u , clientRpcParams , RpcDelivery . Reliable ) ;
BytePacker . WriteValueBitPacked ( bufferWriter , playerObj ) ;
bufferWriter . WriteValueSafe ( in teleportPos ) ;
__endSendClientRpc ( ref bufferWriter , 1544539621 u , clientRpcParams , RpcDelivery . Reliable ) ;
}
if ( __rpc_exec_stage = = __RpcExecStage . Client & & ( networkManager . IsClient | | networkManager . IsHost ) )
{
StartCoroutine ( teleportBodyOut ( playerObj , teleportPos ) ) ;
}
}
}
private IEnumerator teleportBodyOut ( int playerObj , Vector3 teleportPosition )
{
float startTime = Time . realtimeSinceStartup ;
yield return new WaitUntil ( ( ) = > StartOfRound . Instance . allPlayerScripts [ playerObj ] . deadBody ! = null | | Time . realtimeSinceStartup - startTime > 2f ) ;
if ( StartOfRound . Instance . inShipPhase | | SceneManager . sceneCount < = 1 )
{
yield break ;
}
DeadBodyInfo deadBody = StartOfRound . Instance . allPlayerScripts [ playerObj ] . deadBody ;
SetPlayerTeleporterId ( StartOfRound . Instance . allPlayerScripts [ playerObj ] , - 1 ) ;
if ( deadBody ! = null )
{
deadBody . attachedTo = null ;
deadBody . attachedLimb = null ;
deadBody . secondaryAttachedLimb = null ;
deadBody . secondaryAttachedTo = null ;
if ( deadBody . grabBodyObject ! = null & & deadBody . grabBodyObject . isHeld & & deadBody . grabBodyObject . playerHeldBy ! = null )
{
deadBody . grabBodyObject . playerHeldBy . DropAllHeldItems ( ) ;
}
deadBody . isInShip = false ;
deadBody . parentedToShip = false ;
deadBody . transform . SetParent ( null , worldPositionStays : true ) ;
deadBody . SetRagdollPositionSafely ( teleportPosition , disableSpecialEffects : true ) ;
}
}
2023-12-22 22:51:17 +00:00
private IEnumerator beamUpPlayer ( )
{
shipTeleporterAudio . PlayOneShot ( teleporterSpinSFX ) ;
2023-12-23 00:30:32 +00:00
PlayerControllerB playerToBeamUp = StartOfRound . Instance . mapScreen . targetedPlayer ;
2023-12-22 22:51:17 +00:00
if ( playerToBeamUp = = null )
{
2023-12-23 00:30:32 +00:00
Debug . Log ( "Targeted player is null" ) ;
2023-12-22 22:51:17 +00:00
yield break ;
}
2023-12-23 00:55:14 +00:00
if ( playerToBeamUp . redirectToEnemy ! = null )
{
Debug . Log ( $"Attemping to teleport enemy '{playerToBeamUp.redirectToEnemy.gameObject.name}' (tied to player #{playerToBeamUp.playerClientId}) to ship." ) ;
if ( StartOfRound . Instance . shipIsLeaving )
{
Debug . Log ( $"Ship could not teleport enemy '{playerToBeamUp.redirectToEnemy.gameObject.name}' (tied to player #{playerToBeamUp.playerClientId}) because the ship is leaving the nav mesh." ) ;
}
playerToBeamUp . redirectToEnemy . ShipTeleportEnemy ( ) ;
yield return new WaitForSeconds ( 3f ) ;
shipTeleporterAudio . PlayOneShot ( teleporterBeamUpSFX ) ;
if ( GameNetworkManager . Instance . localPlayerController . isInHangarShipRoom )
{
HUDManager . Instance . ShakeCamera ( ScreenShakeType . Big ) ;
}
}
2023-12-23 00:30:32 +00:00
SetPlayerTeleporterId ( playerToBeamUp , 1 ) ;
2023-12-22 22:51:17 +00:00
if ( playerToBeamUp . deadBody ! = null )
{
if ( playerToBeamUp . deadBody . beamUpParticle = = null )
{
yield break ;
}
playerToBeamUp . deadBody . beamUpParticle . Play ( ) ;
playerToBeamUp . deadBody . bodyAudio . PlayOneShot ( beamUpPlayerBodySFX ) ;
}
else
{
playerToBeamUp . beamUpParticle . Play ( ) ;
playerToBeamUp . movementAudio . PlayOneShot ( beamUpPlayerBodySFX ) ;
}
2023-12-23 00:30:32 +00:00
Debug . Log ( "Teleport A" ) ;
2023-12-22 22:51:17 +00:00
yield return new WaitForSeconds ( 3f ) ;
2023-12-23 00:30:32 +00:00
bool flag = false ;
2023-12-22 22:51:17 +00:00
if ( playerToBeamUp . deadBody ! = null )
{
2023-12-23 00:30:32 +00:00
if ( playerToBeamUp . deadBody . grabBodyObject = = null | | ! playerToBeamUp . deadBody . grabBodyObject . isHeldByEnemy )
2023-12-22 22:51:17 +00:00
{
2023-12-23 00:30:32 +00:00
flag = true ;
playerToBeamUp . deadBody . attachedTo = null ;
playerToBeamUp . deadBody . attachedLimb = null ;
playerToBeamUp . deadBody . secondaryAttachedLimb = null ;
playerToBeamUp . deadBody . secondaryAttachedTo = null ;
playerToBeamUp . deadBody . SetRagdollPositionSafely ( teleporterPosition . position , disableSpecialEffects : true ) ;
playerToBeamUp . deadBody . transform . SetParent ( StartOfRound . Instance . elevatorTransform , worldPositionStays : true ) ;
if ( playerToBeamUp . deadBody . grabBodyObject ! = null & & playerToBeamUp . deadBody . grabBodyObject . isHeld & & playerToBeamUp . deadBody . grabBodyObject . playerHeldBy ! = null )
{
playerToBeamUp . deadBody . grabBodyObject . playerHeldBy . DropAllHeldItems ( ) ;
}
2023-12-22 22:51:17 +00:00
}
}
else
{
flag = true ;
playerToBeamUp . DropAllHeldItems ( ) ;
2023-12-23 00:30:32 +00:00
if ( ( bool ) Object . FindObjectOfType < AudioReverbPresets > ( ) )
2023-12-22 22:51:17 +00:00
{
2023-12-23 00:30:32 +00:00
Object . FindObjectOfType < AudioReverbPresets > ( ) . audioPresets [ 3 ] . ChangeAudioReverbForPlayer ( playerToBeamUp ) ;
2023-12-22 22:51:17 +00:00
}
playerToBeamUp . isInElevator = true ;
playerToBeamUp . isInHangarShipRoom = true ;
playerToBeamUp . isInsideFactory = false ;
playerToBeamUp . averageVelocity = 0f ;
playerToBeamUp . velocityLastFrame = Vector3 . zero ;
playerToBeamUp . TeleportPlayer ( teleporterPosition . position , withRotation : true , 160f ) ;
}
2023-12-23 00:30:32 +00:00
Debug . Log ( "Teleport B" ) ;
SetPlayerTeleporterId ( playerToBeamUp , - 1 ) ;
2023-12-22 22:51:17 +00:00
if ( flag )
{
shipTeleporterAudio . PlayOneShot ( teleporterBeamUpSFX ) ;
if ( GameNetworkManager . Instance . localPlayerController . isInHangarShipRoom )
{
HUDManager . Instance . ShakeCamera ( ScreenShakeType . Big ) ;
}
}
2023-12-23 00:30:32 +00:00
Debug . Log ( "Teleport C" ) ;
}
private void SetPlayerTeleporterId ( PlayerControllerB playerScript , int teleporterId )
{
playerScript . shipTeleporterId = teleporterId ;
playersBeingTeleported [ playerScript . playerClientId ] = ( int ) playerScript . playerClientId ;
2023-12-22 22:51:17 +00:00
}
protected override void __initializeVariables ( )
{
base . __initializeVariables ( ) ;
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_ShipTeleporter ( )
{
NetworkManager . __rpc_func_table . Add ( 389447712 u , __rpc_handler_389447712 ) ;
NetworkManager . __rpc_func_table . Add ( 2773756087 u , __rpc_handler_2773756087 ) ;
2023-12-23 00:30:32 +00:00
NetworkManager . __rpc_func_table . Add ( 3033548568 u , __rpc_handler_3033548568 ) ;
NetworkManager . __rpc_func_table . Add ( 3527914562 u , __rpc_handler_3527914562 ) ;
NetworkManager . __rpc_func_table . Add ( 660932683 u , __rpc_handler_660932683 ) ;
NetworkManager . __rpc_func_table . Add ( 1544539621 u , __rpc_handler_1544539621 ) ;
2023-12-22 22:51:17 +00:00
}
private static void __rpc_handler_389447712 ( NetworkBehaviour target , FastBufferReader reader , __RpcParams rpcParams )
{
NetworkManager networkManager = target . NetworkManager ;
if ( ( object ) networkManager ! = null & & networkManager . IsListening )
{
target . __rpc_exec_stage = __RpcExecStage . Server ;
( ( ShipTeleporter ) target ) . PressTeleportButtonServerRpc ( ) ;
target . __rpc_exec_stage = __RpcExecStage . None ;
}
}
private static void __rpc_handler_2773756087 ( NetworkBehaviour target , FastBufferReader reader , __RpcParams rpcParams )
{
NetworkManager networkManager = target . NetworkManager ;
if ( ( object ) networkManager ! = null & & networkManager . IsListening )
{
target . __rpc_exec_stage = __RpcExecStage . Client ;
( ( ShipTeleporter ) target ) . PressTeleportButtonClientRpc ( ) ;
target . __rpc_exec_stage = __RpcExecStage . None ;
}
}
2023-12-23 00:30:32 +00:00
private static void __rpc_handler_3033548568 ( NetworkBehaviour target , FastBufferReader reader , __RpcParams rpcParams )
{
NetworkManager networkManager = target . NetworkManager ;
if ( ( object ) networkManager ! = null & & networkManager . IsListening )
{
ByteUnpacker . ReadValueBitPacked ( reader , out int value ) ;
reader . ReadValueSafe ( out Vector3 value2 ) ;
target . __rpc_exec_stage = __RpcExecStage . Server ;
( ( ShipTeleporter ) target ) . TeleportPlayerOutServerRpc ( value , value2 ) ;
target . __rpc_exec_stage = __RpcExecStage . None ;
}
}
private static void __rpc_handler_3527914562 ( NetworkBehaviour target , FastBufferReader reader , __RpcParams rpcParams )
{
NetworkManager networkManager = target . NetworkManager ;
if ( ( object ) networkManager ! = null & & networkManager . IsListening )
{
ByteUnpacker . ReadValueBitPacked ( reader , out int value ) ;
reader . ReadValueSafe ( out Vector3 value2 ) ;
target . __rpc_exec_stage = __RpcExecStage . Client ;
( ( ShipTeleporter ) target ) . TeleportPlayerOutClientRpc ( value , value2 ) ;
target . __rpc_exec_stage = __RpcExecStage . None ;
}
}
private static void __rpc_handler_660932683 ( NetworkBehaviour target , FastBufferReader reader , __RpcParams rpcParams )
{
NetworkManager networkManager = target . NetworkManager ;
if ( ( object ) networkManager ! = null & & networkManager . IsListening )
{
ByteUnpacker . ReadValueBitPacked ( reader , out int value ) ;
reader . ReadValueSafe ( out Vector3 value2 ) ;
target . __rpc_exec_stage = __RpcExecStage . Server ;
( ( ShipTeleporter ) target ) . TeleportPlayerBodyOutServerRpc ( value , value2 ) ;
target . __rpc_exec_stage = __RpcExecStage . None ;
}
}
private static void __rpc_handler_1544539621 ( NetworkBehaviour target , FastBufferReader reader , __RpcParams rpcParams )
{
NetworkManager networkManager = target . NetworkManager ;
if ( ( object ) networkManager ! = null & & networkManager . IsListening )
{
ByteUnpacker . ReadValueBitPacked ( reader , out int value ) ;
reader . ReadValueSafe ( out Vector3 value2 ) ;
target . __rpc_exec_stage = __RpcExecStage . Client ;
( ( ShipTeleporter ) target ) . TeleportPlayerBodyOutClientRpc ( value , value2 ) ;
target . __rpc_exec_stage = __RpcExecStage . None ;
}
}
2023-12-22 22:51:17 +00:00
protected internal override string __getTypeName ( )
{
return "ShipTeleporter" ;
}
}