public void StartTimeScale(TimeScaleParams timeScaleParams) { if (!m_TimeIsFrozen) { Time.timeScale = timeScaleParams.m_TimeScaleAmount; Time.fixedDeltaTime = Time.timeScale * K_DEFAULT_FIXED_DELTA_TIME; m_TimeScaleDuration = timeScaleParams.m_TimeScaleDuration; m_TimeScaleBackToNormal = timeScaleParams.m_TimeScaleBackToNormal; m_TimeScaleTimeStamp = Time.unscaledTime; m_TimeScaleInProgress = true; } }
private void TriggerEffects(PlayerBaseAttackLogic attackLogic, uint damage, EAttackResult attackResult, EHitNotificationType hitNotificationType) { Profiler.BeginSample("PlayerHealthComponent.TriggerEffects"); PlayerAttack attack = attackLogic.GetAttack(); bool isDead = IsDead(); // No stun neither pushback when an attack is parried if (attackResult != EAttackResult.Parried) { if (attackLogic.CanStunOnDamage()) { m_StunInfoSC.StartStun(attackLogic, attackResult); } // If stun duration is not anim driven, we can set the duration and apply a pushback if (!m_StunInfoSC.IsStunDurationAnimDriven()) { if (attackLogic.CanStunOnDamage()) { float stunDuration = attackLogic.GetStunDuration(attackResult); if (stunDuration > 0f) { m_StunInfoSC.SetStunDuration(attackLogic, stunDuration); } } if (attackLogic.CanPushBack()) { float pushBackForce = attackLogic.GetPushBackForce(attackResult); if (pushBackForce > 0.0f && m_MovementComponent) { if (isDead) { pushBackForce *= AttackConfig.Instance.m_OnDeathPushbackMultiplier; } m_MovementComponent.PushBack(pushBackForce); } } } } PlayerSuperGaugeSubComponent superGaugeSC = m_AttackComponent.GetSuperGaugeSubComponent(); if (superGaugeSC != null) { superGaugeSC.IncreaseGaugeValue(AttackConfig.Instance.m_DefenderSuperGaugeBonus); } if (attackResult == EAttackResult.Hit) { m_StunInfoSC.IncreaseGaugeValue(attackLogic.GetStunGaugeHitAmount()); } TimeScaleParams timeScaleParams = null; if (isDead) { timeScaleParams = AttackConfig.Instance.m_OnDeathTimeScaleParams; } else if (attack.m_UseTimeScaleEffect) { timeScaleParams = attack.m_TimeScaleParams; } if (timeScaleParams != null) { ChronicleManager.AddChronicle(gameObject, EChronicleCategory.Health, "StartTimeScale - Amount: " + timeScaleParams.m_TimeScaleAmount + " Duration: " + timeScaleParams.m_TimeScaleDuration); m_TimeScaleManager.StartTimeScale(timeScaleParams); if (timeScaleParams.m_TimeScaleAmount == 0f) { TriggerHitStopShake(timeScaleParams.m_TimeScaleDuration); } } if (!attackLogic.GetLastHitPoint(out Vector3 hitPoint)) { hitPoint = attackLogic.GetOwner().transform.position; } if (attackResult != EAttackResult.Blocked) { if (attack.m_UseCameraShakeEffect || isDead) { Vector3 hitDirection = (transform.position - attackLogic.GetOwner().transform.position).normalized; CameraShakeParams camShakeParamsToUse = isDead ? AttackConfig.Instance.m_OnDeathCamShakeParams : attack.m_CameraShakeParams; CameraShakeManager.GenerateImpulseAt(camShakeParamsToUse, hitPoint, hitDirection); } } TriggerHitFX(attackLogic, hitPoint, attackResult, hitNotificationType); PlayHitSFX(attackLogic, attackResult, hitNotificationType); Profiler.EndSample(); }