private void OnPlayerScaleChanged(float scale) { //scaledPlayerState = GetScaledPlayerState(); UpdateAnimatorSpeed(targetAnimator, scale); UpdateCharacterController(scale); // "transform" here isn't the Player itself, it is Player's remote representation that is synced with peers (P2PPlayer) transform.localScale = new Vector3(scale, scale, scale); Player.Get().m_SpeedMul = GulliverMod.GetMultipliedScale(scale, 0.5f); Player.DEEP_WATER = 1.8f * scale; if (CameraManager.Get() && CameraManager.Get().m_MainCamera) { CameraManager.Get().m_MainCamera.nearClipPlane = 0.01f * scale; } }
public static void UpdateAnimatorSpeed(Animator animator, float scale) { animator.speed = Mathf.Max(1f / GulliverMod.GetMultipliedScale(scale, 0.25f), 0.5f); }