MusicBeat
This commit is contained in:
@@ -48,7 +48,7 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
foreach (KeyValuePair<string, float> timer in timerData.timers)
|
||||
{
|
||||
selfTimeSm.coolDownTimers[timer.Key] = new Timer(timer.Value);
|
||||
selfTimeSm.coolDownTimers[timer.Key] = new CooldownTimer(timer.Value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Cielonos.MainGame.Characters
|
||||
eventSm.onDeath.Invoke();
|
||||
|
||||
CombatManager.CoordinatorSm.ReleaseAll(this);
|
||||
CombatManager.EnemySm.RemoveEnemy(this);
|
||||
|
||||
float deathProcessTime = 0f;
|
||||
var deathFuncAnim = fullBodyFuncAnims.animDataList.Find(data => data.animInfo.animationName == "Death");
|
||||
if (deathFuncAnim != null)
|
||||
|
||||
@@ -22,6 +22,16 @@ namespace Cielonos.MainGame.Characters
|
||||
base.InitializeSubcontrollers();
|
||||
reactionSc.InitializeResistances(enemyRank);
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
if (fraction == Fraction.Enemy)
|
||||
{
|
||||
CombatManager.EnemySm.activeEnemiesList.Add(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Enemy
|
||||
@@ -36,6 +46,7 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
|
||||
base.Die();
|
||||
CombatManager.EnemySm.RemoveEnemy(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,10 +63,7 @@ namespace Cielonos.MainGame.Characters
|
||||
{
|
||||
selfTimeSm?.SetUp(this);
|
||||
|
||||
if (fraction == Fraction.Enemy)
|
||||
{
|
||||
CombatManager.EnemySm.activeEnemiesList.Add(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Cielonos.MainGame.Characters
|
||||
private float enemyTimeScale => timeManager.enemyTimeScale.Value;
|
||||
private float nonPlayerTimeScale => timeManager.nonPlayerTimeScale.Value;
|
||||
|
||||
public Dictionary<string, Timer> coolDownTimers = new Dictionary<string, Timer>();
|
||||
public Dictionary<string, CooldownTimer> coolDownTimers = new Dictionary<string, CooldownTimer>();
|
||||
|
||||
public float TimeScale => owner.fraction switch
|
||||
{
|
||||
@@ -265,34 +265,20 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
}
|
||||
|
||||
public class Timer
|
||||
public class CooldownTimer : Timer
|
||||
{
|
||||
public float originalDuration; // 可选:记录最初设置的持续时间,方便重置时使用
|
||||
public float duration;
|
||||
public float currentTime;
|
||||
public float Percentage => duration > 0 ? Mathf.Clamp01(currentTime / duration) : 1f;
|
||||
public bool IsCompleted => currentTime >= duration;
|
||||
|
||||
public Timer(float duration)
|
||||
public CooldownTimer(float duration) : base(duration)
|
||||
{
|
||||
this.originalDuration = duration;
|
||||
this.duration = duration;
|
||||
this.currentTime = 0f;
|
||||
}
|
||||
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
if (!IsCompleted)
|
||||
{
|
||||
currentTime += deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置计时器,可以选择新的持续时间(如果不提供则使用原始持续时间)
|
||||
/// </summary>
|
||||
/// <param name="newDuration"></param>
|
||||
public void Reset(float newDuration = -1f)
|
||||
public override void Reset(float newDuration = -1f)
|
||||
{
|
||||
currentTime = 0f;
|
||||
duration = newDuration >= 0f ? newDuration : originalDuration;
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
|
||||
SetupDash(inputDirection, true, length);
|
||||
//player.vfxData.SpawnVFX("PerfectDodgeLine", player, player.bodyPartsSc.head);
|
||||
};
|
||||
player.operationSc.OnDodge += (length)=>
|
||||
{
|
||||
@@ -40,6 +41,7 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
|
||||
SetupDodge(length);
|
||||
//player.vfxData.SpawnVFX("PerfectDodgeLine", player, player.bodyPartsSc.head);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -26,14 +26,17 @@ namespace Cielonos.MainGame.Characters
|
||||
RegisterOperations();
|
||||
backpackSm ??= new BackpackSubmodule(this);
|
||||
equipmentSm ??= new EquipmentSubmodule(this);
|
||||
|
||||
|
||||
backpackSm.ObtainItem<FutureWand>();
|
||||
backpackSm.ObtainItem<Polychrome>();
|
||||
//backpackSm.ObtainItem<DualHarmony>();
|
||||
backpackSm.ObtainItem<FutureWand>();
|
||||
backpackSm.ObtainItem<Ascension>();
|
||||
backpackSm.ObtainItem<BellowsThruster>();
|
||||
backpackSm.ObtainItem<BlackHoleDisplacer>();
|
||||
backpackSm.ObtainItem<DecayPropagator>();
|
||||
backpackSm.ObtainItem<QuantumShieldGenerator>();
|
||||
backpackSm.ObtainItem<DecayAccelerationCoil>();
|
||||
backpackSm.ObtainItem<FusionInjector>();
|
||||
backpackSm.ObtainItem<MissileSeparationMembrane>();
|
||||
|
||||
foreach (MainWeaponBase mainWeapon in backpackSm.mainWeapons)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Cielonos.MainGame.Characters
|
||||
public bool isDuringCameraSwitch;
|
||||
private const float CameraSwitchCooldown = 0.25f;
|
||||
|
||||
public CharacterBase lockTarget;
|
||||
public Enemy lockTarget;
|
||||
private float lastTargetSwitchTime;
|
||||
private const float TargetSwitchCooldown = 0.25f;
|
||||
public Transform targetPoint;
|
||||
@@ -90,7 +90,7 @@ namespace Cielonos.MainGame.Characters
|
||||
{
|
||||
if(isDuringCameraSwitch) return;
|
||||
|
||||
CharacterBase target = CombatManager.EnemySm.GetNearestEnemy(50f);
|
||||
Enemy target = CombatManager.EnemySm.GetNearestEnemy(50f);
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
@@ -168,7 +168,7 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
if (Time.time - lastTargetSwitchTime < TargetSwitchCooldown) return;
|
||||
|
||||
List<CharacterBase> sortedEnemies = CombatManager.EnemySm.GetVisibleEnemiesSortedByScreenX();
|
||||
List<Enemy> sortedEnemies = CombatManager.EnemySm.GetVisibleEnemiesSortedByScreenX();
|
||||
if (sortedEnemies.Count <= 1) return;
|
||||
|
||||
int currentIndex = sortedEnemies.IndexOf(lockTarget);
|
||||
@@ -198,7 +198,7 @@ namespace Cielonos.MainGame.Characters
|
||||
SetNewTarget(sortedEnemies[newIndex]);
|
||||
}
|
||||
|
||||
private void SetNewTarget(CharacterBase newTarget)
|
||||
private void SetNewTarget(Enemy newTarget)
|
||||
{
|
||||
if (lockTarget != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user