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);
        }
示例#2
0
        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);
            }
        }