9 Commits
43 changed files with 990 additions and 493 deletions

No files matched your search

@@ -11,7 +11,7 @@ namespace Code.App.AppStates
{ {
public class GameplayState : BaseState<AppStateMachineContext> public class GameplayState : BaseState<AppStateMachineContext>
{ {
private PlayerHealthPoints _playerHealthPoints; private PlayerHealth _playerHealthPoints;
public GameplayState(AppStateMachineContext context) : base(context) public GameplayState(AppStateMachineContext context) : base(context)
{ {
@@ -24,7 +24,7 @@ namespace Code.App.AppStates
Context.UIService.LoadingScreen.Show(); Context.UIService.LoadingScreen.Show();
Context.UIService.SwitchPanelTo(UIPanel.Gameplay); Context.UIService.SwitchPanelTo(UIPanel.Gameplay);
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson); Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
} }
@@ -27,7 +27,7 @@ namespace Code.App.AppStates
} }
private void SceneLoaded() private void SceneLoaded()
{ {
Context.UIService.LoadingScreen.Hide(); Context.UIService.LoadingScreen.Hide();
base.EnterState(); base.EnterState();
@@ -1,5 +1,4 @@
using Code.App.StateMachine; using Code.App.StateMachine;
using Code.Gameplay.Camera;
using Code.Input; using Code.Input;
using Code.Scenes; using Code.Scenes;
using Code.StateMachine; using Code.StateMachine;
@@ -17,8 +16,6 @@ namespace Code.App.AppStates
{ {
Context.SceneLoaderService.LoadScene((int)SceneIds.MovementDev, SceneLoaded); Context.SceneLoaderService.LoadScene((int)SceneIds.MovementDev, SceneLoaded);
Context.InputService.EnableMap(ActionMappings.Gameplay); Context.InputService.EnableMap(ActionMappings.Gameplay);
Context.CameraStateMachine.SwitchState(CameraMode.FirstPerson);
} }
private void SceneLoaded() private void SceneLoaded()
@@ -1,6 +1,7 @@
using Code.App.StateMachine; using Code.App.StateMachine;
using Code.Configs; using Code.Configs;
using Code.Gameplay.Camera; using Code.Gameplay.Camera;
using Code.Gameplay.Character.Camera;
using Code.Input; using Code.Input;
using Code.Scenes; using Code.Scenes;
using Code.StaticData; using Code.StaticData;
@@ -22,9 +23,10 @@ namespace Code.App
InstallInfrastructureUnit(containerBuilder, staticDataService); InstallInfrastructureUnit(containerBuilder, staticDataService);
containerBuilder.AddSingleton(typeof(InputService), typeof(IInputService)); containerBuilder.AddSingleton(typeof(InputService), typeof(IInputService));
containerBuilder.AddSingleton(typeof(UIService), typeof(IUIService));
InitializeCamera(containerBuilder, staticDataService); InitializeCamera(containerBuilder, staticDataService);
containerBuilder.AddSingleton(typeof(UIService), typeof(IUIService));
containerBuilder.AddSingleton(typeof(SceneLoaderService), typeof(ISceneLoaderService)); containerBuilder.AddSingleton(typeof(SceneLoaderService), typeof(ISceneLoaderService));
containerBuilder.OnContainerBuilt += Bootstrap; containerBuilder.OnContainerBuilt += Bootstrap;
@@ -36,7 +38,7 @@ namespace Code.App
// containerBuilder.AddSingleton(cameraService); // containerBuilder.AddSingleton(cameraService);
// DontDestroyOnLoad(cameraService); // DontDestroyOnLoad(cameraService);
Camera camera = Instantiate(staticDataService.CameraConfig.cameraPrefab); Camera camera = Instantiate(staticDataService.CameraConfig.cameraPrefab2);
DontDestroyOnLoad(camera); DontDestroyOnLoad(camera);
containerBuilder.AddSingleton(camera); containerBuilder.AddSingleton(camera);
} }
@@ -60,9 +62,8 @@ namespace Code.App
containerBuilder.AddSingleton(staticDataService, typeof(IStaticDataService)); containerBuilder.AddSingleton(staticDataService, typeof(IStaticDataService));
containerBuilder.AddSingleton(staticDataService.InputConfig.inputActionAsset, typeof(InputActionAsset)); containerBuilder.AddSingleton(staticDataService.InputConfig.inputActionAsset, typeof(InputActionAsset));
containerBuilder.AddSingleton(staticDataService.CameraConfig, typeof(CameraConfig));
containerBuilder.AddSingleton(staticDataService.CharacterConfig, typeof(CharacterConfig));
containerBuilder.AddSingleton(staticDataService.UIConfig.canvasPrefab, typeof(Canvas)); containerBuilder.AddSingleton(staticDataService.UIConfig.canvasPrefab, typeof(Canvas));
containerBuilder.AddSingleton(staticDataService.CameraConfig, typeof(CameraConfig));
containerBuilder.AddSingleton(staticDataService.UIConfig.uiElementsPrefabs, typeof(UIElement[])); containerBuilder.AddSingleton(staticDataService.UIConfig.uiElementsPrefabs, typeof(UIElement[]));
} }
@@ -10,8 +10,8 @@ namespace Code.App.StateMachine
{ {
[Inject] public ISceneLoaderService SceneLoaderService; [Inject] public ISceneLoaderService SceneLoaderService;
[Inject] public IInputService InputService; [Inject] public IInputService InputService;
[Inject] public IUIService UIService;
[Inject] public AppStateMachine StateMachine; [Inject] public AppStateMachine StateMachine;
[Inject] public CameraStateMachine CameraStateMachine; [Inject] public CameraStateMachine CameraStateMachine;
[Inject] public IUIService UIService;
} }
} }
@@ -7,10 +7,4 @@ namespace Code.Configs
{ {
public GameObject infrastructureUnitPrefab; public GameObject infrastructureUnitPrefab;
} }
[CreateAssetMenu(menuName = "Config/Player", fileName = "PlayerConfig")]
public class PlayerConfig : ScriptableObject
{
public Player playerPrefab;
public int maxHealth;
}
} }
@@ -1,8 +1,11 @@
using Code.Gameplay.Camera;
using Code.Gameplay.Character.Camera;
using Code.Gameplay.Character.Core;
using UnityEngine; using UnityEngine;
namespace Code.Configs namespace Code.Configs
{ {
[CreateAssetMenu(fileName = "CameraConfig", menuName = "Config/CameraConfig")] [CreateAssetMenu(fileName = "CharacterCameraConfig", menuName = "Config/CharacterCameraConfig")]
public class CameraConfig : ScriptableObject public class CameraConfig : ScriptableObject
{ {
public float public float
@@ -28,10 +31,13 @@ namespace Code.Configs
maxVerticalAngle = 70f, // Максимальный угол наклона камеры (вверх) maxVerticalAngle = 70f, // Максимальный угол наклона камеры (вверх)
defaultVerticalAngle = 10f; // Стандартный угол наклона камеры defaultVerticalAngle = 10f; // Стандартный угол наклона камеры
// Позиция следования по умолчанию // Текущий режим камеры
public CameraMode defaultCameraMode = CameraMode.Bogdan;
// Позиция следования по умолчанию (для меню)
public Vector3 defaultFollowPosition = Vector3.zero; public Vector3 defaultFollowPosition = Vector3.zero;
// Префаб камеры public CameraService cameraPrefab;
public Camera cameraPrefab; public Camera cameraPrefab2;
} }
} }
@@ -1,35 +0,0 @@
using UnityEngine;
namespace Code.Configs
{
[CreateAssetMenu(fileName = "CharacterConfig", menuName = "Config/CharacterConfig")]
public class CharacterConfig : ScriptableObject
{
// Основное движение по земле
public float
maxStableMoveSpeed = 8f, // Максимальная скорость движения по устойчивой поверхности
stableMovementSharpness = 15f, // Резкость изменения скорости движения (чем выше - тем резче)
orientationSharpness = 10f, // Резкость изменения вращения персонажа (чем выше - тем резче)
jumpSpeed = 10f; // Скорость прыжка
// Спринт
public float
sprintMoveSpeed = 12f, // Максимальная скорость спринта
sprintAngleThreshold = 90f; // Максимальный угол (в градусах) от направления вперёд, при котором разрешён спринт
// Слайд
public float
slideSpeed = 20f, // Скорость слайда
slideDuration = 0.8f, // Длительность слайда в секундах
slideCooldown = 1.5f; // Время перезарядки слайда в секундах
// Залазание на стены
public float
wallClimbSpeedFactor = 0.8f, // Коэффициент преобразования горизонтальной скорости в вертикальную при залазании на стену
minWallClimbSpeed = 9f, // Минимальная горизонтальная скорость для начала залазания на стену
wallDetectionAngleThreshold = 80f; // Максимальный угол (в градусах) от вертикали, при котором поверхность считается "стеной"
// Гравитация
public Vector3 gravity = new(0f, -30f, 0f); // Вектор, отвечающий за применение гравитации
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 10cfaf8e57f64eddb8c2eda147e4739a
timeCreated: 1761723608
@@ -1,152 +0,0 @@
using Code.Configs;
using Code.Input;
using Code.StateMachine;
using UnityEngine;
namespace Code.Gameplay.Camera.CameraStates
{
public abstract class BaseCameraState : BaseState<CameraStateMachineContext>
{
// DI сервиса ввода
private readonly IInputService _inputService;
// Конфиг камеры
private readonly CameraConfig _config;
// Используемая камера
protected UnityEngine.Camera Camera { get; private set; }
// Трансформ объекта, за которым следует камера
protected Transform FollowTransform;
// Позиция следования: текущая сглаженная позиция и горизонтальное направление камеры
protected Vector3 CurrentFollowPosition;
// Fallback-позиция для режимов без цели
private Vector3 _defaultFollowPosition;
// Целевой вертикальный угол камеры (наклон вверх/вниз)
private float _targetVerticalAngle;
// Текущая и целевая дистанция камеры от цели
protected float CurrentDistance, TargetDistance;
// Исходные значения дистанции для восстановления
protected float OriginalDefaultDistance, OriginalMinDistance, OriginalMaxDistance;
// Горизонтальное направление камеры (проекция forward на плоскость)
private Vector3 PlanarDirection { get; set; }
// Параметры загружаются из CameraConfig
protected float
DefaultDistance,
MinDistance,
MaxDistance,
DistanceMovementSpeed,
RotationSpeed,
RotationSharpness,
FollowSharpness,
MinVerticalAngle,
MaxVerticalAngle,
DefaultVerticalAngle;
// Свойства для доступа к важным данным камеры извне
public Vector3 GetPlanarDirection() => PlanarDirection; // Горизонтальное направление камеры
public Quaternion GetCameraRotation() => Camera.transform.rotation; // Текущее вращение камеры
// Конструктор базового состояния
protected BaseCameraState(CameraStateMachineContext context) : base(context)
{
_inputService = context.InputService;
_config = context.Config;
LoadConfig();
}
// Загрузка конфига для камеры
private void LoadConfig()
{
// Загрузка значений из конфигов
DefaultDistance = _config.defaultDistance;
MinDistance = _config.minDistance;
MaxDistance = _config.maxDistance;
DistanceMovementSpeed = _config.distanceMovementSpeed;
RotationSpeed = _config.rotationSpeed;
RotationSharpness = _config.rotationSharpness;
FollowSharpness = _config.followSharpness;
MinVerticalAngle = _config.minVerticalAngle;
MaxVerticalAngle = _config.maxVerticalAngle;
DefaultVerticalAngle = _config.defaultVerticalAngle;
_defaultFollowPosition = _config.defaultFollowPosition;
// Обеспечиваем корректные значения дистанции и угла
DefaultDistance = Mathf.Clamp(DefaultDistance, MinDistance, MaxDistance);
DefaultVerticalAngle = Mathf.Clamp(DefaultVerticalAngle, MinVerticalAngle, MaxVerticalAngle);
// Сохраняем оригинальные значения для восстановления
OriginalDefaultDistance = DefaultDistance;
OriginalMinDistance = MinDistance;
OriginalMaxDistance = MaxDistance;
CurrentDistance = DefaultDistance;
TargetDistance = CurrentDistance;
_targetVerticalAngle = DefaultVerticalAngle;
PlanarDirection = Vector3.forward; // Начальное направление - вперед по оси Z
CurrentFollowPosition = _defaultFollowPosition;
}
// Переход в состояние
public override void EnterState()
{
Camera = Context.Camera;
}
public override void LateTick()
{
// Обновляем камеру только если есть цель для следования
if (FollowTransform)
{
UpdateWithInput(Time.deltaTime, _inputService.ZoomInput, _inputService.LookInput);
}
}
// Абстрактные методы для специфики режима
protected abstract void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation);
// Обработка вращения камеры на основе пользовательского ввода
// Теперь виртуальный, чтобы статический режим мог работать как хочет
protected virtual void HandleRotationInput(float deltaTime, Vector3 rotationInput, out Quaternion targetRotation)
{
// Вращение вокруг вертикальной оси (горизонтальный поворот)
var rotationFromInput = Quaternion.Euler(FollowTransform.up * (rotationInput.x * RotationSpeed));
PlanarDirection = rotationFromInput * PlanarDirection;
var planarRotation = Quaternion.LookRotation(PlanarDirection, FollowTransform.up);
// Вращение вокруг горизонтальной оси (вертикальный наклон)
_targetVerticalAngle -= rotationInput.y * RotationSpeed;
_targetVerticalAngle = Mathf.Clamp(_targetVerticalAngle, MinVerticalAngle, MaxVerticalAngle);
var verticalRotation = Quaternion.Euler(_targetVerticalAngle, 0, 0);
// Интерполяция к целевому вращению для плавности
targetRotation = Quaternion.Slerp(Camera.transform.rotation, planarRotation * verticalRotation, deltaTime * RotationSharpness);
// Применение финального вращения
Camera.transform.rotation = targetRotation;
}
// Основной метод обновления камеры, вызываемый извне каждый кадр
private void UpdateWithInput(float deltaTime, float zoomInput, Vector3 rotationInput)
{
// Обработка ввода и позиционирования
HandleRotationInput(deltaTime, rotationInput, out var targetRotation);
HandlePosition(deltaTime, zoomInput, targetRotation);
}
// Установка цели для следования камеры
public void SetFollowTransform(Transform t)
{
FollowTransform = t;
CurrentFollowPosition = t ? t.position : _defaultFollowPosition;
if (t) PlanarDirection = t.forward; // Начальное направление совпадает с направлением цели
}
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 92ff312b40a647b392af24877e699bd5
timeCreated: 1761685916
@@ -1,43 +1,153 @@
using System;
using Code.Input;
using Code.StateMachine;
using UnityEngine; using UnityEngine;
namespace Code.Gameplay.Camera.CameraStates namespace Code.Gameplay.Camera.CameraStates
{ {
/* public class FirstPersonState : BaseState<CameraStateMachineContext>
* Состояние камеры от первого лица
* Камера размещается непосредственно на позиции цели (например, на уровне глаз персонажа)
* Дистанция до цели принудительно устанавливается в 0
* Вращение управляется мышью, позиция следует за целью без отступа
*/
public class FirstPersonState : BaseCameraState, ICameraState
{ {
public FirstPersonState(CameraStateMachineContext context) : base(context) { } // Параметры загружаются из CameraConfig
private float
_defaultDistance,
_minDistance,
_maxDistance,
_distanceMovementSpeed,
_rotationSpeed,
_rotationSharpness,
_followSharpness,
_minVerticalAngle,
_maxVerticalAngle,
_defaultVerticalAngle;
// Трансформ объекта, за которым следует камера (для 1st-person: уровень глаз)
private Transform _followTransform;
// Позиция следования: текущая сглаженная позиция и горизонтальное направление камеры
private Vector3 _currentFollowPosition;
// Fallback-позиция для режимов без цели (например, MainMenu)
private Vector3 _defaultFollowPosition;
// Целевой вертикальный угол камеры (наклон вверх/вниз)
private float _targetVerticalAngle;
// Текущая и целевая дистанция камеры от цели
private float _currentDistance, _targetDistance;
// Исходные значения дистанции для восстановления после FirstPerson режима
private float _originalDefaultDistance, _originalMinDistance, _originalMaxDistance;
// Горизонтальное направление камеры (проекция forward на плоскость)
public Vector3 PlanarDirection { get; private set; }
private IInputService _inputService;
private UnityEngine.Camera _camera;
public FirstPersonState(CameraStateMachineContext context) : base(context)
{
_inputService = context.InputService;
// Загрузка значений из конфига
_defaultDistance = context.Config.defaultDistance;
_minDistance = context.Config.minDistance;
_maxDistance = context.Config.maxDistance;
_distanceMovementSpeed = context.Config.distanceMovementSpeed;
_rotationSpeed = context.Config.rotationSpeed;
_rotationSharpness = context.Config.rotationSharpness;
_followSharpness = context.Config.followSharpness;
_minVerticalAngle = context.Config.minVerticalAngle;
_maxVerticalAngle = context.Config.maxVerticalAngle;
_defaultVerticalAngle = context.Config.defaultVerticalAngle;
_defaultFollowPosition = context.Config.defaultFollowPosition;
// Валидация значений (на случай ручного редактирования конфига)
_defaultDistance = Mathf.Clamp(_defaultDistance, _minDistance, _maxDistance);
_defaultVerticalAngle = Mathf.Clamp(_defaultVerticalAngle, _minVerticalAngle, _maxVerticalAngle);
// Сохраняем оригинальные значения для восстановления
_originalDefaultDistance = _defaultDistance;
_originalMinDistance = _minDistance;
_originalMaxDistance = _maxDistance;
// Инициализация состояния камеры
_currentDistance = _defaultDistance;
_targetDistance = _currentDistance;
_targetVerticalAngle = _defaultVerticalAngle;
PlanarDirection = Vector3.forward; // Начальное направление - вперед по оси Z
_currentFollowPosition = _defaultFollowPosition;
}
public override void EnterState() public override void EnterState()
{ {
// В FirstPerson режиме дистанция всегда равна 0 // В FirstPerson режиме дистанция всегда равна 0
MinDistance = 0f; _minDistance = 0f;
MaxDistance = 0f; _maxDistance = 0f;
DefaultDistance = 0f; _defaultDistance = 0f;
TargetDistance = 0f; _targetDistance = 0f;
CurrentDistance = 0f; _currentDistance = 0f;
base.EnterState(); _camera = Context.Camera;
} }
protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation) public override void LateTick()
{
UpdateWithInput(Time.deltaTime,_inputService.ZoomInput, _inputService.LookInput);
}
// Обработка вращения камеры на основе пользовательского ввода
private void HandleRotationInput(float deltaTime, Vector3 rotationInput, out Quaternion targetRotation)
{
// Вращение вокруг вертикальной оси (горизонтальный поворот)
var rotationFromInput = Quaternion.Euler(_followTransform.up * (rotationInput.x * _rotationSpeed));
PlanarDirection = rotationFromInput * PlanarDirection;
var planarRotation = Quaternion.LookRotation(PlanarDirection, _followTransform.up);
// Вращение вокруг горизонтальной оси (вертикальный наклон)
_targetVerticalAngle -= rotationInput.y * _rotationSpeed;
_targetVerticalAngle = Math.Clamp(_targetVerticalAngle, _minVerticalAngle, _maxVerticalAngle);
var verticalRotation = Quaternion.Euler(_targetVerticalAngle, 0, 0);
// Интерполяция к целевому вращению для плавности
targetRotation = Quaternion.Slerp(_camera.transform.rotation, planarRotation * verticalRotation, deltaTime * _rotationSharpness);
Debug.Log(_camera.transform.rotation.eulerAngles);
// Применение финального вращения
_camera.transform.rotation = targetRotation;
Debug.Log(_camera.transform.rotation.eulerAngles);
}
// Обработка позиционирования камеры и зума с учетом текущего режима
private void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
{ {
// Плавное следование за целью с использованием экспоненциального сглаживания // Плавное следование за целью с использованием экспоненциального сглаживания
CurrentFollowPosition = Vector3.Lerp(CurrentFollowPosition, FollowTransform.position, 1f - Mathf.Exp(-FollowSharpness * deltaTime)); _currentFollowPosition = Vector3.Lerp(_currentFollowPosition, _followTransform.position, 1f - Mathf.Exp(-_followSharpness * deltaTime));
// В FirstPerson режиме камера находится прямо на позиции цели // Вычисление целевой позиции камеры с учетом текущего режима
var targetPosition = CurrentFollowPosition; Vector3 targetPosition;
// В FirstPerson режиме камера находится прямо на позиции цели
targetPosition = _currentFollowPosition;
// Установка финальной позиции камеры // Установка финальной позиции камеры
Camera.transform.position = targetPosition; _camera.transform.position = targetPosition;
} }
public CameraMode GetCameraMode()
// Основной метод обновления камеры, вызываемый извне каждый кадр
public void UpdateWithInput(float deltaTime, float zoomInput, Vector3 rotationInput)
{ {
return CameraMode.FirstPerson; // Проверка наличия цели для следования и проверка на режим главного меню
if (!_followTransform) return;
// Обработка ввода и позиционирования
HandleRotationInput(deltaTime, rotationInput, out var targetRotation);
HandlePosition(deltaTime, zoomInput, targetRotation);
}
// Установка цели для следования камеры
public void SetFollowTransform(Transform t)
{
_followTransform = t;
_currentFollowPosition = t.position;
PlanarDirection = t.forward; // Начальное направление совпадает с направлением цели
} }
} }
} }
@@ -1,7 +0,0 @@
namespace Code.Gameplay.Camera.CameraStates
{
public interface ICameraState
{
CameraMode GetCameraMode();
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 4f25670e547242e8a91e19894cf6889c
timeCreated: 1761687204
@@ -1,30 +1,23 @@
using Code.StateMachine;
using UnityEngine; using UnityEngine;
namespace Code.Gameplay.Camera.CameraStates namespace Code.Gameplay.Camera.CameraStates
{ {
public class StaticState : BaseCameraState, ICameraState public class StaticState : BaseState<CameraStateMachineContext>
{ {
public Transform LookTarget; private Transform _target;
public StaticState(CameraStateMachineContext context) : base(context) { } private Transform _position;
private UnityEngine.Camera _camera;
public StaticState(CameraStateMachineContext context) : base(context)
{
}
public override void EnterState() public override void EnterState()
{ {
Debug.Log("Static State Enter"); _camera = Context.Camera;
base.EnterState(); base.EnterState();
} }
protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
{
Camera.transform.position = FollowTransform.position;
}
public CameraMode GetCameraMode() => CameraMode.Static;
protected override void HandleRotationInput(float deltaTime, Vector3 rotationInput,
out Quaternion targetRotation)
{
if(LookTarget) Camera.transform.LookAt(LookTarget);
targetRotation = Camera.transform.rotation;
}
} }
} }
@@ -1,58 +1,164 @@
using System;
using Code.Input;
using Code.StateMachine;
using UnityEngine; using UnityEngine;
namespace Code.Gameplay.Camera.CameraStates namespace Code.Gameplay.Camera.CameraStates
{ {
/* public class ThirdPersonState : BaseState<CameraStateMachineContext>
* Состояние камеры от третьего лица
* Камера следует за персонажем на заданном расстоянии
* Поддерживает зум, плавное следование и вращение с учётом угла наклона
* Дистанция и углы настраиваются через конфигурацию
*/
public class ThirdPersonState : BaseCameraState, ICameraState
{ {
public ThirdPersonState(CameraStateMachineContext context) : base(context) { } // Параметры загружаются из CameraConfig
private float
_defaultDistance,
_minDistance,
_maxDistance,
_distanceMovementSpeed,
_rotationSpeed,
_rotationSharpness,
_followSharpness,
_minVerticalAngle,
_maxVerticalAngle,
_defaultVerticalAngle;
// Трансформ объекта, за которым следует камера (для 1st-person: уровень глаз)
private Transform _followTransform;
// Позиция следования: текущая сглаженная позиция и горизонтальное направление камеры
private Vector3 _currentFollowPosition;
// Fallback-позиция для режимов без цели (например, MainMenu)
private Vector3 _defaultFollowPosition;
// Целевой вертикальный угол камеры (наклон вверх/вниз)
private float _targetVerticalAngle;
// Текущая и целевая дистанция камеры от цели
private float _currentDistance, _targetDistance;
// Исходные значения дистанции для восстановления после FirstPerson режима
private float _originalDefaultDistance, _originalMinDistance, _originalMaxDistance;
// Горизонтальное направление камеры (проекция forward на плоскость)
public Vector3 PlanarDirection { get; private set; }
private IInputService _inputService;
private UnityEngine.Camera _camera;
public ThirdPersonState(CameraStateMachineContext context) : base(context)
{
_inputService = context.InputService;
// Загрузка значений из конфига
_defaultDistance = context.Config.defaultDistance;
_minDistance = context.Config.minDistance;
_maxDistance = context.Config.maxDistance;
_distanceMovementSpeed = context.Config.distanceMovementSpeed;
_rotationSpeed = context.Config.rotationSpeed;
_rotationSharpness = context.Config.rotationSharpness;
_followSharpness = context.Config.followSharpness;
_minVerticalAngle = context.Config.minVerticalAngle;
_maxVerticalAngle = context.Config.maxVerticalAngle;
_defaultVerticalAngle = context.Config.defaultVerticalAngle;
_defaultFollowPosition = context.Config.defaultFollowPosition;
// Валидация значений (на случай ручного редактирования конфига)
_defaultDistance = Mathf.Clamp(_defaultDistance, _minDistance, _maxDistance);
_defaultVerticalAngle = Mathf.Clamp(_defaultVerticalAngle, _minVerticalAngle, _maxVerticalAngle);
// Сохраняем оригинальные значения для восстановления
_originalDefaultDistance = _defaultDistance;
_originalMinDistance = _minDistance;
_originalMaxDistance = _maxDistance;
// Инициализация состояния камеры
_currentDistance = _defaultDistance;
_targetDistance = _currentDistance;
_targetVerticalAngle = _defaultVerticalAngle;
PlanarDirection = Vector3.forward; // Начальное направление - вперед по оси Z
_currentFollowPosition = _defaultFollowPosition;
}
public override void EnterState() public override void EnterState()
{ {
// Восстанавливаем исходные значения дистанции // Восстанавливаем исходные значения дистанции
MinDistance = OriginalMinDistance; _minDistance = _originalMinDistance;
MaxDistance = OriginalMaxDistance; _maxDistance = _originalMaxDistance;
DefaultDistance = OriginalDefaultDistance; _defaultDistance = _originalDefaultDistance;
TargetDistance = DefaultDistance; _targetDistance = _defaultDistance;
base.EnterState(); _camera = Context.Camera;
} }
protected override void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation) public override void LateTick()
{
UpdateWithInput(Time.deltaTime, _inputService.ZoomInput, _inputService.LookInput);
}
// Основной метод обновления камеры, вызываемый извне каждый кадр
public void UpdateWithInput(float deltaTime, float zoomInput, Vector3 rotationInput)
{
// Проверка наличия цели для следования и проверка на режим главного меню
if (!_followTransform) return;
// Обработка ввода и позиционирования
HandleRotationInput(deltaTime, rotationInput, out var targetRotation);
HandlePosition(deltaTime, zoomInput, targetRotation);
}
// Обработка вращения камеры на основе пользовательского ввода
private void HandleRotationInput(float deltaTime, Vector3 rotationInput, out Quaternion targetRotation)
{
// Вращение вокруг вертикальной оси (горизонтальный поворот)
var rotationFromInput = Quaternion.Euler(_followTransform.up * (rotationInput.x * _rotationSpeed));
PlanarDirection = rotationFromInput * PlanarDirection;
var planarRotation = Quaternion.LookRotation(PlanarDirection, _followTransform.up);
// Вращение вокруг горизонтальной оси (вертикальный наклон)
_targetVerticalAngle -= rotationInput.y * _rotationSpeed;
_targetVerticalAngle = Math.Clamp(_targetVerticalAngle, _minVerticalAngle, _maxVerticalAngle);
var verticalRotation = Quaternion.Euler(_targetVerticalAngle, 0, 0);
// Интерполяция к целевому вращению для плавности
targetRotation = Quaternion.Slerp(_camera.transform.rotation, planarRotation * verticalRotation,
deltaTime * _rotationSharpness);
// Применение финального вращения
_camera.transform.rotation = targetRotation;
}
// Обработка позиционирования камеры и зума с учетом текущего режима
private void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
{ {
// Обновление целевой дистанции на основе ввода зума // Обновление целевой дистанции на основе ввода зума
TargetDistance += zoomInput * DistanceMovementSpeed; _targetDistance += zoomInput * _distanceMovementSpeed;
TargetDistance = Mathf.Clamp(TargetDistance, MinDistance, MaxDistance); _targetDistance = Mathf.Clamp(_targetDistance, _minDistance, _maxDistance);
// Плавное следование за целью с использованием экспоненциального сглаживания // Плавное следование за целью с использованием экспоненциального сглаживания
CurrentFollowPosition = Vector3.Lerp( _currentFollowPosition = Vector3.Lerp(_currentFollowPosition, _followTransform.position,
CurrentFollowPosition, 1f - Mathf.Exp(-_followSharpness * deltaTime));
FollowTransform.position,
1f - Mathf.Exp(-FollowSharpness * deltaTime) // Вычисление целевой позиции камеры с учетом текущего режима
); Vector3 targetPosition;
// В ThirdPerson режиме камера отодвинута на расстояние от цели // В ThirdPerson режиме камера отодвинута на расстояние от цели
var targetPosition = CurrentFollowPosition - targetRotation * Vector3.forward * CurrentDistance; targetPosition = _currentFollowPosition - targetRotation * Vector3.forward * _currentDistance;
// Плавное изменение текущей дистанции к целевой (только для ThirdPerson)
_currentDistance = Mathf.Lerp(_currentDistance, _targetDistance,
1f - Mathf.Exp(-_distanceMovementSpeed * deltaTime));
// Плавное изменение текущей дистанции к целевой
CurrentDistance = Mathf.Lerp(
CurrentDistance,
TargetDistance,
1f - Mathf.Exp(-DistanceMovementSpeed * deltaTime)
);
// Установка финальной позиции камеры // Установка финальной позиции камеры
Camera.transform.position = targetPosition; _camera.transform.position = targetPosition;
} }
public CameraMode GetCameraMode() // Установка цели для следования камеры
public void SetFollowTransform(Transform t)
{ {
return CameraMode.ThirdPerson; _followTransform = t;
_currentFollowPosition = t.position;
PlanarDirection = t.forward; // Начальное направление совпадает с направлением цели
} }
} }
} }
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b36ec6a31fb74d608232394fd5df657c
timeCreated: 1761570832
@@ -0,0 +1,215 @@
using System;
using Code.Configs;
using Code.Gameplay.Camera;
using Code.Gameplay.Character.Core;
using Code.StaticData;
using Reflex.Attributes;
using UnityEngine;
namespace Code.Gameplay.Character.Camera
{
/*
* Скрипт, отвечающий за поведение камеры при передвижении
* Поддерживает как 3rd-person, так и 1st-person режимы камеры
* Реализует плавное следование за персонажем, вращение и зум камеры
*
* Источник: Tvtig, https://www.youtube.com/watch?v=9ibpY64wBYM
*/
public class CameraService : MonoBehaviour
{
// Параметры загружаются из CameraConfig
private float
_defaultDistance,
_minDistance,
_maxDistance,
_distanceMovementSpeed,
_rotationSpeed,
_rotationSharpness,
_followSharpness,
_minVerticalAngle,
_maxVerticalAngle,
_defaultVerticalAngle;
// Трансформ объекта, за которым следует камера (для 1st-person: уровень глаз)
private Transform _followTransform;
// Позиция следования: текущая сглаженная позиция и горизонтальное направление камеры
private Vector3 _currentFollowPosition;
// Fallback-позиция для режимов без цели (например, MainMenu)
private Vector3 _defaultFollowPosition;
// Целевой вертикальный угол камеры (наклон вверх/вниз)
private float _targetVerticalAngle;
// Текущая и целевая дистанция камеры от цели
private float _currentDistance, _targetDistance;
// Исходные значения дистанции для восстановления после FirstPerson режима
private float _originalDefaultDistance, _originalMinDistance, _originalMaxDistance;
// Горизонтальное направление камеры (проекция forward на плоскость)
public Vector3 PlanarDirection { get; private set; }
// Текущий режим работы камеры
public CameraMode CurrentMode { get; private set; }
// Загрузка конфига для камеры
[Inject]
private void LoadConfig(CameraConfig config)
{
// Загрузка значений из конфига
_defaultDistance = config.defaultDistance;
_minDistance = config.minDistance;
_maxDistance = config.maxDistance;
_distanceMovementSpeed = config.distanceMovementSpeed;
_rotationSpeed = config.rotationSpeed;
_rotationSharpness = config.rotationSharpness;
_followSharpness = config.followSharpness;
_minVerticalAngle = config.minVerticalAngle;
_maxVerticalAngle = config.maxVerticalAngle;
_defaultVerticalAngle = config.defaultVerticalAngle;
CurrentMode = config.defaultCameraMode;
_defaultFollowPosition = config.defaultFollowPosition;
// Валидация значений (на случай ручного редактирования конфига)
_defaultDistance = Mathf.Clamp(_defaultDistance, _minDistance, _maxDistance);
_defaultVerticalAngle = Mathf.Clamp(_defaultVerticalAngle, _minVerticalAngle, _maxVerticalAngle);
// Сохраняем оригинальные значения для восстановления
_originalDefaultDistance = _defaultDistance;
_originalMinDistance = _minDistance;
_originalMaxDistance = _maxDistance;
// Инициализация состояния камеры
_currentDistance = _defaultDistance;
_targetDistance = _currentDistance;
_targetVerticalAngle = _defaultVerticalAngle;
PlanarDirection = Vector3.forward; // Начальное направление - вперед по оси Z
_currentFollowPosition = _defaultFollowPosition;
}
// Установка цели для следования камеры
public void SetFollowTransform(Transform t)
{
_followTransform = t;
_currentFollowPosition = t.position;
PlanarDirection = t.forward; // Начальное направление совпадает с направлением цели
}
// Обработка вращения камеры на основе пользовательского ввода
private void HandleRotationInput(float deltaTime, Vector3 rotationInput, out Quaternion targetRotation)
{
// Вращение вокруг вертикальной оси (горизонтальный поворот)
var rotationFromInput = Quaternion.Euler(_followTransform.up * (rotationInput.x * _rotationSpeed));
PlanarDirection = rotationFromInput * PlanarDirection;
var planarRotation = Quaternion.LookRotation(PlanarDirection, _followTransform.up);
// Вращение вокруг горизонтальной оси (вертикальный наклон)
_targetVerticalAngle -= rotationInput.y * _rotationSpeed;
_targetVerticalAngle = Math.Clamp(_targetVerticalAngle, _minVerticalAngle, _maxVerticalAngle);
var verticalRotation = Quaternion.Euler(_targetVerticalAngle, 0, 0);
// Интерполяция к целевому вращению для плавности
targetRotation = Quaternion.Slerp(transform.rotation, planarRotation * verticalRotation, deltaTime * _rotationSharpness);
// Применение финального вращения
transform.rotation = targetRotation;
}
// Обработка позиционирования камеры и зума с учетом текущего режима
private void HandlePosition(float deltaTime, float zoomInput, Quaternion targetRotation)
{
// В FirstPerson режиме зум отключается
if (CurrentMode != CameraMode.FirstPerson)
{
// Обновление целевой дистанции на основе ввода зума
_targetDistance += zoomInput * _distanceMovementSpeed;
_targetDistance = Mathf.Clamp(_targetDistance, _minDistance, _maxDistance);
}
// Плавное следование за целью с использованием экспоненциального сглаживания
_currentFollowPosition = Vector3.Lerp(_currentFollowPosition, _followTransform.position, 1f - Mathf.Exp(-_followSharpness * deltaTime));
// Вычисление целевой позиции камеры с учетом текущего режима
Vector3 targetPosition;
if (CurrentMode == CameraMode.FirstPerson)
{
// В FirstPerson режиме камера находится прямо на позиции цели
targetPosition = _currentFollowPosition;
}
else
{
// В ThirdPerson режиме камера отодвинута на расстояние от цели
targetPosition = _currentFollowPosition - targetRotation * Vector3.forward * _currentDistance;
}
// Плавное изменение текущей дистанции к целевой (только для ThirdPerson)
if (CurrentMode != CameraMode.FirstPerson)
{
_currentDistance = Mathf.Lerp(_currentDistance, _targetDistance, 1f - Mathf.Exp(-_distanceMovementSpeed * deltaTime));
}
// Установка финальной позиции камеры
transform.position = targetPosition;
}
// Основной метод обновления камеры, вызываемый извне каждый кадр
public void UpdateWithInput(float deltaTime, float zoomInput, Vector3 rotationInput)
{
// Проверка наличия цели для следования и проверка на режим главного меню
if (!_followTransform || CurrentMode == CameraMode.Bogdan) return;
// Обработка ввода и позиционирования
HandleRotationInput(deltaTime, rotationInput, out var targetRotation);
HandlePosition(deltaTime, zoomInput, targetRotation);
}
// Смена режима камеры
public void SetCameraMode(CameraMode newMode)
{
if (CurrentMode == newMode) return;
CurrentMode = newMode;
// Применяем настройки специфичные для режима
ApplyModeSpecificSettings();
}
// Применение настроек специфичных для текущего режима
private void ApplyModeSpecificSettings()
{
switch (CurrentMode)
{
case CameraMode.FirstPerson:
// В FirstPerson режиме дистанция всегда равна 0
_minDistance = 0f;
_maxDistance = 0f;
_defaultDistance = 0f;
_targetDistance = 0f;
_currentDistance = 0f;
break;
case CameraMode.ThirdPerson:
// Восстанавливаем исходные значения дистанции
_minDistance = _originalMinDistance;
_maxDistance = _originalMaxDistance;
_defaultDistance = _originalDefaultDistance;
_targetDistance = _defaultDistance;
break;
// Заготовка на будущее (если понадобится)
case CameraMode.Bogdan:
_minDistance = 0f;
_maxDistance = 0f;
_defaultDistance = 0f;
_targetDistance = 0f;
_currentDistance = 0f;
break;
case CameraMode.Static:
case CameraMode.Cinematic:
default:
break;
}
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f1d98e6c5419411098391c07861e627e
timeCreated: 1760627986
@@ -1,6 +1,7 @@
using Code.Gameplay.Camera; using Code.Gameplay.Camera;
using KinematicCharacterController; using KinematicCharacterController;
using UnityEngine; using UnityEngine;
using Code.Gameplay.Character.Core;
namespace Code.Gameplay.Character.Controller.Abilities namespace Code.Gameplay.Character.Controller.Abilities
{ {
@@ -13,16 +13,12 @@ namespace Code.Gameplay.Character.Controller.Abilities
private readonly float _wallClimbSpeedFactor; private readonly float _wallClimbSpeedFactor;
// Минимальная горизонтальная скорость для начала залазания на стену // Минимальная горизонтальная скорость для начала залазания на стену
private readonly float _minWallClimbSpeed; private readonly float _minWallClimbSpeed;
// Пороговый косинус стены
private readonly float _wallNormalThreshold;
// Конструктор механики залазания на стену // Конструктор механики залазания на стену
public WallClimbMechanic(float wallClimbSpeedFactor, float minWallClimbSpeed, float wallDetectionAngleThreshold) public WallClimbMechanic(float wallClimbSpeedFactor, float minWallClimbSpeed)
{ {
_wallClimbSpeedFactor = wallClimbSpeedFactor; _wallClimbSpeedFactor = wallClimbSpeedFactor;
_minWallClimbSpeed = minWallClimbSpeed; _minWallClimbSpeed = minWallClimbSpeed;
// Преобразуем угол в косинус порога: если |dot| > cos(threshold), то это НЕ стена
_wallNormalThreshold = Mathf.Cos(Mathf.Deg2Rad * wallDetectionAngleThreshold);
} }
// Обработка столкновения при движении (вызывается при ударе о препятствие) // Обработка столкновения при движении (вызывается при ударе о препятствие)
@@ -30,7 +26,7 @@ namespace Code.Gameplay.Character.Controller.Abilities
{ {
// Проверяем, что это вертикальная или почти вертикальная поверхность (стена) // Проверяем, что это вертикальная или почти вертикальная поверхность (стена)
var dotWithUp = Vector3.Dot(hitNormal, motor.CharacterUp); var dotWithUp = Vector3.Dot(hitNormal, motor.CharacterUp);
if (Mathf.Abs(dotWithUp) > _wallNormalThreshold) return; // Не стена — это пол или потолок if (Mathf.Abs(dotWithUp) > 0.1f) return; // Не стена — это пол или потолок
// Получаем текущую скорость персонажа // Получаем текущую скорость персонажа
var currentVelocity = motor.Velocity; var currentVelocity = motor.Velocity;
@@ -1,11 +1,9 @@
using Code.Configs;
using Code.Gameplay.Camera; using Code.Gameplay.Camera;
using Code.Gameplay.Character.Controller.Abilities; using Code.Gameplay.Character.Controller.Abilities;
using Code.Gameplay.Character.Controller.Input; using Code.Gameplay.Character.Controller.Input;
using Code.Gameplay.Character.Controller.Movement; using Code.Gameplay.Character.Controller.Movement;
using Code.Gameplay.Character.Core; using Code.Gameplay.Character.Core;
using KinematicCharacterController; using KinematicCharacterController;
using Reflex.Attributes;
using UnityEngine; using UnityEngine;
namespace Code.Gameplay.Character.Controller namespace Code.Gameplay.Character.Controller
@@ -19,46 +17,44 @@ namespace Code.Gameplay.Character.Controller
*/ */
public class CustomCharacterController : MonoBehaviour, ICharacterController public class CustomCharacterController : MonoBehaviour, ICharacterController
{ {
[Inject] private CharacterConfig _characterConfig; // Конфиг персонажа через DI
[SerializeField] [SerializeField]
private KinematicCharacterMotor motor; // Движок физического перемещения персонажа private KinematicCharacterMotor motor; // Движок физического перемещения персонажа
[SerializeField]
private float
maxStableMoveSpeed = 8f, // Максимальная скорость движения по устойчивой поверхности
sprintMoveSpeed = 12f, // Максимальная скорость спринта
slideSpeed = 20f, // Скорость слайда
slideDuration = 0.8f, // Длительность слайда в секундах
slideCooldown = 1.5f, // Время перезарядки слайда
stableMovementSharpness = 15f, // Резкость изменения скорости движения (чем выше - тем резче)
orientationSharpness = 10f, // Резкость изменения вращения персонажа (чем выше - тем резче)
jumpSpeed = 10f, // Скорость прыжка
wallClimbSpeedFactor = 0.8f, // Коэффициент преобразования горизонтальной скорости в вертикальную при залазании на стену
minWallClimbSpeed = 9f; // Минимальная горизонтальная скорость для начала залазания на стену
[SerializeField]
private Vector3 gravity = new(0, -30f, 0); // Вектор, отвечающий за применение гравитации
// Подсистемы // Подсистемы
private CharacterInputHandler _inputHandler; private readonly CharacterInputHandler _inputHandler;
private SlideMechanic _slideMechanic; private readonly SlideMechanic _slideMechanic;
private WallClimbMechanic _wallClimbMechanic; private readonly WallClimbMechanic _wallClimbMechanic;
private GroundMovementSystem _groundMovement; private readonly GroundMovementSystem _groundMovement;
private AirMovementSystem _airMovement; private readonly AirMovementSystem _airMovement;
// Инициализация контроллера // Конструктор без параметров, инициализирующий контроллер
private void Awake() public CustomCharacterController()
{ {
// Инициализация подсистем с параметрами из конфига _inputHandler = new CharacterInputHandler();
_inputHandler = new CharacterInputHandler( _slideMechanic = new SlideMechanic(slideSpeed, slideDuration, slideCooldown);
_characterConfig.sprintAngleThreshold _wallClimbMechanic = new WallClimbMechanic(wallClimbSpeedFactor, minWallClimbSpeed);
); _groundMovement = new GroundMovementSystem(maxStableMoveSpeed, sprintMoveSpeed, stableMovementSharpness, jumpSpeed);
_slideMechanic = new SlideMechanic( _airMovement = new AirMovementSystem(gravity);
_characterConfig.slideSpeed,
_characterConfig.slideDuration,
_characterConfig.slideCooldown
);
_wallClimbMechanic = new WallClimbMechanic(
_characterConfig.wallClimbSpeedFactor,
_characterConfig.minWallClimbSpeed,
_characterConfig.wallDetectionAngleThreshold
);
_groundMovement = new GroundMovementSystem(
_characterConfig.maxStableMoveSpeed,
_characterConfig.sprintMoveSpeed,
_characterConfig.stableMovementSharpness,
_characterConfig.jumpSpeed
);
_airMovement = new AirMovementSystem(_characterConfig.gravity);
} }
// Текущий режим камеры для адаптации поведения // Текущий режим камеры для адаптации поведения
private CameraMode _currentCameraMode = CameraMode.FirstPerson; private CameraMode _currentCameraMode = CameraMode.ThirdPerson;
// Инициализация контроллера // Инициализация контроллера
private void Start() private void Start()
@@ -114,13 +110,13 @@ namespace Code.Gameplay.Character.Controller
case CameraMode.ThirdPerson: case CameraMode.ThirdPerson:
{ {
// Вращение применяется только если есть направление движения и разрешена резкость вращения // Вращение применяется только если есть направление движения и разрешена резкость вращения
if (_inputHandler.LookInputVector.sqrMagnitude > 0 && _characterConfig.orientationSharpness > 0) if (_inputHandler.LookInputVector.sqrMagnitude > 0 && orientationSharpness > 0)
{ {
// Плавная интерполяция текущего направления к целевому с экспоненциальным сглаживанием // Плавная интерполяция текущего направления к целевому с экспоненциальным сглаживанием
var smoothedLookInputDirection = Vector3.Slerp( var smoothedLookInputDirection = Vector3.Slerp(
motor.CharacterForward, motor.CharacterForward,
_inputHandler.LookInputVector, _inputHandler.LookInputVector,
1f - Mathf.Exp(-_characterConfig.orientationSharpness * deltaTime) 1f - Mathf.Exp(-orientationSharpness * deltaTime)
).normalized; ).normalized;
// Установка нового вращения смотря в сглаженном направлении // Установка нового вращения смотря в сглаженном направлении
@@ -11,9 +11,6 @@ namespace Code.Gameplay.Character.Controller.Input
*/ */
public class CharacterInputHandler public class CharacterInputHandler
{ {
// Косинус порогового угла для спринта (предвычислен)
private readonly float _sprintAngleThresholdCos;
// Векторы движения и направления взгляда // Векторы движения и направления взгляда
public Vector3 MoveInputVector { get; set; } public Vector3 MoveInputVector { get; set; }
public Vector3 LookInputVector { get; set; } public Vector3 LookInputVector { get; set; }
@@ -26,16 +23,7 @@ namespace Code.Gameplay.Character.Controller.Input
// Флаг-свойство указывающий, что нужно применить вращение камеры к персонажу // Флаг-свойство указывающий, что нужно применить вращение камеры к персонажу
public bool ShouldApplyCameraRotation { get; private set; } public bool ShouldApplyCameraRotation { get; private set; }
// Конструктор с пороговым углом
public CharacterInputHandler(float sprintAngleThreshold)
{
// Предвычисляем косинус порогового угла для эффективности
// Угол в градусах → радианы → косинус
// Чем меньше угол — тем строже условие
_sprintAngleThresholdCos = Mathf.Cos(Mathf.Deg2Rad * sprintAngleThreshold);
}
// Обработка и преобразование входных данных от персонажа // Обработка и преобразование входных данных от персонажа
public void ProcessInputs(ref CharacterInputs inputs, KinematicCharacterMotor motor) public void ProcessInputs(ref CharacterInputs inputs, KinematicCharacterMotor motor)
{ {
@@ -43,7 +31,7 @@ namespace Code.Gameplay.Character.Controller.Input
var currentCameraMode = inputs.CameraMode; var currentCameraMode = inputs.CameraMode;
// Обработка спринта // Обработка спринта
IsSprinting = inputs.SprintPressed && inputs.MoveAxisForward > _sprintAngleThresholdCos; // Спринт только при движении на заданный в конфиге угол IsSprinting = inputs is { SprintPressed: true, MoveAxisForward: > 0.1f }; // Спринт только при движении вперёд
// Нормализация вектора движения и ограничение его величины до 1 // Нормализация вектора движения и ограничение его величины до 1
var moveInputVector = var moveInputVector =
@@ -1,9 +1,11 @@
using Code.Gameplay.Camera; using Code.Gameplay.Camera;
using Code.Gameplay.Camera.CameraStates; using Code.Gameplay.Camera.CameraStates;
using Code.Gameplay.Character.Camera;
using Code.Gameplay.Character.Controller; using Code.Gameplay.Character.Controller;
using Code.Input; using Code.Input;
using Reflex.Attributes; using Reflex.Attributes;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
namespace Code.Gameplay.Character.Core namespace Code.Gameplay.Character.Core
{ {
@@ -15,7 +17,7 @@ namespace Code.Gameplay.Character.Core
*/ */
public class Character : MonoBehaviour public class Character : MonoBehaviour
{ {
[Inject] private CameraStateMachine _cameraStateMachine; // Стейт-машина камеры (нужна для транзакций и т.п.) [Inject] private CameraStateMachine _cameraService; // Компонент камеры персонажа
[SerializeField] private CustomCharacterController customCharacterController; // Компонент управления персонажем [SerializeField] private CustomCharacterController customCharacterController; // Компонент управления персонажем
[SerializeField] private Transform cameraFollowPoint; // Точка следования камеры (уровень глаз для FirstPerson) [SerializeField] private Transform cameraFollowPoint; // Точка следования камеры (уровень глаз для FirstPerson)
@@ -28,7 +30,7 @@ namespace Code.Gameplay.Character.Core
private void Start() private void Start()
{ {
// Настройка камеры для следования за точкой камеры // Настройка камеры для следования за точкой камеры
((BaseCameraState)_cameraStateMachine.CurrentBaseState).SetFollowTransform(cameraFollowPoint); ((FirstPersonState)_cameraService.CurrentBaseState).SetFollowTransform(cameraFollowPoint);
// Включение Gameplay мапа ввода // Включение Gameplay мапа ввода
_inputService.EnableMap(ActionMappings.Gameplay); _inputService.EnableMap(ActionMappings.Gameplay);
@@ -47,11 +49,9 @@ namespace Code.Gameplay.Character.Core
inputs.JumpPressed = _inputService.JumpPressed; // Прыжки (Space) inputs.JumpPressed = _inputService.JumpPressed; // Прыжки (Space)
inputs.SprintPressed = _inputService.SprintPressed; // Спринт (Shift) inputs.SprintPressed = _inputService.SprintPressed; // Спринт (Shift)
inputs.SlidePressed = _inputService.SlidePressed; // Слайд (Ctrl) inputs.SlidePressed = _inputService.SlidePressed; // Слайд (Ctrl)
inputs.CameraMode = ((ICameraState)_cameraStateMachine.CurrentBaseState).GetCameraMode();
// Передаем информацию о камере для адаптивного поведения // Передаем информацию о камере для адаптивного поведения
inputs.CameraRotation = ((BaseCameraState)_cameraStateMachine.CurrentBaseState).GetCameraRotation(); inputs.CameraRotation = _cameraService.transform.rotation;
inputs.CameraPlanarDirection = ((BaseCameraState)_cameraStateMachine.CurrentBaseState).GetPlanarDirection();
// Передаем ввод в контроллер персонажа // Передаем ввод в контроллер персонажа
customCharacterController.SetInputs(ref inputs); customCharacterController.SetInputs(ref inputs);
@@ -67,7 +67,7 @@ namespace Code.Gameplay.Character.Core
{ {
// Обрабатываем нажатие только один раз при первом обнаружении // Обрабатываем нажатие только один раз при первом обнаружении
case true when !_cameraModeToggleHandled: case true when !_cameraModeToggleHandled:
ToggleCameraMode(); // ToggleCameraMode();
_cameraModeToggleHandled = true; _cameraModeToggleHandled = true;
break; break;
// Сбрасываем флаг когда кнопка отпущена // Сбрасываем флаг когда кнопка отпущена
@@ -76,17 +76,6 @@ namespace Code.Gameplay.Character.Core
break; break;
} }
} }
// Метод для переключения режимов камеры
private void ToggleCameraMode()
{
var currentMode = ((ICameraState)_cameraStateMachine.CurrentBaseState).GetCameraMode();
var newMode = currentMode == CameraMode.FirstPerson ? CameraMode.ThirdPerson : CameraMode.FirstPerson;
_cameraStateMachine.SwitchState(newMode);
((BaseCameraState)_cameraStateMachine.CurrentBaseState).SetFollowTransform(cameraFollowPoint);
}
// Обновление логики каждый кадр // Обновление логики каждый кадр
private void Update() private void Update()
@@ -97,5 +86,10 @@ namespace Code.Gameplay.Character.Core
// Обработка переключения режима камеры // Обработка переключения режима камеры
HandleCameraModeInput(); HandleCameraModeInput();
} }
// Обновление после всех вычислений (идеально для камеры)
private void LateUpdate()
{
}
} }
} }
@@ -8,11 +8,11 @@ namespace Code.Gameplay.Player
{ {
[Inject] PlayerConfig _playerConfig; [Inject] PlayerConfig _playerConfig;
public PlayerHealthPoints CreatePlayerHP(int count = -1) public PlayerHealth CreatePlayerHP(int count = -1)
{ {
if (count < 0) count = _playerConfig.maxHealth; if (count < 0) count = _playerConfig.maxHealth;
return new PlayerHealthPoints(count); return new PlayerHealth(count);
} }
} }
} }
@@ -1,27 +0,0 @@
namespace Code.Gameplay.Player
{
public class PlayerHealthPoints
{
public delegate void OnDeathDelegate();
public event OnDeathDelegate OnDeath;
public delegate void OnDamageDelegate(int damage);
public event OnDamageDelegate OnDamage;
private int _healthPoints;
public int HealthPoints => _healthPoints;
public void GetDamage(int count)
{
_healthPoints -= count;
OnDamage?.Invoke(count);
if (_healthPoints <= 0) OnDeath?.Invoke();
}
public PlayerHealthPoints(int healthPoints = 1) => _healthPoints = healthPoints;
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 105512e4d3af4b36932a0d569b87c68e
timeCreated: 1761059874
@@ -1,9 +0,0 @@
using UnityEngine;
namespace Code.Scenes
{
public abstract class SceneEnvironment : MonoBehaviour
{
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: e67772183eee40b0bd3ca806dae98f20
timeCreated: 1761736090
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: a1364bdc4fb54b40843a614990de89ad
timeCreated: 1761736163
@@ -1,9 +0,0 @@
using UnityEngine;
namespace Code.Scenes.SceneEnvironments
{
public class MainMenuEnvironment : SceneEnvironment
{
public Transform CameraTarget;
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 2e7be1a504f64b20ac431e6e231c1f70
timeCreated: 1761736177
@@ -8,9 +8,7 @@ namespace Code.StaticData
void Load(); void Load();
InputConfig InputConfig { get; } InputConfig InputConfig { get; }
AppConfig AppConfig { get; } AppConfig AppConfig { get; }
CameraConfig CameraConfig { get; }
CharacterConfig CharacterConfig { get; }
UIConfig UIConfig { get; } UIConfig UIConfig { get; }
CharacterCameraConfig CharacterCameraConfig { get; } CameraConfig CameraConfig { get; }
} }
} }
@@ -8,17 +8,14 @@ namespace Code.StaticData
{ {
public AppConfig AppConfig { get; private set; } public AppConfig AppConfig { get; private set; }
public InputConfig InputConfig { get; private set; } public InputConfig InputConfig { get; private set; }
public CameraConfig CameraConfig { get; private set; }
public CharacterConfig CharacterConfig { get; private set; }
public UIConfig UIConfig { get; private set; } public UIConfig UIConfig { get; private set; }
public CharacterCameraConfig CharacterCameraConfig { get; private set; } public CameraConfig CameraConfig { get; private set; }
public void Load() public void Load()
{ {
InputConfig = Resources.Load<InputConfig>(string.Format(StringPaths.ConfigSingle, "App", "InputConfig")); InputConfig = Resources.Load<InputConfig>(string.Format(StringPaths.ConfigSingle, "App", "InputConfig"));
AppConfig = Resources.Load<AppConfig>(string.Format(StringPaths.ConfigSingle, "App", "AppConfig")); AppConfig = Resources.Load<AppConfig>(string.Format(StringPaths.ConfigSingle, "App", "AppConfig"));
CameraConfig = Resources.Load<CameraConfig>(string.Format(StringPaths.ConfigSingle, "App", "CameraConfig")); CameraConfig = Resources.Load<CameraConfig>(string.Format(StringPaths.ConfigSingle, "App", "CharacterCameraConfig"));
CharacterConfig = Resources.Load<CharacterConfig>(string.Format(StringPaths.ConfigSingle, "App", "CharacterConfig"));
UIConfig = Resources.Load<UIConfig>(string.Format(StringPaths.ConfigSingle, "App", "UIConfig")); UIConfig = Resources.Load<UIConfig>(string.Format(StringPaths.ConfigSingle, "App", "UIConfig"));
} }
} }
+8 -7
View File
@@ -13,19 +13,20 @@ namespace Code.UI
{ {
_canvas = Object.Instantiate(canvas); _canvas = Object.Instantiate(canvas);
Object.DontDestroyOnLoad(_canvas); Object.DontDestroyOnLoad(_canvas);
_uiPanelsPrefabs = uiPanelsPrefabs; _uiPanelsPrefabs = uiPanelsPrefabs;
LoadingScreen = (LoadingPanel) Object.Instantiate(_uiPanelsPrefabs[(int)UIPanel.Loading], _canvas.transform); LoadingScreen = (LoadingPanel)Object.Instantiate(_uiPanelsPrefabs[(int)UIPanel.Loading], _canvas.transform);
} }
public void EnablePanel() => CurrentPanel.gameObject.SetActive(true); public void EnablePanel() => CurrentPanel.gameObject.SetActive(true);
public void DisablePanel() => CurrentPanel.gameObject.SetActive(false); public void DisablePanel() => CurrentPanel.gameObject.SetActive(false);
public void SwitchPanelTo(UIPanel uiPanel) public void SwitchPanelTo(UIPanel uiPanel)
{ {
Object.Destroy(CurrentPanel); if (CurrentPanel != null)
Object.Destroy(CurrentPanel.gameObject);
CurrentPanel = Object.Instantiate(_uiPanelsPrefabs[(int)uiPanel], _canvas.transform); CurrentPanel = Object.Instantiate(_uiPanelsPrefabs[(int)uiPanel], _canvas.transform);
} }
} }
@@ -10,8 +10,8 @@ MonoBehaviour:
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 72fbf590e5fd4747acfdd32eb26bba3a, type: 3} m_Script: {fileID: 11500000, guid: 72fbf590e5fd4747acfdd32eb26bba3a, type: 3}
m_Name: CameraConfig m_Name: CharacterCameraConfig
m_EditorClassIdentifier: Assembly-CSharp::Code.Configs.CameraConfig m_EditorClassIdentifier: Assembly-CSharp::Code.Configs.CharacterCameraConfig
defaultDistance: 6 defaultDistance: 6
minDistance: 3 minDistance: 3
maxDistance: 10 maxDistance: 10
@@ -24,4 +24,5 @@ MonoBehaviour:
defaultVerticalAngle: 10 defaultVerticalAngle: 10
defaultCameraMode: 0 defaultCameraMode: 0
defaultFollowPosition: {x: 0, y: 0, z: 0} defaultFollowPosition: {x: 0, y: 0, z: 0}
cameraPrefab: {fileID: 374984699890489845, guid: 8b8bf5712dc5a42c7bd8e22cddb884c3, type: 3} cameraPrefab: {fileID: 4646144043143727929, guid: 8b8bf5712dc5a42c7bd8e22cddb884c3, type: 3}
cameraPrefab2: {fileID: 374984699890489845, guid: 8b8bf5712dc5a42c7bd8e22cddb884c3, type: 3}
@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d63c98162aec4c9f9b55578df6aee277 guid: 6938984fc7d25285abb4922dd46d9272
NativeFormatImporter: NativeFormatImporter:
externalObjects: {} externalObjects: {}
mainObjectFileID: 11400000 mainObjectFileID: 11400000
@@ -1,27 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 10cfaf8e57f64eddb8c2eda147e4739a, type: 3}
m_Name: CharacterConfig
m_EditorClassIdentifier: Assembly-CSharp::Code.Configs.CharacterConfig
maxStableMoveSpeed: 8
stableMovementSharpness: 15
orientationSharpness: 10
jumpSpeed: 10
sprintMoveSpeed: 12
sprintAngleThreshold: 90
slideSpeed: 20
slideDuration: 0.8
slideCooldown: 1.5
wallClimbSpeedFactor: 0.8
minWallClimbSpeed: 9
wallDetectionAngleThreshold: 80
gravity: {x: 0, y: -30, z: 0}
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 95fe36bc4922ed1b9bb9e7c9ed5da1eb
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 608c7bc920473dfe5a28da884a28fa9d guid: b2c3995d488bd1f418dbc151825481a9
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
+1 -1
View File
@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f669a7bf66e9d7f868d912b64e88e3ec guid: 347432842dc8679b0b36ed57cc6131df
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
@@ -56,12 +56,316 @@ MonoBehaviour:
fontStyleModifier: 0 fontStyleModifier: 0
renderMode: 4165 renderMode: 4165
includeFontFeatures: 0 includeFontFeatures: 0
m_SourceFontFile: {fileID: 0} m_SourceFontFile: {fileID: 12800000, guid: 4c18ae64a0f1d59239a927890bc9aa3f, type: 3}
m_SourceFontFilePath: m_SourceFontFilePath:
m_AtlasPopulationMode: 1 m_AtlasPopulationMode: 1
InternalDynamicOS: 0 InternalDynamicOS: 0
m_GlyphTable: [] m_GlyphTable:
m_CharacterTable: [] - m_Index: 30
m_Metrics:
m_Width: 51.296875
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 56.703125
m_GlyphRect:
m_X: 10
m_Y: 10
m_Width: 52
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 60
m_Metrics:
m_Width: 49.234375
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 54.625
m_GlyphRect:
m_X: 10
m_Y: 92
m_Width: 50
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 67
m_Metrics:
m_Width: 49.234375
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 54.625
m_GlyphRect:
m_X: 10
m_Y: 174
m_Width: 50
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 64
m_Metrics:
m_Width: 31.40625
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 36.8125
m_GlyphRect:
m_X: 10
m_Y: 256
m_Width: 33
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 77
m_Metrics:
m_Width: 53.09375
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 58.5
m_GlyphRect:
m_X: 10
m_Y: 338
m_Width: 54
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 73
m_Metrics:
m_Width: 52.203125
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 55.984375
m_GlyphRect:
m_X: 62
m_Y: 256
m_Width: 53
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 94
m_Metrics:
m_Width: 51.296875
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 56.703125
m_GlyphRect:
m_X: 79
m_Y: 92
m_Width: 52
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 121
m_Metrics:
m_Width: 49.234375
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 54.625
m_GlyphRect:
m_X: 81
m_Y: 10
m_Width: 50
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 134
m_Metrics:
m_Width: 49.234375
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 54.625
m_GlyphRect:
m_X: 79
m_Y: 174
m_Width: 50
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 118
m_Metrics:
m_Width: 49.234375
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 54.625
m_GlyphRect:
m_X: 10
m_Y: 420
m_Width: 50
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 136
m_Metrics:
m_Width: 51.296875
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 56.703125
m_GlyphRect:
m_X: 10
m_Y: 502
m_Width: 52
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 146
m_Metrics:
m_Width: 49.234375
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 54.625
m_GlyphRect:
m_X: 79
m_Y: 420
m_Width: 50
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 88
m_Metrics:
m_Width: 49.234375
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 54.625
m_GlyphRect:
m_X: 83
m_Y: 338
m_Width: 50
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 145
m_Metrics:
m_Width: 66.59375
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 72
m_GlyphRect:
m_X: 134
m_Y: 256
m_Width: 68
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 127
m_Metrics:
m_Width: 51.296875
m_Height: 81.359375
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 81.359375
m_HorizontalAdvance: 56.703125
m_GlyphRect:
m_X: 150
m_Y: 10
m_Width: 52
m_Height: 82
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
- m_Index: 126
m_Metrics:
m_Width: 51.296875
m_Height: 63
m_HorizontalBearingX: 2.703125
m_HorizontalBearingY: 63
m_HorizontalAdvance: 56.703125
m_GlyphRect:
m_X: 148
m_Y: 174
m_Width: 52
m_Height: 63
m_Scale: 1
m_AtlasIndex: 0
m_ClassDefinitionType: 0
m_CharacterTable:
- m_ElementType: 1
m_Unicode: 68
m_GlyphIndex: 30
m_Scale: 1
- m_ElementType: 1
m_Unicode: 101
m_GlyphIndex: 60
m_Scale: 1
- m_ElementType: 1
m_Unicode: 108
m_GlyphIndex: 67
m_Scale: 1
- m_ElementType: 1
m_Unicode: 105
m_GlyphIndex: 64
m_Scale: 1
- m_ElementType: 1
m_Unicode: 118
m_GlyphIndex: 77
m_Scale: 1
- m_ElementType: 1
m_Unicode: 114
m_GlyphIndex: 73
m_Scale: 1
- m_ElementType: 1
m_Unicode: 1048
m_GlyphIndex: 94
m_Scale: 1
- m_ElementType: 1
m_Unicode: 1075
m_GlyphIndex: 121
m_Scale: 1
- m_ElementType: 1
m_Unicode: 1088
m_GlyphIndex: 134
m_Scale: 1
- m_ElementType: 1
m_Unicode: 1072
m_GlyphIndex: 118
m_Scale: 1
- m_ElementType: 1
m_Unicode: 1090
m_GlyphIndex: 136
m_Scale: 1
- m_ElementType: 1
m_Unicode: 1100
m_GlyphIndex: 146
m_Scale: 1
- m_ElementType: 1
m_Unicode: 1042
m_GlyphIndex: 88
m_Scale: 1
- m_ElementType: 1
m_Unicode: 1099
m_GlyphIndex: 145
m_Scale: 1
- m_ElementType: 1
m_Unicode: 1081
m_GlyphIndex: 127
m_Scale: 1
- m_ElementType: 1
m_Unicode: 1080
m_GlyphIndex: 126
m_Scale: 1
m_AtlasTextures: m_AtlasTextures:
- {fileID: 688428377202190775} - {fileID: 688428377202190775}
m_AtlasTextureIndex: 0 m_AtlasTextureIndex: 0
@@ -72,12 +376,100 @@ MonoBehaviour:
m_AtlasHeight: 1024 m_AtlasHeight: 1024
m_AtlasPadding: 9 m_AtlasPadding: 9
m_AtlasRenderMode: 4165 m_AtlasRenderMode: 4165
m_UsedGlyphRects: [] m_UsedGlyphRects:
m_FreeGlyphRects:
- m_X: 0 - m_X: 0
m_Y: 0 m_Y: 0
m_Width: 71
m_Height: 82
- m_X: 0
m_Y: 82
m_Width: 69
m_Height: 82
- m_X: 0
m_Y: 164
m_Width: 69
m_Height: 82
- m_X: 0
m_Y: 246
m_Width: 52
m_Height: 82
- m_X: 0
m_Y: 328
m_Width: 73
m_Height: 82
- m_X: 52
m_Y: 246
m_Width: 72
m_Height: 82
- m_X: 69
m_Y: 82
m_Width: 71
m_Height: 82
- m_X: 71
m_Y: 0
m_Width: 69
m_Height: 82
- m_X: 69
m_Y: 164
m_Width: 69
m_Height: 82
- m_X: 0
m_Y: 410
m_Width: 69
m_Height: 82
- m_X: 0
m_Y: 492
m_Width: 71
m_Height: 82
- m_X: 69
m_Y: 410
m_Width: 69
m_Height: 82
- m_X: 73
m_Y: 328
m_Width: 69
m_Height: 82
- m_X: 124
m_Y: 246
m_Width: 87
m_Height: 82
- m_X: 140
m_Y: 0
m_Width: 71
m_Height: 101
- m_X: 138
m_Y: 164
m_Width: 71
m_Height: 82
m_FreeGlyphRects:
- m_X: 0
m_Y: 574
m_Width: 1023 m_Width: 1023
m_Height: 449
- m_X: 71
m_Y: 492
m_Width: 952
m_Height: 531
- m_X: 138
m_Y: 410
m_Width: 885
m_Height: 613
- m_X: 142
m_Y: 328
m_Width: 881
m_Height: 695
- m_X: 211
m_Y: 0
m_Width: 812
m_Height: 1023 m_Height: 1023
- m_X: 140
m_Y: 101
m_Width: 883
m_Height: 63
- m_X: 209
m_Y: 101
m_Width: 814
m_Height: 145
m_FontFeatureTable: m_FontFeatureTable:
m_MultipleSubstitutionRecords: [] m_MultipleSubstitutionRecords: []
m_LigatureSubstitutionRecords: [] m_LigatureSubstitutionRecords: []
@@ -153,9 +545,9 @@ Texture2D:
Hash: 00000000000000000000000000000000 Hash: 00000000000000000000000000000000
m_IsAlphaChannelOptional: 0 m_IsAlphaChannelOptional: 0
serializedVersion: 4 serializedVersion: 4
m_Width: 1 m_Width: 1024
m_Height: 1 m_Height: 1024
m_CompleteImageSize: 1 m_CompleteImageSize: 1048576
m_MipsStripped: 0 m_MipsStripped: 0
m_TextureFormat: 1 m_TextureFormat: 1
m_MipCount: 1 m_MipCount: 1
@@ -180,8 +572,8 @@ Texture2D:
m_LightmapFormat: 0 m_LightmapFormat: 0
m_ColorSpace: 1 m_ColorSpace: 1
m_PlatformBlob: m_PlatformBlob:
image data: 1 image data: 1048576
_typelessdata: 00 _typelessdata: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000407090a131313131313131313131313131212121212121212121212121212121212121212110f0d0a0706040100000000000000000000000000000000000000000000000000000407090a1313131313131313131313130e0d0b07030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000407090a13131313131313131313131311070604000000000000000000000000000000000001070b0f111213131313131313131313131313120f0a05000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050b101416172020202020202020202020201f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1e1e1c1a171413110d080100000000000000000000000000000000000000000000050b101416172020202020202020202020201a1a17130e08010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050b101416172020202020202020202020201e1413100c070100000000000000000000000000050c12171b1d1e202020202020202020202020201e1b16100901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Line truncated
m_StreamData: m_StreamData:
serializedVersion: 2 serializedVersion: 2
offset: 0 offset: 0
@@ -1,8 +1,8 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c37e59bfd1d9cd5d083d88fcd9784d1f guid: 247ca2b9087bd3d469bd5f70d5326e40
NativeFormatImporter: NativeFormatImporter:
externalObjects: {} externalObjects: {}
mainObjectFileID: 0 mainObjectFileID: 11400000
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant: