This commit is contained in:
ThomasCharester committed 2026-10-28 20:19:28 +03:00
1 parent d3b2e4c8d8
commit 2bd71f8dc5
76 files changed
+74739 -165606

No files matched your search

@@ -12,6 +12,7 @@ using Code.Infrastructure.Utils;
using Code.OfficeGame.BattleMode.Actions;
using Code.OfficeGame.BattleMode.Actions.Attacks;
using Code.OfficeGame.BattleMode.Actions.Player;
using Code.OfficeGame.BattleMode.Marker;
using Code.OfficeGame.BattleMode.UI;
using Code.OfficeGame.Player;
using Cysharp.Threading.Tasks;
@@ -91,17 +92,13 @@ namespace Code.Game.TestingLevel
(BattleTimelinePanel)await Context.UIFactory
.LoadPanel(UIPanelType.BattleTimelinePanel, false);
PlayerDecisionMarker playerDecisionMarker =
Object.Instantiate(playerDecisionMarkerConfig.Config.PlayerDecisionMarkerPrefab);
playerDecisionMarker.Toggle(false);
Object.DontDestroyOnLoad(playerDecisionMarker);
// ((OpenMovementCameraState)Context.Camera.CurrentBaseState).SetTarget(player.transform);
MarkerManager markerManager = new(playerDecisionMarkerConfig);
void InstallExtra(Scene scene, ContainerBuilder builder)
{
builder.RegisterValue(attackActionsConfigs);
builder.RegisterValue(playerDecisionMarker);
builder.RegisterValue(playerDecisionMarkerConfig);
builder.RegisterValue(markerManager);
builder.RegisterValue(factoryConfig);
builder.RegisterValue(factory, new[] { typeof(IPlayerFactory) });
@@ -82,6 +82,8 @@ namespace Code.OfficeGame.BattleMode.Actions.Attacks
if (_currentFrame == 0)
{
// TODO Root Motion не должен быть использован в нормальных анимациях
animator.applyRootMotion = true;
animator.Play(_attackData.StateHash, 0, 0f);
}
@@ -116,7 +118,8 @@ namespace Code.OfficeGame.BattleMode.Actions.Attacks
animator.Update(0f);
_entityHitBoxes.DisableAllHitboxes();
// TODO С нормальными анимациями не нужен будет рут моушен
// TODO С нормальными анимациями не нужен будет рут моушен√
animator.applyRootMotion = false;
animator.transform.localPosition = Vector3.zero;
animator.transform.localRotation = Quaternion.identity;
@@ -129,6 +132,7 @@ namespace Code.OfficeGame.BattleMode.Actions.Attacks
{
if (_currentFrame == 0)
{
holoCop.Animator.applyRootMotion = true;
holoCop.Animator.Play(_attackData.StateHash, 0, 0f);
}
@@ -137,6 +141,7 @@ namespace Code.OfficeGame.BattleMode.Actions.Attacks
if(_currentFrame >= _attackData.TotalFrames)
{
_currentFrame = 0;
holoCop.Animator.applyRootMotion = false;
return true;
}
@@ -3,6 +3,7 @@ using Code.Game.Gameplay.Player;
using Code.Infrastructure.Camera;
using Code.Infrastructure.Input;
using Code.OfficeGame.BattleMode.Actions.Player;
using Code.OfficeGame.BattleMode.Marker;
using Code.OfficeGame.BattleMode.Timeline;
using Cysharp.Threading.Tasks;
using KinematicCharacterController;
@@ -32,9 +33,9 @@ namespace Code.OfficeGame.BattleMode.Actions
public void Construct(
CameraStateMachine cameraStateMachine,
IInputService inputService,
PlayerDecisionMarker playerDecisionMarker)
MarkerManager markerManager)
{
_playerDecisionMarker = playerDecisionMarker;
_markerManager = markerManager;
_cameraStateMachine = cameraStateMachine;
_inputService = inputService;
_movementController = GetComponent<MovementController>();
@@ -150,11 +151,15 @@ namespace Code.OfficeGame.BattleMode.Actions
_inputService.BindActionPerformed((int)ActionMappings.BattleMode, (int)BattleModeActions.Watchment,
MarkPosition);
_playerLockedDecisionMarker = _markerManager.GetMarkerInstance();
_playerDecisionMarker = _markerManager.GetMarkerInstance();
_playerDecisionMarker.Toggle(true);
await UniTask.WaitUntilCanceled(_waitForEnterTokenSource.Token).SuppressCancellationThrow();
_playerDecisionMarker.Toggle(false);
_markerManager.ReleaseMarkerInstance(_playerDecisionMarker);
_markerManager.ReleaseMarkerInstance(_playerLockedDecisionMarker);
_inputService.UnbindActionPerformed((int)ActionMappings.BattleMode, (int)BattleModeActions.Select,
SelectPosition);
@@ -176,7 +181,7 @@ namespace Code.OfficeGame.BattleMode.Actions
public override BattleActionType ActionType => BattleActionType.Move;
private int _totalFrames;
private PlayerDecisionMarker _playerDecisionMarker;
private MarkerManager _markerManager;
private void CancelPosition(InputAction.CallbackContext obj)
{
@@ -234,6 +239,9 @@ namespace Code.OfficeGame.BattleMode.Actions
private RaycastHit[] _hitBuffer = new RaycastHit[1];
private Vector3 _lastViewedPosition;
private PlayerDecisionMarker _playerDecisionMarker;
private PlayerDecisionMarker _playerLockedDecisionMarker;
private void MarkPosition(InputAction.CallbackContext input)
{
var position = _cameraStateMachine.Camera.transform.position;
@@ -252,16 +260,10 @@ namespace Code.OfficeGame.BattleMode.Actions
private void SelectPosition(InputAction.CallbackContext input)
{
// var position = _cameraStateMachine.Camera.transform.position;
// var direction = _cameraStateMachine.Camera.transform.forward;
//
// var didHit = Physics.Raycast(position, direction, out RaycastHit hit, Mathf.Infinity, _navMeshMask);
//
// if (!didHit) return;
Debug.Log($"Hit {_lastViewedPosition}");
_targetPosition = _lastViewedPosition;
_playerLockedDecisionMarker.MoveMarker(_targetPosition);
_playerLockedDecisionMarker.Toggle(true);
}
}
}
@@ -27,6 +27,8 @@ namespace Code.OfficeGame.BattleMode.Actions
}
public override async UniTask<BattleActionDecisionResult> DecideAction()
{
await UniTask.Yield();
_currentFrame = 0;
Finished = false;
@@ -15,6 +15,8 @@ namespace Code.OfficeGame.BattleMode.Actions
{
Finished = false;
await UniTask.Yield();
_waitFrames = 120;
return new()
@@ -39,19 +39,15 @@ namespace Code.OfficeGame.BattleMode.Actions.HoloCopy
_initialAnimationState = stateInfo.shortNameHash;
_initialNormalizedTime = stateInfo.normalizedTime;
animator.applyRootMotion = false;
animator.SetFloat(VelocityForward, originAnimator.GetFloat(VelocityForward));
animator.Play(_initialAnimationState, 0, _initialNormalizedTime);
animator.Update(0f);
animator.applyRootMotion = true;
}
private void ReturnToSnapshot()
{
bool prevRootMotion = animator.applyRootMotion;
animator.applyRootMotion = false;
animator.Play(_initialAnimationState, 0, _initialNormalizedTime);
animator.Update(0f);
@@ -61,8 +57,6 @@ namespace Code.OfficeGame.BattleMode.Actions.HoloCopy
originMotor.SetPositionAndRotation(_initialMotorPosition, _initialMotorRotation);
animator.applyRootMotion = prevRootMotion;
Physics.SyncTransforms();
}
@@ -4,17 +4,13 @@ namespace Code.OfficeGame.BattleMode.Actions.Player
{
public class PlayerDecisionMarker : MonoBehaviour
{
public bool locked;
public void Toggle(bool onOff)
{
locked = false;
gameObject.SetActive(onOff);
}
public void MoveMarker(Vector3 position)
{
if (locked) return;
transform.position = position;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 527881ac6276480fa4c734f16ca1d2fc
timeCreated: 1793204344
@@ -0,0 +1,27 @@
using Code.Infrastructure.Utils;
using Code.OfficeGame.BattleMode.Actions.Player;
using UnityEngine;
namespace Code.OfficeGame.BattleMode.Marker
{
// TODO Сделать пул?
public class MarkerManager
{
private PlayerDecisionMarkerConfig _playerDecisionMarkerConfig;
public MarkerManager(SingleConfig<PlayerDecisionMarkerConfig> config)
{
_playerDecisionMarkerConfig = config.Config;
}
public PlayerDecisionMarker GetMarkerInstance()
{
PlayerDecisionMarker marker = Object.Instantiate(_playerDecisionMarkerConfig.PlayerDecisionMarkerPrefab);
marker.Toggle(false);
Object.DontDestroyOnLoad(marker);
return marker;
}
public void ReleaseMarkerInstance(PlayerDecisionMarker marker) => Object.Destroy(marker.gameObject);
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c9056d229a6741f299714db3e799785b
timeCreated: 1793204390
@@ -49,7 +49,7 @@ namespace Code.OfficeGame.BattleMode.UI
return result;
}
catch (OperationCanceledException ex)
catch (OperationCanceledException)
{
return BattleActionType.None;
}