private void Start() { _fSM = this.GetComponent <FSM>(); _playerMover = this.GetComponent <PlayerMover>(); _groundDetect = this.GetComponent <ICanDetectGround>(); _characterInput = this.GetComponent <ICharacterInput <PlayerInputCommand> >(); _hitBox = GetComponentInChildren <IAttackable>(); _fSM.OnReceiveFrameEvent += FrameEventHandler; _playerMover.OnMovingStateChanged += MoveStateChangeHandler; _groundDetect.OnLandingStateChanged += HandleLanding; _characterInput.OnReceivedInput += HandleChargingATK; TimeManager.Instance.OnBulletTimeBegin += TimeManagerHandler; _hitBox.OnHit += OnHittedHandler; _fSM.Subscribe(Animation.AnimationState.FadingIn, HandleAnimationFadeInEvent); _particles = new Dictionary <string, ParticleSystem>(); _audios = new Dictionary <string, AudioClip>(); _volume = new Dictionary <string, float>(); _pitch = new Dictionary <string, float>(); _particles.Add(_particlePairs); _audios.Add(_audioPairs); _volume.Add(_volumePairs); _pitch.Add(_pitchPairs); }
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); } }
private void HandleLanding(ICanDetectGround detector, LandingEventArgs eventArgs) { if (eventArgs.lastLandingState != eventArgs.currentLandingState && eventArgs.currentLandingState == LandingState.OnGround) { _particles["Land_In_Ground"].Play(); } }
private void HandleLandingStateChange(ICanDetectGround detector, LandingEventArgs eventArgs) { if (eventArgs.currentLandingState == LandingState.OnGround && _animator.GetCurrentAnimation().name == BossFSMData.Anim.Combo2_3) { _mover.InterruptContantMove(); ShakeScreen.Instance.Shake(_combo2ShakeParams); } }
private void HandleLandingStateChanged(ICanDetectGround sender, LandingEventArgs eventArgs) { if (eventArgs.currentLandingState == LandingState.OnGround) { _currentAirAttack = 0; _animator.SetBool(PlayerFSMData.Stat.Airborne, false); _animator.SetBool(PlayerFSMData.Stat.Charge, false); _bulletTimeReady = false; _extraJump = false; _state._airborne = false; if (_animator.GetCurrentAnimation().name == PlayerFSMData.Anim.Dropping) { SetBlockInput(true); SetFrozen(true); } } else { _animator.SetBool(PlayerFSMData.Stat.Airborne, true); _state._airborne = true; } }