void Awake() { _sight = GetComponent<EnemySight>(); _attack = GetComponent<EnemyAttack>(); _wander = GetComponent<EnemyWander>(); _renderers = GetComponentsInChildren<Renderer>(); _originalColor = _renderers[0].material.color; _currentColor = _originalColor; _sight.OnPlayerInSight += OnPlayerInSight; _sight.OnPlayerOutOfSight += OnPlayerOutOfSight; if(Key != null) Key.gameObject.SetActive(false); }
void Awake() { _sight = GetComponent <EnemySight>(); _attack = GetComponent <EnemyAttack>(); _wander = GetComponent <EnemyWander>(); _renderers = GetComponentsInChildren <Renderer>(); _originalColor = _renderers[0].material.color; _currentColor = _originalColor; _sight.OnPlayerInSight += OnPlayerInSight; _sight.OnPlayerOutOfSight += OnPlayerOutOfSight; if (Key != null) { Key.gameObject.SetActive(false); } }