using System; using UnityEngine; public class EmpowerStopBlockObjectFollow : MonoBehaviour { private void Start() { Block componentInParent = GetComponentInParent(); componentInParent.BlockAction = (Action)Delegate.Combine(componentInParent.BlockAction, new Action(Block)); } private void OnDestroy() { Block componentInParent = GetComponentInParent(); componentInParent.BlockAction = (Action)Delegate.Remove(componentInParent.BlockAction, new Action(Block)); } private void Block(BlockTrigger.BlockTriggerType triggerTyp) { if (triggerTyp == BlockTrigger.BlockTriggerType.Empower && (bool)GetComponent()) { GetComponent().mostRecentlySpawnedObject.GetComponent().enabled = false; } } }