Files
BABA_YAGA/Assets/Third Parties/Opsive/UltimateCharacterController/Demo/Scripts/UI/MouseSmoothingZone.cs
Scove 3e39117acc Consolidate third-party plugins into Assets/Plugins
Move and consolidate many third-party plugin files and metadata from various locations (notably Assets/Third Parties/Plugins 1 and scattered Opsive/Photon folders) into a unified Assets/Plugins directory. Includes DOTween, PrimeTween, Native/BackroomsNoise, Sirenix/Odin Inspector, and Opsive UltimateCharacterController/shared libs, plus updates to several .meta files and removal of obsolete installer/legacy files. This standardizes plugin layout and cleans up duplicate/obsolete assets.
2026-06-16 18:41:44 +07:00

69 lines
2.6 KiB
C#

/// ---------------------------------------------
/// Ultimate Character Controller
/// Copyright (c) Opsive. All Rights Reserved.
/// https://www.opsive.com
/// ---------------------------------------------
namespace Opsive.UltimateCharacterController.Demo.UI
{
using Opsive.UltimateCharacterController.Character;
using Opsive.UltimateCharacterController.StateSystem;
using UnityEngine;
/// <summary>
/// Manages the mouse smoothing zone. Allows switching betweening mouse input types.
/// </summary>
public class MouseSmoothingZone : UIZone
{
private enum SmoothingType { Raw, Smoothing, LowSensitivity, LowSensitivityAcceleration }
private SmoothingType m_SmoothingType = SmoothingType.Smoothing;
/// <summary>
/// Change the smoothing type to the specified type.
/// </summary>
/// <param name="type">The type to change the value to.</param>
public void ChangeSmoothingType(int type)
{
ChangeInputType((SmoothingType)type);
}
/// <summary>
/// Change the smoothing type to the specified type.
/// </summary>
/// <param name="type">The type to change the value to.</param>
private void ChangeInputType(SmoothingType type)
{
// Revert the old.
SetButtonColor((int)m_SmoothingType, m_NormalColor);
StateManager.SetState(m_ActiveCharacter, System.Enum.GetName(typeof(SmoothingType), m_SmoothingType), false);
// Set the new smoothing type.
m_SmoothingType = type;
SetButtonColor((int)m_SmoothingType, m_PressedColor);
StateManager.SetState(m_ActiveCharacter, System.Enum.GetName(typeof(SmoothingType), type), true);
EnableInput();
}
/// <summary>
/// The character has entered from the zone.
/// </summary>
/// <param name="characterLocomotion">The character that entered the zone.</param>
protected override void CharacterEnter(UltimateCharacterLocomotion characterLocomotion)
{
// The smoothing type is the standard type.
ChangeInputType(SmoothingType.Smoothing);
}
/// <summary>
/// The character has exited from the zone.
/// </summary>
/// <param name="characterLocomotion">The character that exited the zone.</param>
protected override void CharacterExit(UltimateCharacterLocomotion characterLocomotion)
{
// The smoothing type should activate when leaving the zone.
ChangeInputType(SmoothingType.Smoothing);
}
}
}