public void RestartTimer() { Variable?.StartTimer(); isConstantStopped = false; isConstantFinished = false; startTime = Time.time; }
public override void Enter() { base.Enter(); GroundSlamCooldownTimer.StartTimer(); //Set Velocity at least enough to bounce, and dont decrease if already falling fast float newJumpVelocity = Mathf.Min(-Mathf.Abs(SlamVelocity.Value), -BounceThresholdVelocity.Value); newJumpVelocity = Mathf.Min(PreviousVelocity.Value.y, newJumpVelocity); StoredJumpVelocity.Value = newJumpVelocity; //playerController.AddImpulse(Vector3.down * SlamForce.Value); }
private void Start() { charMotor.CharacterController = this; MaxStableDenivelationAngle.Subscribe(OnUpdateMaxStableDenivelationAngle); HungerDecayTimer?.RestartTimer(); FrenzyOut.Subscribe(OnUpdateFrenzy); GroundSlamCooldownTimer.StartTimer(); capsuleStartHeight = charMotor.Capsule.height; capsuleStartCenter = charMotor.Capsule.center; capsuleStartRadius = charMotor.Capsule.radius; UpdateScale(Scale.Value, Scale.Value); Scale.Subscribe(UpdateScale); IsPlayerDead.Value = false; }
private void Release() { float timeToOptimalCharge = Mathf.Abs(Time.time - (enterTime + OptimalChargeTime.Value)); if (timeToOptimalCharge < OptimalChargeErrorThreshold.Value) { accumulatedForce = MaxForce.Value * OptimalChargeMultiplier.Value * accumulatedForce.normalized; SlingShotOptimalReleaseEvent.Raise(); SlingShotOptimalReleaseTrigger.Activate(); } else if (accumulatedForce != Vector3.zero) { SlingShotReleaseEvent.Raise(); SlingShotReleaseTrigger.Activate(); } playerController.AddImpulse(accumulatedForce); playerController.ToggleArrow(false); DelayTimer.StartTimer(); }