private void Update() { float delta = Time.deltaTime; Tick(delta); Controller.Tick(in delta); animatorHook.Tick(/*in delta*/); }
public void Tick(float d) { delta = d; controllerStates.onGround = OnGround(); HandleAnimationAll(); animatorHook.Tick(); if (controllerStates.isInteracting) { interactTime += delta; if (switchingWeapon) { if (interactTime > 1f) { switchingWeapon = false; controllerStates.isInteracting = false; controllerStates.isAiming = true; interactTime = 0; } } else { (GameObject.FindObjectOfType(typeof(UICrosshair)) as UICrosshair).EnableReloadUI(interactTime, reloadTime); if (interactTime > reloadTime - 0.1f) { controllerStates.isAiming = true; } if (interactTime > reloadTime) { controllerStates.isInteracting = false; interactTime = 0; } } } UIPlayer.instance.OnHitTaken(healthPlayer.healthAmount, startHealth); if (healthPlayer.healthAmount <= 0) { isDead = true; Destroy(animatorHook); animator.SetLayerWeight(1, 0); animator.SetLayerWeight(2, 0); animator.SetLayerWeight(3, 0); Time.timeScale = 0.5f; animator.Play("death2"); } }