using UnityEngine; using System.Collections; using System; namespace SRMultiplayer.Networking { public class NetworkNutcracker : MonoBehaviour { public int ID; public Nutcracker Cracker; internal void Crack(GameObject toCrack) { StartCoroutine(DoCrack(toCrack)); } private IEnumerator DoCrack(GameObject toCrack) { toCrack.GetComponent().isKinematic = true; toCrack.GetComponent().enabled = false; Renderer[] componentsInChildren = toCrack.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } Cracker.anim.SetTrigger(Cracker.activateId); if (Cracker.crackCue != null) { SECTR_AudioSystem.Play(Cracker.crackCue, Cracker.transform.position, false); } yield return new WaitForSeconds(3f); if (Cracker.crackFX != null) { SRBehaviour.SpawnAndPlayFX(Cracker.crackFX, toCrack.transform.position, toCrack.transform.rotation); } } } }