I wonder what’s next… - what’s the next lecture going to be about? (I’m all hyped for the ranged system because I want to add destructive gameObjects in my game. You know… everyone loves a little bit of explosion , and a little bit of heavy camera vibration to match with it)
By the way, with throttling (the enemy, I plan to try and throttle the player as well and see how it feels) out of the way, this function in ‘Fighter.AttackBehaviour()’ complains whenever I try eliminate ‘timeBetweenAttacks’ in ‘WeaponConfig.cs’. Can I safely eliminate this?:
if (timeSinceLastAttack > currentWeaponConfig.timeBetweenAttacks && CheckForProjectileAndSufficientAmmo()) {
// Triggering the Attack Event (and resetting the timer to next attack):
TriggerAttack();
timeSinceLastAttack = 0; // Resets timer to calculate how long we need to wait before replaying the attack animation
}
this, and ‘timeBetweenAttacks’ in ‘WeaponConfig.cs’
Also, I tried to throttle the player, but that did NOT go well. Here’s what I tried doing:
- in ‘PlayerStateMachine.cs’, I added the following lines of code:
// TEST (Variable Declaration):
[field: SerializeField] public CooldownTokenManager CooldownTokenManager {get; private set;}
// in 'OnValidate()':
if (CooldownTokenManager == null) CooldownTokenManager = GetComponent<CooldownTokenManager>();
- in ‘PlayerAttackingState.cs’, I added the following:
// this line goes as an extra check in the FIRST 'if' condition in 'PlayerAttackingState.Tick()':
&& normalizedTime > currentAttack.Cooldown
// in 'Exit()', after the Root Motion deactivation:
// TEST
stateMachine.CooldownTokenManager.SetCooldown("Attack", currentAttack.Cooldown);
The player basically just freezes in time after the first swing is successfully done. Where have I gone wrong…?!