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

@@ -31,6 +31,11 @@ MonoBehaviour:
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 0ebd9c08074035d6b827f99dbd175375
m_Address: Assets/OfficeGame/Battle/Particles/HitPartilcle.prefab
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 17ec9ee292f4eeef680a3ab2d9163ba7
m_Address: Assets/OfficeGame/Testing/Testing.unity
m_ReadOnly: 0
@@ -155,6 +160,12 @@ MonoBehaviour:
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: f008c06cc2a870308a1657cecb1bf568
m_Address: Assets/OfficeGame/Battle/Particles/HitParticle.asset
m_ReadOnly: 0
m_SerializedLabels:
- Particles
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: fca3ff8b9d20369af80cdf3da2a95a6f, type: 2}
m_SchemaSet:
@@ -14,5 +14,12 @@ namespace Code.Infrastructure.Utils
{
snapshot.RestoreTo(animator);
}
public static void ResetAnimatorPosition(this Animator animator)
{
animator.applyRootMotion = false;
animator.transform.localPosition = Vector3.zero;
animator.transform.localRotation = Quaternion.identity;
}
}
}
@@ -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
@@ -2,7 +2,6 @@ namespace Code.Infrastructure.Particles
{
public enum ParticlePartition
{
ProjectileExplosions,
DestroyExplosions,
HitParticles
}
}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cc9f38e93f34422eab8f7d00488029ae
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
%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: 7b7578a949deb96ef808e8b285d8e68e, type: 3}
m_Name: HitParticle
m_EditorClassIdentifier: Assembly-CSharp::Code.Infrastructure.Particles.ParticleInfo
particleSystem:
m_AssetGUID: 0ebd9c08074035d6b827f99dbd175375
m_SubObjectName:
m_SubObjectType:
m_SubObjectGUID:
m_EditorAssetChanged: 0
particleId: 0
particlePartition: 0
CountInPool: 3
PartitionIDPair:
ParticlePartition: 0
ID: 0
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f008c06cc2a870308a1657cecb1bf568
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0ebd9c08074035d6b827f99dbd175375
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: