Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using GameNetcodeStuff;
- using System;
- using System.Collections.Generic;
- using System.Text;
- using Unity.Netcode;
- using UnityEngine;
- namespace TombsMadnessMod.MapItems
- {
- internal class BearTrap : NetworkBehaviour
- {
- private bool hasTriggered;
- private PlayerControllerB localPlayerOnTrap;
- private Animator animator;
- private AudioSource audioSource;
- public AudioClip trapCloseSFX;
- public void Start()
- {
- animator = GetComponent<Animator>();
- audioSource = GetComponent<AudioSource>();
- }
- public void OnTriggerEnter(Collider other)
- {
- if (hasTriggered)
- {
- return;
- }
- if (other.CompareTag("Player"))
- {
- PlayerControllerB component = other.gameObject.GetComponent<PlayerControllerB>();
- if (!(component != GameNetworkManager.Instance.localPlayerController) && component != null && !component.isPlayerDead)
- {
- component.DamagePlayer(80, true, true, CauseOfDeath.Unknown);
- component.movementSpeed = 0.4f;
- TriggerTrapServerRpc(component);
- }
- }
- }
- public void OnTriggerExit(Collider other)
- {
- if (other.CompareTag("Player"))
- {
- PlayerControllerB component = other.gameObject.GetComponent<PlayerControllerB>();
- if (!(component != GameNetworkManager.Instance.localPlayerController) && component != null && !component.isPlayerDead)
- {
- localPlayerOnTrap = null;
- animator.SetBool("IsTriggerd", false);
- component.movementSpeed = 4.6f;
- }
- }
- }
- [ServerRpc(RequireOwnership = false)]
- public async void TriggerTrapServerRpc(PlayerControllerB clientThatTriggerd, ServerRpcParams rpcParams = default)
- {
- NetworkLog.LogInfoServer($"ServerRpc triggered by {clientThatTriggerd.playerUsername}");
- foreach (var player in RoundManager.Instance.playersManager.allPlayerScripts)
- {
- TriggerTrapClientRpc(player);
- }
- }
- [ClientRpc]
- public void TriggerTrapClientRpc(PlayerControllerB clientThatTriggerd, ClientRpcParams rpcParams = default)
- {
- NetworkLog.LogInfoServer($"ClientRpc triggered for {clientThatTriggerd.playerUsername}");
- localPlayerOnTrap = clientThatTriggerd;
- audioSource.PlayOneShot(trapCloseSFX);
- animator.SetBool("IsTriggerd", true);
- hasTriggered = true;
- }
- }
- }
- //CLIENTLOG
- [Info : Unity Log] [Netcode] ServerRpc triggered by Player #1
- [Info : Unity Log] [Netcode] ClientRpc triggered for Player #0
- [Info : Unity Log] [Netcode] ClientRpc triggered for Player #1
- [Info : Unity Log] [Netcode] ClientRpc triggered for Player #2
- [Info : Unity Log] [Netcode] ClientRpc triggered for Player #3
- //HOSTLOG
- [Info : Unity Log] [Netcode-Server Sender=1] ServerRpc triggered by Player #1
- [Info : Unity Log] [Netcode-Server Sender=1] ClientRpc triggered for Player #0
- [Info : Unity Log] [Netcode-Server Sender=1] ClientRpc triggered for Player #1
- [Info : Unity Log] [Netcode-Server Sender=1] ClientRpc triggered for Player #2
- [Info : Unity Log] [Netcode-Server Sender=1] ClientRpc triggered for Player #3
Advertisement
Comments
-
- We are <a href="https://1starcflashservice.com/">Professional Electrical Engineering Consultants</a> based in Houston, Texas! 🌟 Our services include:
- 📐 Manufacturing and Electrical Platform Design
- 📐 Oil Gas Site Survey
- 📐 Arc Flash Assessment Service
- 📐 Label printing One-line diagrams
- 📐 OSHA NFPA 70E compliance
- 📐 Safety Hazard Labeling
- We also offer specialized analysis and reports, such as:
- 🔌 <a href="https://1starcflashservice.com/">Load flow analysis</a>
- 🔌 <a href="https://1starcflashservice.com/">Short Circuit analysis</a>
- 🔌 <a href="https://1starcflashservice.com/">Arc Flash analysis</a>
- 🔌 Full report with <a href="https://1starcflashservice.com/">Arc Flash Labels</a>
- Feel free to reach out to us anytime! 😊
- Call or Text Us - 832-840-2066
- Youtube - https://www.youtube.com/@rickvasquez9374
- Email - [email protected]
- In addition to that, we provide comprehensive <a href="https://1starcflashservice.com/">Electrical Engineering services</a> like:
- 🔌 Electrical system modeling
- 🔌 Equipment evaluation
- 🔌 Selective coordination studies
- 🔌 Photometric light studies
- 🔌 Grounding studies
- We are proficient in creating:
- 📐 One-line diagrams
- 📐 Hazardous area classification
- 📐 Electrical schematics and wiring diagrams
- 📐 Conduit and cable schedules
- 📐 Power, Lighting, & Grounding plans
- 📐 Panel schedules
- 📐 Electrical installation details
- 📐 Electrical equipment specification
- 📐 AutoCad drafting
- Feel free to reach out to us anytime! 😊
- <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>
Add Comment
Please, Sign In to add comment