Fixinprocess

This commit is contained in:
ThomasCharester committed 2026-11-02 01:46:10 +03:00
1 parent 0619ada74f
commit 921c4125b7
772 files changed
+154236 -144405

No files matched your search

@@ -2,6 +2,7 @@ namespace Code.OfficeGame.BattleMode.Actions
{
public class WaitBattleActionData : BattleActionData
{
public bool StartedWaiting = false;
public int WaitFrames;
public override BattleActionData GetSnapshot()
{
@@ -1,8 +1,7 @@
using System.Linq;
using Code.Infrastructure.Particles;
using Code.Infrastructure.Utils;
using Code.OfficeGame.BattleMode.Actions.Deciders;
using Code.OfficeGame.BattleMode.HitBoxes;
using Code.OfficeGame.BattleMode.Timeline;
using UnityEngine;
namespace Code.OfficeGame.BattleMode.Actions.Attacks
@@ -10,10 +9,12 @@ namespace Code.OfficeGame.BattleMode.Actions.Attacks
public class BattleActionPlayerAttackMMA : BattleAction
{
private AttackActionConfig _attackData;
private IParticleService _particleService;
public int EntryStateHash => Animator.StringToHash("WalkBlend");
public BattleActionPlayerAttackMMA(MultipleConfig<BattleActionParameters> attackData)
public BattleActionPlayerAttackMMA(MultipleConfig<BattleActionParameters> attackData, IParticleService particleService)
{
_particleService = particleService;
_attackData = (AttackActionConfig)
attackData.Configs.SingleOrDefault(x=>x.ActionType == ActionType);
}
@@ -31,15 +32,13 @@ namespace Code.OfficeGame.BattleMode.Actions.Attacks
var entityAnimator = entity.animator;
// TODO Root Motion не должен быть использован в нормальных анимациях
entityAnimator.Play(EntryStateHash, 0, 0f); // Создать None State и кинуть эту штуку туда
entityAnimator.Update(0f);
entityAnimator.applyRootMotion = false;
entityAnimator.transform.localPosition = Vector3.zero;
entityAnimator.transform.localRotation = Quaternion.identity;
entityAnimator.applyRootMotion = true;
entityAnimator.Play(_attackData.StateHash, 0, 0f);
entityAnimator.Update(0f);
entityAnimator.ResetAnimatorPosition();
entityAnimator.applyRootMotion = true;
}
actionData.CurrentFrame++;
@@ -58,9 +57,7 @@ namespace Code.OfficeGame.BattleMode.Actions.Attacks
entityAnimator.Update(0f);
// TODO С нормальными анимациями не нужен будет рут моушен√
entityAnimator.applyRootMotion = false;
entityAnimator.transform.localPosition = Vector3.zero;
entityAnimator.transform.localRotation = Quaternion.identity;
entityAnimator.ResetAnimatorPosition();
return true;
}
@@ -78,10 +75,16 @@ namespace Code.OfficeGame.BattleMode.Actions.Attacks
{
var originEntityId = enemyCollider.GetComponentInParent<EntityProperties>().GetEntityId();
var actionData = new StuggerActionData { TotalFrames = _attackData.StuggerFrames};
var actionData = new StuggerActionData { TotalFrames = _attackData.StuggerFrames, CurrentFrame = 0};
var decisionResult = new AsIsBattleActionDeciderResult {ActionType = BattleActionType.Stugger};
BattleTimeline.ForceDecideAction(originEntityId, actionData, decisionResult);
_particleService.EmitOneShot(
new ParticlePartitionIDPair(ParticlePartition.HitParticles, 0),
15,
enemyCollider.transform.position,
Quaternion.identity);
}
}
}
@@ -1,7 +1,6 @@
using System.Linq;
using Code.Infrastructure.Utils;
using Code.OfficeGame.BattleMode.Actions.Deciders;
using Reflex.Attributes;
using UnityEngine;
namespace Code.OfficeGame.BattleMode.Actions
@@ -1,15 +1,32 @@
using Code.Infrastructure.Utils;
using Code.OfficeGame.BattleMode.Actions.Deciders;
using UnityEngine;
namespace Code.OfficeGame.BattleMode.Actions
{
public class BattleActionWait : BattleAction
{
private int EntryStateHash => Animator.StringToHash("WalkBlend");
public override bool Tick(float tickDelta,
EntityProperties entity,
BattleActionDecisionResult battleActionDecisionResult,
BattleActionData battleActionData)
{
var waitActionData = (WaitBattleActionData) battleActionData;
if (battleActionData is not WaitBattleActionData waitActionData) return true;
if (!waitActionData.StartedWaiting)
{
waitActionData.StartedWaiting = true;
var entityAnimator = entity.animator;
entityAnimator.Play(EntryStateHash, 0, 0f); // Создать None State и кинуть эту штуку туда
entityAnimator.Update(0f);
// TODO С нормальными анимациями не нужен будет рут моушен√
entityAnimator.ResetAnimatorPosition();
}
waitActionData.WaitFrames--;
if (waitActionData.WaitFrames <= 0) return true;
@@ -6,6 +6,7 @@ using Code.Infrastructure.App;
using Code.Infrastructure.Camera;
using Code.Infrastructure.Generators;
using Code.Infrastructure.Input;
using Code.Infrastructure.Particles;
using Code.Infrastructure.SceneLoader;
using Code.Infrastructure.UI;
using Code.Infrastructure.Utils;
@@ -79,7 +80,8 @@ namespace Code.Game.OfficeGame.GameStates
await UniTask.WhenAll(
attackActionsConfigs.LoadConfigs(),
playerDecisionMarkerConfig.LoadConfig());
playerDecisionMarkerConfig.LoadConfig(),
Context.ParticleLoader.LoadParticleSystems(ParticlePartition.HitParticles));
BattleActionDecisionPanel battleActionDecisionPanel =
(BattleActionDecisionPanel)await Context.UIFactory
@@ -194,6 +196,8 @@ namespace Code.Game.OfficeGame.GameStates
entity.animator.enabled = false;
}
Context.ParticleLoader.ReleaseParticles(ParticlePartition.HitParticles);
await Context.SceneLoader.UnloadSceneAsync(SceneId.Battle);
}
@@ -11,7 +11,6 @@ namespace Code.OfficeGame.BattleMode.HitBoxes
private LayerMask _hitBoxLayerMask;
private readonly Collider[] _hitResults = new Collider[8];
private readonly HashSet<GameObject> _alreadyHitTargets = new();
private void Awake()
{
@@ -27,7 +26,6 @@ namespace Code.OfficeGame.BattleMode.HitBoxes
BoxCollider box = bodyParts[hitBoxPartType];
Transform boxTransform = box.transform;
// Вычисляем точный мировой центр и размер коллайдера на кости в текущем кадре анимации
Vector3 worldCenter = boxTransform.TransformPoint(box.center);
Vector3 worldHalfExtents = Vector3.Scale(box.size * 0.5f, boxTransform.lossyScale);
@@ -43,14 +41,11 @@ namespace Code.OfficeGame.BattleMode.HitBoxes
{
Collider hitCol = _hitResults[i];
// Игнорируем самого себя
Debug.Log($"Попадание по {hitCol.name}");
if (hitCol.transform.root == transform.root) continue;
// Если за этот взмах мы ещё не били этого врага — засчитываем попадание!
if (_alreadyHitTargets.Add(hitCol.gameObject))
{
onNewTargetHit?.Invoke(hitCol);
}
onNewTargetHit?.Invoke(hitCol);
}
}
}
@@ -160,8 +160,8 @@ namespace Code.OfficeGame.BattleMode.Timeline
if (!_actionDecisionResults.TryAdd(entityId, actionDecisionResult))
{
actionChanged = actionDecisionResult.ActionType !=
_actionDecisionResults[entityId].ActionType;
actionChanged = actionDecisionResult != _actionDecisionResults[entityId];
if(actionChanged)
_actionDecisionResults[entityId] = actionDecisionResult;
else