void Default_Update() { UpdateSynergyInput(); if (inventory.GetCurrentWeapon().CurrentBulletCount <= 0 || (playerInput.reloaded && !inventory.GetCurrentWeapon().FullyLoaded)) { fsm.ChangeState(PlayerStates.Reloading); } else if (playerInput.shot) { inventory.GetCurrentWeapon().ShootOnce(); } else if (playerInput.shooting) { inventory.GetCurrentWeapon().ShootContinuously(); } if (playerInput.threwShield) { stationaryShieldPower.ThrowShield(synergy); } else if (playerInput.dashed) { if (synergy.Consume(dashCost)) { fsm.ChangeState(PlayerStates.Dashing); } } }
public bool ThrowShield(Synergy synergy) { bool cooldownFinished = Time.time - lastThrowTime >= cooldownTime; if (cooldownFinished && synergy.Consume(synergyCost)) { GameObject projectile = Instantiate(projectilePrefab, aimingTransform.position, Quaternion.Euler(0, 0, 0)); projectile.GetComponent <StationaryShieldProjectile>().stationaryShieldPower = this; projectile.GetComponent <Rigidbody>().AddForce(aimingTransform.forward.normalized * shootForce); lastThrowTime = Time.time; return(true); } return(false); }