public FlyerHitState(FlyerFSM stateMachine, Flyer flyer) { _stateMachine = stateMachine; _receiveHit = flyer.ReceiveHit; _hitVolume = flyer.HitVolume; }
public CrawlerHitState(CrawlerFSM stateMachine, Crawler crawler) { _stateMachine = stateMachine; _receiveHit = crawler.ReceiveHit; _hitVolume = crawler.HitVolume; }
private void Awake() { _crawler = GetComponent <Crawler>(); // create states MoveState = new CrawlerMoveState(this, _crawler); HitState = new CrawlerHitState(this, _crawler); // any state transitions _receiveHit = _crawler.ReceiveHit; }
public Patroller_HitState(PatrollerFSM stateMachine, Patroller patroller) { _stateMachine = stateMachine; _patroller = patroller; _movement = patroller.Movement; _playerLOS = patroller.PlayerDetector.PlayerLOS; _receiveHit = patroller.ReceiveHit; }
private void Awake() { _flyer = GetComponent <Flyer>(); _receiveHit = _flyer.ReceiveHit; // states IdleState = new FlyerIdleState(this, _flyer); ChasingState = new FlyerChasingState(this, _flyer); ReturningState = new FlyerReturningState(this, _flyer); HitState = new FlyerHitState(this, _flyer); }
private void DetectHitable(Collider2D collision) { ReceiveHit hitable = collision.GetComponent <ReceiveHit>(); if (hitable != null) { ApplyHitEffects(collision, hitable); // notify weapon system so player behavior can respond _weaponSystem.HitOtherObject(); } }
public PlayerDashState(PlayerFSM stateMachine, Player player) { _stateMachine = stateMachine; _player = player; _animator = player.PlayerAnimator; _movement = player.Movement; _data = player.Data; _dashSystem = player.DashSystem; _input = player.Input; _groundDetector = player.EnvironmentDetector.GroundDetector; _sfx = player.SFX; _receiveHit = player.ReceiveHit; _jumpDust = player.Visuals.JumpDust; }
private void Awake() { _patroller = GetComponent <Patroller>(); _health = _patroller.Health; _receiveHit = _patroller.ReceiveHit; // create states IdleState = new Patroller_IdleState(this, _patroller); MoveState = new Patroller_MoveState(this, _patroller); PlayerDetectedState = new Patroller_PlayerDetectedState(this, _patroller); ChargeState = new Patroller_ChargeState(this, _patroller); SearchState = new Patroller_SearchState(this, _patroller); AttackState = new Patroller_AttackState(this, _patroller); HitState = new Patroller_HitState(this, _patroller); DeadState = new Patroller_DeadState(this, _patroller); }
private void ApplyHitEffects(Collider2D other, ReceiveHit hitable) { int damage = _weaponSystem.CurrentMeleeAttack.Damage; float amount = _weaponSystem.CurrentMeleeAttack.KnockbackAmount; float duration = _weaponSystem.CurrentMeleeAttack.KnockbackDuration; // add modifier, adjusted for facing direction Vector2 direction = CalculateDirection(other); //pushable.Push(direction, amount, duration); if (_hitParticle != null) { ParticleSystem hitParticle = Instantiate(_hitParticle, hitable.transform); hitParticle.Play(); } HitData hitData = new HitData(other.transform, damage, direction, amount, duration); hitable.Hit(hitData); }
public ShooterHitStunState(ShooterFSM stateMachine, Shooter shooter) { _stateMachine = stateMachine; _receiveHit = shooter.ReceiveHit; }
public EnemyKnockbackState(EnemyFSM stateMachine, Enemy enemy) { _stateMachine = stateMachine; _receiveHit = enemy.ReceiveHit; }