private void Awake() { _input = GetComponent <ICharacterInput <PlayerInputCommand> >(); _mover = GetComponent <PlayerMover>(); _animator = GetComponent <FSM>(); _weaponSystem = GetComponent <WeaponSystem>(); _groundDetector = GetComponent <ICanDetectGround>(); _hitbox = GetComponentInChildren <IAttackable>(); _hitFlash = GetComponent <HitFlash>(); colliders = new List <Collider2D>(); colliderLayers = new List <int>(); _dashCooldownTimer = new Timer(); _mover.OnMovingStateChanged += HandleMovingStateChanged; _mover.OnBeginDashingInvincible += HandleDashingInvincibleBegin; _mover.OnStopDashingInvincible += HandleDashingInvincibleStop; _groundDetector.OnLandingStateChanged += HandleLandingStateChanged; _input.OnReceivedInput += HandleReceivedInput; _animator.Subscribe(Animation.AnimationState.FadingIn, HandleAnimationFadeinEvent); _animator.Subscribe(Animation.AnimationState.Completed, HandleAnimationCompletedEvent); _animator.OnReceiveFrameEvent += HandleAnimationFrameEvent; _weaponSystem.OnPull += HandlePull; _hitbox.OnHit += HandleOnHit; TimeManager.Instance.OnBulletTimeBegin += OnBulletTimeBegin; TimeManager.Instance.OnBulletTimeEnd += OnBulletTimeEnd; }
private void Awake() { _animator = GetComponent <FSM>(); _state = GetComponent <EnemyState>(); _input = GetComponent <ICharacterInput <BossInput> >(); _hitFlash = GetComponent <HitFlash>(); _mover = GetComponent <BossMover>(); _groundDetector = GetComponent <ICanDetectGround>(); _stalkTracker = new BezierTracker(); _input.OnReceivedInput += HandleReceivedInput; _groundDetector.OnLandingStateChanged += HandleLandingStateChange; _animator.Subscribe(Animation.AnimationState.FadingIn, HandleFadeInAnimation); _animator.Subscribe(Animation.AnimationState.Completed, HandleCompletedAnimation); _animator.OnReceiveFrameEvent += HandleFrameEvent; foreach (var hitbox in _hitboxes) { hitbox.OnHit += HandleOnHit; } foreach (var weakpoint in _weakpoints) { weakpoint.SetParent(null); } }