【战争黑夜】加载完场景之后初始化一次显影状态
parent
d1d6e98b3b
commit
f71a3cf75e
|
|
@ -404,8 +404,20 @@ namespace Gameplay.Level
|
|||
var enableBlackArea = _currLevelInfo.Cfg.LevelTime == DayNightType.Night;
|
||||
BlackAreaManager.instance.Init(enableBlackArea);
|
||||
|
||||
_UpdateAllUnits();
|
||||
|
||||
InitAIStart();
|
||||
}
|
||||
|
||||
private void _UpdateAllUnits()
|
||||
{
|
||||
var units = GameUnitManager.instance.infightUnits.unitList;
|
||||
for (int i = 0; i < units.Count; i++)
|
||||
{
|
||||
var unit = units[i];
|
||||
unit.ForceUpdateBlackArea();
|
||||
}
|
||||
}
|
||||
|
||||
private async void InitAIStart()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Gameplay.Unit.Data
|
|||
switch (owner.gameunitType)
|
||||
{
|
||||
case EGameUnitType.Character:
|
||||
_activeObj = owner.Node.GameObject.transform.GetChild(0).GetChild(1).gameObject;
|
||||
_FindCharacterData();
|
||||
break;
|
||||
case EGameUnitType.Vehicle:
|
||||
_activeObj = owner.Node.GameObject.transform.GetChild(0).gameObject;
|
||||
|
|
@ -34,6 +34,20 @@ namespace Gameplay.Unit.Data
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void _FindCharacterData()
|
||||
{
|
||||
var parentTrans = owner.Node.GameObject.transform.GetChild(0);
|
||||
for (int i = 0; i < parentTrans.childCount; i++)
|
||||
{
|
||||
var child = parentTrans.GetChild(i);
|
||||
if (child.name.StartsWith("CombineObj_"))
|
||||
{
|
||||
_activeObj = child.gameObject;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetShow(bool setShow)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -146,8 +146,10 @@ namespace Gameplay.Unit
|
|||
public void Ready()
|
||||
{
|
||||
Node.GameObject.SetActive(true);
|
||||
_OnReady();
|
||||
viewData = new UnitViewData(this);
|
||||
|
||||
_OnReady();
|
||||
|
||||
EventManager.Instance.Send(EventManager.EventName.LevelUnitBorn, this);
|
||||
}
|
||||
|
||||
|
|
@ -161,8 +163,6 @@ namespace Gameplay.Unit
|
|||
/// </summary>
|
||||
public void EnterBattle()
|
||||
{
|
||||
viewData = new UnitViewData(this);
|
||||
|
||||
_OnEnterBattle();
|
||||
|
||||
EventManager.Instance.Send(EventManager.EventName.INFIGHT_UNIT_READY, this);
|
||||
|
|
@ -218,6 +218,11 @@ namespace Gameplay.Unit
|
|||
_UpdateBlackArea();
|
||||
}
|
||||
|
||||
public void ForceUpdateBlackArea()
|
||||
{
|
||||
_UpdateBlackArea();
|
||||
}
|
||||
|
||||
private void _UpdateBlackArea()
|
||||
{
|
||||
if (commonData.troopId == ETroopsId.Self)
|
||||
|
|
|
|||
Loading…
Reference in New Issue