FututeWand初步

This commit is contained in:
SoulliesOfficial
2026-07-01 06:32:50 -04:00
parent ddd387ef35
commit 347237443f
89 changed files with 290771 additions and 1084 deletions

View File

@@ -52,6 +52,12 @@ namespace Cielonos.MainGame.Characters
}
}
protected override void InitializeSubcontrollers()
{
base.InitializeSubcontrollers();
behaviorSc?.Initialize();
}
protected override void Update()
{
base.Update();
@@ -93,9 +99,7 @@ namespace Cielonos.MainGame.Characters
return false;
}
protected virtual void UpdateGetHit()
{
_getHitTimer -= selfTimeSm.DeltaTime;

View File

@@ -1,6 +1,7 @@
using Cielonos.MainGame.Buffs.Character;
using Opsive.BehaviorDesigner.Runtime;
using SLSUtilities.General;
using UniRx;
using UnityEngine;
using UnityEngine.AI;
@@ -18,10 +19,74 @@ namespace Cielonos.MainGame.Characters
navMeshAgent.isStopped = true;
animatorMoveSpeedX = new LerpFloat(0f, 5f);
animatorMoveSpeedZ = new LerpFloat(0f, 5f);
//owner.selfTimeSm.timeScaleObservable.Subscribe(OnTimeScaleChanged).AddTo(owner);
}
private Vector3 lastDirection;
// ────────────────────────────────────────────────────────────────────
// Time Scale Sync
// ────────────────────────────────────────────────────────────────────
private float unscaledNavSpeed;
private float unscaledNavAccel;
private float unscaledNavAngularSpeed;
private bool wasNavStoppedBeforePause;
private float lastTimeScale = -1f;
private bool isTimePaused = false;
private void OnTimeScaleChanged(float timeScale)
{
if (navMeshAgent == null || !navMeshAgent.enabled)
{
if (timeScale == 0f && !isTimePaused)
{
isTimePaused = true;
}
else if (timeScale > 0f && isTimePaused)
{
isTimePaused = false;
}
lastTimeScale = timeScale;
return;
}
if (timeScale == 0f)
{
if (!isTimePaused)
{
isTimePaused = true;
wasNavStoppedBeforePause = navMeshAgent.isStopped;
navMeshAgent.isStopped = true;
}
else
{
navMeshAgent.isStopped = true;
}
}
else
{
if (isTimePaused)
{
isTimePaused = false;
navMeshAgent.isStopped = wasNavStoppedBeforePause;
}
if (Mathf.Abs(navMeshAgent.speed - (unscaledNavSpeed * timeScale)) > 0.01f)
{
unscaledNavSpeed = navMeshAgent.speed;
unscaledNavAccel = navMeshAgent.acceleration;
unscaledNavAngularSpeed = navMeshAgent.angularSpeed;
}
navMeshAgent.speed = unscaledNavSpeed * timeScale;
navMeshAgent.acceleration = unscaledNavAccel * timeScale;
navMeshAgent.angularSpeed = unscaledNavAngularSpeed * timeScale;
}
lastTimeScale = timeScale;
}
protected override void Update()
{
base.Update();

View File

@@ -2,6 +2,8 @@ using System.Collections.Generic;
using Opsive.BehaviorDesigner.Runtime;
using UnityEngine;
using UnityEngine.AI;
using UniRx;
using Cielonos.MainGame.Buffs.Character;
namespace Cielonos.MainGame.Characters
{
@@ -13,6 +15,37 @@ namespace Cielonos.MainGame.Characters
public NavMeshAgent navMeshAgent;
public Dictionary<string, Subtree> subBehaviorTrees;
private System.IDisposable timeScaleDisposable;
private bool isTimePaused = false;
public override void Initialize()
{
base.Initialize();
owner.selfTimeSm.timeScaleObservable.Subscribe(OnTimeScaleChanged).AddTo(owner);
}
private void OnTimeScaleChanged(float timeScale)
{
if (mainBehaviorTree == null) return;
if (timeScale == 0f)
{
if (!isTimePaused)
{
isTimePaused = true;
mainBehaviorTree.StopBehavior(true);
}
}
else
{
if (isTimePaused)
{
isTimePaused = false;
mainBehaviorTree.StartBehavior();
}
}
}
public class AutomataEvent
{
public float Timestamp;