using System.Collections; using UnityEngine; namespace Subworlds.Scripts { class BrokenLaserScript : MonoBehaviour { private Renderer r; private GameObject hazard; public int anim; public bool active; private bool animating; private bool running; private void Awake() { this.r = base.GetComponent(); this.hazard = base.transform.GetChild(0).gameObject; OnEnable(); } private void OnEnable() { if (!animating) base.StartCoroutine(this.Anim()); if (Network.isServer) { if (!running && this.gameObject.activeSelf) base.StartCoroutine(this.Run()); } } private void OnDisable() { this.r.material.mainTextureOffset = new Vector2(0f, 0f); this.animating = false; this.running = false; } [RPC] private void ChageState(bool state) { active = state; StartCoroutine(SetActiveDelay(state)); } private IEnumerator SetActiveDelay(bool state) { yield return new WaitForSeconds(0.15f); hazard.SetActive(state); } private IEnumerator Run() { running = true; while (true) { yield return new WaitForSeconds(1f); base.GetComponent().RPC("ChageState", RPCMode.All, new object[] { true }); yield return new WaitForSeconds(2f); base.GetComponent().RPC("ChageState", RPCMode.All, new object[] { false }); } } // Token: 0x0600009B RID: 155 RVA: 0x0000E4C8 File Offset: 0x0000C8C8 private IEnumerator Anim() { this.animating = true; while (true) { anim = (anim + 1) % 4; if (active) { this.r.material.mainTextureScale = new Vector2(0.2f, 1f); this.r.material.mainTextureOffset = new Vector2(0.2f * (anim + 1), 0f); } else { this.r.material.mainTextureScale = new Vector2(0.2f, 1f); this.r.material.mainTextureOffset = new Vector2(0f, 0f); } yield return new WaitForSeconds(0.1f); } } } }