public override void ExecuteAfterAnimation() { base.ExecuteAfterAnimation(); Debug.Log("[WHIPLASHES]: " + _halja.getWhiplashesCycles()); if (_halja.getWhiplashesCycles() <= 0) { _halja.setWhipLashesClock(Time.time); _halja.setWhipLashesCountdown(6f); _halja.setChainOfDestinyCountdown(1.5f); _halja.setChainOfDestinyClock(Time.time); _halja.setPunishmentCountdown(4f); _halja.setPunishmentClock(Time.time); _halja.setWhipLashesCycles(3); _stateMachine.ChangeState(_halja._playerDetectState); } else { Collider[] player = Physics.OverlapSphere(_halja.transform.position, _halja.getWhiplashesMaxDistance(), LayerMask.GetMask("Player")); _player = player.Length == 0 ? null : player[0]; if (_player == null) { _halja.setWhipLashesCycles(_halja.getWhiplashesCycles() - 1); _stateMachine.ChangeState(_halja._whipLashes); } else { _player.GetComponent <PlayerStatus>().TakeDamage(2f); _halja.setWhipLashesCycles(_halja.getWhiplashesCycles() - 1); _stateMachine.ChangeState(_halja._whipLashes); } } }
public override void ExecuteAfterAnimation() { base.ExecuteAfterAnimation(); if (_hit) //colpisco a fine aniamzione obv //_player.GetComponent<Rigidbody>().AddForce(_halja.getDirection()*8f,ForceMode.Impulse); { _player.GetComponent <Rigidbody>().AddExplosionForce(40f, _halja.transform.position, 7f, 0f, ForceMode.Impulse); _player.GetComponent <PlayerStatus>().TakeDamage(10f); } _halja.setPunishmentCountdown(5f); _halja.setPunishmentClock(Time.time); _halja.setChainOfDestinyClock(2.5f); _halja.setChainOfDestinyClock(Time.time); _halja.setWhipLashesCountdown(4f); _halja.setWhipLashesClock(Time.time); _stateMachine.ChangeState(_halja._moveState); }