Пример #1
0
        private void Awake()
        {
            _bulletForce = 10f;

            _secondsCount = 1f;

            _raycastHitComponent = this.gameObject.GetComponentInParent <RaycastHitComponent>();
            if (_raycastHitComponent == null)
            {
                Debug.LogError("No RaycastHitComponent in parent object was found.");

                return;
            }

            TargetChanged(_raycastHitComponent.Target);
            _raycastHitComponent.TargetChanged += TargetChanged;
        }
        protected virtual void Awake()
        {
            _speed = 1f;

            _target = FindObjectOfType <PlayerView>();
            if (_target == null)
            {
                Debug.LogError("No PlayerView was found.");

                return;
            }

            _raycastHitComponent = this.gameObject.GetComponentInParent <RaycastHitComponent>();
            if (_raycastHitComponent == null)
            {
                Debug.LogError("No RaycastHitComponent in parent object was found.");

                return;
            }

            TargetChanged(_raycastHitComponent.Target);
            _raycastHitComponent.TargetChanged += TargetChanged;
        }