blob: dd64869a4ead62970c86e4b14e1d00dc8a023f16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
using System;
using UnityEngine;
public class EmpowerStopBlockObjectFollow : MonoBehaviour
{
private void Start()
{
Block componentInParent = GetComponentInParent<Block>();
componentInParent.BlockAction = (Action<BlockTrigger.BlockTriggerType>)Delegate.Combine(componentInParent.BlockAction, new Action<BlockTrigger.BlockTriggerType>(Block));
}
private void OnDestroy()
{
Block componentInParent = GetComponentInParent<Block>();
componentInParent.BlockAction = (Action<BlockTrigger.BlockTriggerType>)Delegate.Remove(componentInParent.BlockAction, new Action<BlockTrigger.BlockTriggerType>(Block));
}
private void Block(BlockTrigger.BlockTriggerType triggerTyp)
{
if (triggerTyp == BlockTrigger.BlockTriggerType.Empower && (bool)GetComponent<SpawnObjects>())
{
GetComponent<SpawnObjects>().mostRecentlySpawnedObject.GetComponent<FollowPlayer>().enabled = false;
}
}
}
|