Esempio n. 1
0
 public void RestartTimer()
 {
     Variable?.StartTimer();
     isConstantStopped  = false;
     isConstantFinished = false;
     startTime          = Time.time;
 }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
    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;
    }
Esempio n. 4
0
        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();
        }