修改战斗规则
parent
226294cca7
commit
b1fe9f6635
|
|
@ -2,7 +2,7 @@ namespace Framework
|
|||
{
|
||||
public class GUIDManager
|
||||
{
|
||||
private static uint _guid = 0;
|
||||
private static uint _guid = 100;
|
||||
public static uint GenGuid()
|
||||
{
|
||||
return ++_guid;
|
||||
|
|
|
|||
|
|
@ -13,15 +13,6 @@ namespace Gameplay.Character
|
|||
private readonly List<Character> _characterList = new List<Character>();
|
||||
private readonly Dictionary<int, Troops> _troopDict = new Dictionary<int, Troops>();
|
||||
|
||||
public void UpdateTargets()
|
||||
{
|
||||
for (int i = 0; i < _characterList.Count; i++)
|
||||
{
|
||||
var character = _characterList[i];
|
||||
character.UpdateTargets();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (var charactor in _characterList)
|
||||
|
|
|
|||
|
|
@ -146,7 +146,6 @@ namespace Gameplay.Level
|
|||
AIManager.Instance.Init();
|
||||
|
||||
GameUnitManager.CreateInstance();
|
||||
VehicleManager.CreateInstance();
|
||||
GameUnitMapper.CreateInstance();
|
||||
|
||||
SkillManager.CreateInstance();
|
||||
|
|
@ -157,7 +156,6 @@ namespace Gameplay.Level
|
|||
public void Release()
|
||||
{
|
||||
EmojiManager.inst.Dispose();
|
||||
VehicleManager.Inst.Dispose();
|
||||
GameUnitMapper.Inst.Dispose();
|
||||
|
||||
SkillManager.instance.Dispose();
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ namespace Gameplay.Level
|
|||
SkillManager.instance.LogicUpdate(deltaTime);
|
||||
BulletManager.instance.LogicUpdate(deltaTime);
|
||||
BuffManager.instance.LogicUpdate(deltaTime);
|
||||
GameUnitManager.instance.LogicUpdate(deltaTime);
|
||||
SummonManager.instance.LogicUpdate(deltaTime);
|
||||
VehicleManager.Inst.LogicUpdate(deltaTime);
|
||||
AreaManager.instance.LogicUpdate(deltaTime);
|
||||
PauseManager.instance.LogicUpdate(deltaTime);
|
||||
TireMarkManager.instance.LogicUpdate(deltaTime);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ namespace Gameplay.Level
|
|||
|
||||
protected override void _OnUpdate(float deltaTime)
|
||||
{
|
||||
VehicleManager.Inst.PreviewUpdate(deltaTime);
|
||||
}
|
||||
|
||||
protected override void _OnExit()
|
||||
|
|
|
|||
|
|
@ -5,13 +5,9 @@ using Cysharp.Threading.Tasks;
|
|||
using UnityEngine;
|
||||
using Framework;
|
||||
using Gameplay;
|
||||
using Gameplay.Character;
|
||||
using Gameplay.Common;
|
||||
using Gameplay.Level;
|
||||
using Gameplay.Unit;
|
||||
using Gameplay.Unit.Data;
|
||||
using Gameplay.Vehicle;
|
||||
using Gameplay.Vehicle.Impl;
|
||||
using PhxhSDK;
|
||||
using Constants = Framework.Constants;
|
||||
using EventManager = Framework.EventManager;
|
||||
|
|
|
|||
|
|
@ -52,14 +52,14 @@ namespace Gameplay.Unit.Data
|
|||
{
|
||||
return unit;
|
||||
}
|
||||
DebugUtil.LogError("不存在相同guid的单位:{0}", guid);
|
||||
DebugUtil.LogError("不存在指定guid的单位:{0}", guid);
|
||||
return null;
|
||||
}
|
||||
|
||||
public GameUnit GetByIndex(int index)
|
||||
{
|
||||
if (index < 0 || index >= _unitList.Count) {
|
||||
DebugUtil.LogError("不存在相同index的单位:{0}", index);
|
||||
DebugUtil.LogError("不存在指定index的单位:{0}", index);
|
||||
return null;
|
||||
}
|
||||
return _unitList[index];
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Framework;
|
||||
using Gameplay.Character;
|
||||
using Gameplay.Character.Utils;
|
||||
using Gameplay.Level;
|
||||
using Gameplay.Unit.Data;
|
||||
using Gameplay.Vehicle;
|
||||
using Gameplay.Vehicle.Impl;
|
||||
namespace Gameplay.Unit
|
||||
{
|
||||
|
|
@ -34,6 +34,7 @@ namespace Gameplay.Unit
|
|||
public UnitContainer totalUnits = new UnitContainer();
|
||||
|
||||
public CharacterManager characterManager;
|
||||
public VehicleManager vehicleManager;
|
||||
|
||||
private bool _needUpdateTargets;
|
||||
|
||||
|
|
@ -48,6 +49,7 @@ namespace Gameplay.Unit
|
|||
private GameUnitManager()
|
||||
{
|
||||
characterManager = new CharacterManager();
|
||||
vehicleManager = new VehicleManager();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
|
|
@ -212,6 +214,7 @@ namespace Gameplay.Unit
|
|||
for (int i = 0; i < infightUnits.count; i++)
|
||||
{
|
||||
var unit = infightUnits.GetByIndex(i);
|
||||
|
||||
unit.LogicUpdate(dt);
|
||||
|
||||
if (unit.needRemove)
|
||||
|
|
@ -227,7 +230,21 @@ namespace Gameplay.Unit
|
|||
|
||||
private void _UpdateTargets()
|
||||
{
|
||||
characterManager.UpdateTargets();
|
||||
for (int i = 0; i < infightUnits.count; i++)
|
||||
{
|
||||
var unit = infightUnits.GetByIndex(i);
|
||||
switch (unit.gameunitType)
|
||||
{
|
||||
case EGameUnitType.Character:
|
||||
if (unit is Character.Character character)
|
||||
character.UpdateTargets();
|
||||
break;
|
||||
case EGameUnitType.Vehicle:
|
||||
if (unit is NormalVehicle vehicle)
|
||||
vehicle.UpdateTargets();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
|
|
@ -54,16 +54,6 @@ namespace Gameplay.Vehicle
|
|||
|
||||
PerformanceManager.instance.HandleCreateUnit(obj);
|
||||
}
|
||||
|
||||
public void LogicUpdate(float dt)
|
||||
{
|
||||
_OnLogicUpdate(dt);
|
||||
}
|
||||
|
||||
protected virtual void _OnLogicUpdate(float dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,12 @@ namespace Gameplay.Vehicle.Impl
|
|||
|
||||
protected override void _OnLogicUpdate(float dt)
|
||||
{
|
||||
|
||||
if (SkillManager.instance.needSkillPaused && SkillManager.instance.skillingUnit != this)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!statusData.isDead)
|
||||
{
|
||||
battery.LogicUpdate(dt);
|
||||
|
|
@ -188,8 +194,6 @@ namespace Gameplay.Vehicle.Impl
|
|||
transData.Reset();
|
||||
|
||||
vAnim.ViewUpdate(dt);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public bool CheckCanUp(GameUnit unit)
|
||||
|
|
|
|||
|
|
@ -1,86 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
using Gameplay.Skill;
|
||||
using Gameplay.Vehicle.Impl;
|
||||
namespace Gameplay.Vehicle
|
||||
namespace Gameplay.Vehicle
|
||||
{
|
||||
public class VehicleManager
|
||||
{
|
||||
|
||||
private static VehicleManager _instance;
|
||||
|
||||
public static VehicleManager Inst
|
||||
{
|
||||
get
|
||||
{
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static VehicleManager CreateInstance()
|
||||
{
|
||||
if (_instance != null)
|
||||
{
|
||||
DebugUtil.LogError("请勿重复创建VehicleManager");
|
||||
return _instance;
|
||||
}
|
||||
_instance = new VehicleManager();
|
||||
return _instance;
|
||||
}
|
||||
|
||||
private readonly List<PreviewVehicle> _preCreateVehicles = new List<PreviewVehicle>();
|
||||
private readonly List<NormalVehicle> _vehicles = new List<NormalVehicle>();
|
||||
|
||||
private VehicleManager()
|
||||
public VehicleManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void _AddVehicle(NormalVehicle vehicle)
|
||||
{
|
||||
_vehicles.Add(vehicle);
|
||||
}
|
||||
|
||||
public void UpdateTargets()
|
||||
{
|
||||
for (int i = 0; i < _vehicles.Count; i++)
|
||||
{
|
||||
var vehicle = _vehicles[i];
|
||||
if (SkillManager.instance.needSkillPaused && SkillManager.instance.skillingUnit != vehicle)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
vehicle.UpdateTargets();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_instance = null;
|
||||
}
|
||||
|
||||
public void PreviewUpdate(float dt)
|
||||
{
|
||||
for (int i = 0; i < _preCreateVehicles.Count; i++)
|
||||
{
|
||||
var vehicle = _preCreateVehicles[i];
|
||||
vehicle.PreviewUpdate(dt);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogicUpdate(float dt)
|
||||
{
|
||||
for (int i = 0; i < _vehicles.Count; i++)
|
||||
{
|
||||
var vehicle = _vehicles[i];
|
||||
|
||||
if (SkillManager.instance.needSkillPaused && SkillManager.instance.skillingUnit != vehicle)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
vehicle.LogicUpdate(dt);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue