glados123123123123

Untitled

Jan 13th, 2024
1,131
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.44 KB | None | 0 0
  1. using GameNetcodeStuff;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using Unity.Netcode;
  6. using UnityEngine;
  7.  
  8. namespace TombsMadnessMod.MapItems
  9. {
  10.    internal class BearTrap : NetworkBehaviour
  11.    {
  12.        private bool hasTriggered;
  13.        private PlayerControllerB localPlayerOnTrap;
  14.        private Animator animator;
  15.        private AudioSource audioSource;
  16.  
  17.        public AudioClip trapCloseSFX;
  18.  
  19.        public void Start()
  20.        {
  21.            animator = GetComponent<Animator>();
  22.            audioSource = GetComponent<AudioSource>();
  23.        }
  24.        
  25.        public void OnTriggerEnter(Collider other)
  26.        {
  27.            if (hasTriggered)
  28.            {
  29.                return;
  30.            }
  31.  
  32.            if (other.CompareTag("Player"))
  33.            {
  34.                PlayerControllerB component = other.gameObject.GetComponent<PlayerControllerB>();
  35.                if (!(component != GameNetworkManager.Instance.localPlayerController) && component != null && !component.isPlayerDead)
  36.                {
  37.                   component.DamagePlayer(80, true, true, CauseOfDeath.Unknown);
  38.                   component.movementSpeed = 0.4f;
  39.                   TriggerTrapServerRpc(component);
  40.                }
  41.            }
  42.        }
  43.  
  44.        public void OnTriggerExit(Collider other)
  45.        {
  46.            if (other.CompareTag("Player"))
  47.            {
  48.                PlayerControllerB component = other.gameObject.GetComponent<PlayerControllerB>();
  49.                if (!(component != GameNetworkManager.Instance.localPlayerController) && component != null && !component.isPlayerDead)
  50.                {
  51.                   localPlayerOnTrap = null;
  52.                   animator.SetBool("IsTriggerd", false);
  53.                   component.movementSpeed = 4.6f;
  54.                }
  55.            }
  56.        }
  57.  
  58.        [ServerRpc(RequireOwnership = false)]
  59.        public async void TriggerTrapServerRpc(PlayerControllerB clientThatTriggerd, ServerRpcParams rpcParams = default)
  60.        {
  61.            NetworkLog.LogInfoServer($"ServerRpc triggered by {clientThatTriggerd.playerUsername}");
  62.            foreach (var player in RoundManager.Instance.playersManager.allPlayerScripts)
  63.            {
  64.                TriggerTrapClientRpc(player);
  65.            }
  66.        }
  67.  
  68.        [ClientRpc]
  69.        public void TriggerTrapClientRpc(PlayerControllerB clientThatTriggerd, ClientRpcParams rpcParams = default)
  70.        {
  71.            NetworkLog.LogInfoServer($"ClientRpc triggered for {clientThatTriggerd.playerUsername}");
  72.            localPlayerOnTrap = clientThatTriggerd;
  73.            audioSource.PlayOneShot(trapCloseSFX);
  74.            animator.SetBool("IsTriggerd", true);
  75.            hasTriggered = true;
  76.        }
  77.    }
  78. }
  79.  
  80.  
  81. //CLIENTLOG
  82. [Info   : Unity Log] [Netcode] ServerRpc triggered by Player #1
  83. [Info   : Unity Log] [Netcode] ClientRpc triggered for Player #0
  84. [Info   : Unity Log] [Netcode] ClientRpc triggered for Player #1
  85. [Info   : Unity Log] [Netcode] ClientRpc triggered for Player #2
  86. [Info   : Unity Log] [Netcode] ClientRpc triggered for Player #3
  87.  
  88. //HOSTLOG
  89. [Info   : Unity Log] [Netcode-Server Sender=1] ServerRpc triggered by Player #1
  90. [Info   : Unity Log] [Netcode-Server Sender=1] ClientRpc triggered for Player #0
  91. [Info   : Unity Log] [Netcode-Server Sender=1] ClientRpc triggered for Player #1
  92. [Info   : Unity Log] [Netcode-Server Sender=1] ClientRpc triggered for Player #2
  93. [Info   : Unity Log] [Netcode-Server Sender=1] ClientRpc triggered for Player #3
Advertisement
Comments
  • # text 1.83 KB | 0 0
    1. We are <a href="https://1starcflashservice.com/">Professional Electrical Engineering Consultants</a> based in Houston, Texas! 🌟 Our services include:
    2.  
    3. 📐 Manufacturing and Electrical Platform Design
    4. 📐 Oil Gas Site Survey
    5. 📐 Arc Flash Assessment Service
    6. 📐 Label printing One-line diagrams
    7. 📐 OSHA NFPA 70E compliance
    8. 📐 Safety Hazard Labeling
    9.  
    10. We also offer specialized analysis and reports, such as:
    11.  
    12. 🔌 <a href="https://1starcflashservice.com/">Load flow analysis</a>
    13. 🔌 <a href="https://1starcflashservice.com/">Short Circuit analysis</a>
    14. 🔌 <a href="https://1starcflashservice.com/">Arc Flash analysis</a>
    15. 🔌 Full report with <a href="https://1starcflashservice.com/">Arc Flash Labels</a>
    16.  
    17. Feel free to reach out to us anytime! 😊
    18. Call or Text Us - 832-840-2066
    19. Youtube - https://www.youtube.com/@rickvasquez9374
    20.  
    21. In addition to that, we provide comprehensive <a href="https://1starcflashservice.com/">Electrical Engineering services</a> like:
    22.  
    23. 🔌 Electrical system modeling
    24. 🔌 Equipment evaluation
    25. 🔌 Selective coordination studies
    26. 🔌 Photometric light studies
    27. 🔌 Grounding studies
    28.  
    29. We are proficient in creating:
    30.  
    31. 📐 One-line diagrams
    32. 📐 Hazardous area classification
    33. 📐 Electrical schematics and wiring diagrams
    34. 📐 Conduit and cable schedules
    35. 📐 Power, Lighting, & Grounding plans
    36. 📐 Panel schedules
    37. 📐 Electrical installation details
    38. 📐 Electrical equipment specification
    39. 📐 AutoCad drafting
    40.  
    41. Feel free to reach out to us anytime! 😊
    42.  
    43. <iframe width="1353" height="761" src="https://www.youtube.com/embed/ODAWKOccuw0" title="Electrical Engineering Consultants in Houston Texas" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
    44.  
    45.  
Add Comment
Please, Sign In to add comment