Preview improvements. StillBug
This commit is contained in:
1 parent
f927552adc
commit
3678d039e3
161 files changed
+34009
-61541
No files matched your search
@@ -5,19 +5,29 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
{
|
||||
public class EntityPreviewVisuals : MonoBehaviour
|
||||
{
|
||||
public const int MaxGhostStages = 5; // 0 = Commit + до 4 прерываний
|
||||
public const int MaxGhostStages = 14; // 0 = Commit + до 4 прерываний
|
||||
|
||||
[Header("Материалы MKToon")]
|
||||
[SerializeField] private Material snapshotGhostMaterial;
|
||||
[SerializeField] private Material activePreviewMaterial;
|
||||
|
||||
[Header("Цвета проекции по стадиям прерываний")]
|
||||
[SerializeField] private Color[] stageProjectionTints =
|
||||
private Color[] stageProjectionTints =
|
||||
{
|
||||
new(0.55f, 0.85f, 1.0f, 1f), // Stage 0: до первого прерывания (голубой)
|
||||
new(1.0f, 0.85f, 0.35f, 1f), // Stage 1: после 1-го прерывания (жёлтый)
|
||||
new(1.0f, 0.55f, 0.25f, 1f), // Stage 2: после 2-го прерывания (оранжевый)
|
||||
new(0.95f, 0.3f, 0.5f, 1f), // Stage 3+: 3+ прерываний (малиновый)
|
||||
new(0f, 0.25f, 0.55f, 1f), // Глубокий синий (Ocean Blue)
|
||||
new(0.15f, 0.55f, 0.9f, 1f), // Ярко-синий (Azure)
|
||||
new(0.55f, 0.85f, 1.0f, 1f), // Небесно-голубой (Sky Blue)
|
||||
new(0.1f, 0.8f, 0.75f, 1f), // Бирюзовый (Turquoise)
|
||||
new(0.1f, 0.8f, 0.5f, 1f), // Изумрудный (Emerald)
|
||||
new(0.45f, 0.85f, 0.25f, 1f), // Салатовый (Lime Green)
|
||||
new(1.0f, 0.85f, 0.35f, 1f), // Тёплый жёлтый (Warm Yellow)
|
||||
new(1.0f, 0.7f, 0.2f, 1f), // Янтарный (Amber)
|
||||
new(1.0f, 0.55f, 0.25f, 1f), // Оранжевый (Orange)
|
||||
new(0.95f, 0.3f, 0.3f, 1f), // Кораллово-красный (Coral Red)
|
||||
new(0.95f, 0.3f, 0.5f, 1f), // Малиново-розовый (Crimson Pink)
|
||||
new(0.8f, 0.35f, 0.85f, 1f), // Орхидея / Маджента (Orchid)
|
||||
new(0.5f, 0.3f, 0.9f, 1f), // Фиолетовый (Violet)
|
||||
new(1f, 1f, 1f, 1f), // Чистый белый (White)
|
||||
};
|
||||
|
||||
[Header("Цвета статичных слепков")]
|
||||
@@ -225,6 +235,7 @@ namespace Code.OfficeGame.BattleMode.Actions
|
||||
{
|
||||
Color c = stageProjectionTints[Mathf.Clamp(stage, 0, stageProjectionTints.Length - 1)];
|
||||
if (alphaOverride.HasValue) c.a = alphaOverride.Value;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb857a2eae284b31b2eb19ac4abfcaa7
|
||||
timeCreated: 1793141973
|
||||
@@ -1,105 +0,0 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Code.Game.Gameplay.Player;
|
||||
using Code.OfficeGame.BattleMode.Timeline;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using KinematicCharacterController;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Code.OfficeGame.BattleMode.Actions.HoloCopy
|
||||
{
|
||||
public class HoloCop : MonoBehaviour
|
||||
{
|
||||
private static readonly int VelocityForward = Animator.StringToHash("VelocityForward");
|
||||
|
||||
private Func<HoloCop, float, bool> _action;
|
||||
|
||||
[SerializeField] private MovementController movementController;
|
||||
[SerializeField] private KinematicCharacterMotor motor;
|
||||
[SerializeField] private KinematicCharacterMotor originMotor;
|
||||
[SerializeField] private Animator animator;
|
||||
[SerializeField] private Animator originAnimator;
|
||||
|
||||
public MovementController Controller => movementController;
|
||||
public Animator Animator => animator;
|
||||
|
||||
private Vector3 _initialMotorPosition;
|
||||
private Quaternion _initialMotorRotation;
|
||||
|
||||
private int _initialAnimationState;
|
||||
private float _initialNormalizedTime;
|
||||
|
||||
private void Snapshot()
|
||||
{
|
||||
_initialMotorPosition = originMotor.TransientPosition;
|
||||
_initialMotorRotation = originMotor.TransientRotation;
|
||||
|
||||
AnimatorStateInfo stateInfo = originAnimator.GetCurrentAnimatorStateInfo(0);
|
||||
_initialAnimationState = stateInfo.shortNameHash;
|
||||
_initialNormalizedTime = stateInfo.normalizedTime;
|
||||
|
||||
animator.SetFloat(VelocityForward, originAnimator.GetFloat(VelocityForward));
|
||||
|
||||
animator.Play(_initialAnimationState, 0, _initialNormalizedTime);
|
||||
animator.Update(0f);
|
||||
}
|
||||
|
||||
private void ReturnToSnapshot()
|
||||
{
|
||||
bool prevRootMotion = animator.applyRootMotion;
|
||||
|
||||
animator.Play(_initialAnimationState, 0, _initialNormalizedTime);
|
||||
animator.Update(0f);
|
||||
|
||||
animator.transform.localPosition = Vector3.zero;
|
||||
animator.transform.localRotation = Quaternion.identity;
|
||||
|
||||
originMotor.SetPositionAndRotation(_initialMotorPosition, _initialMotorRotation);
|
||||
|
||||
Physics.SyncTransforms();
|
||||
}
|
||||
|
||||
public async UniTask Simulate(Func<HoloCop, float, bool> action, CancellationToken ctx)
|
||||
{
|
||||
_action = action;
|
||||
float accumulator = 0f;
|
||||
|
||||
Snapshot();
|
||||
|
||||
try
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
|
||||
while (!ctx.IsCancellationRequested)
|
||||
{
|
||||
await UniTask.Yield(PlayerLoopTiming.Update, ctx);
|
||||
|
||||
accumulator += Time.unscaledDeltaTime;
|
||||
|
||||
while (accumulator >= BattleTimeline.TickDelta)
|
||||
{
|
||||
accumulator -= BattleTimeline.TickDelta;
|
||||
|
||||
if (_action == null) return;
|
||||
|
||||
bool result = _action(this, BattleTimeline.TickDelta);
|
||||
|
||||
animator.Update(BattleTimeline.TickDelta);
|
||||
|
||||
Physics.Simulate(BattleTimeline.TickDelta);
|
||||
Physics.SyncTransforms();
|
||||
|
||||
if (result) ReturnToSnapshot();
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ReturnToSnapshot();
|
||||
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4067e559c4d4556a335b4c507f9702f
|
||||
timeCreated: 1793142036
|
||||
Reference in new issue
Block a user