zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/Hotfix/Logic/Behaviour/Game/Event/Battle/BattleStartEvent.cs

52 lines
1.5 KiB
C#

using ET.EventType;
using ET;
using System;
using System.Collections.Generic;
namespace ET
{
public class BattleStartEvent : AEvent_Sync<EventType.BattleStart>
{
public override void Run(BattleStart args)
{
try
{
var zoneScene = args.zoneScene;
Game.EventSystem.Publish_Sync(new ET.EventType.TranslateSceneStart
{
isAutoEnd = false
});
Game.EventSystem.Publish(new ET.EventType.StateBuffUI_Init
{
zoneScene = args.zoneScene
}).Coroutine();
Game.EventSystem.Publish_Sync(new ET.EventType.HideOthersUnit
{
zoneScene = args.zoneScene
});
Team team = args.zoneScene.GetComponent<TeamComponent>().Get(zoneScene.GetComponent<GlobalVariable>().LeaderId);
foreach (Unit unit in team.GetAll())
{
try
{
Game.EventSystem.Publish_Sync(new ET.EventType.SetHudCharacter_ChangeHp
{
unit = unit
});
}
catch (Exception e)
{
Log.Error(e);
}
}
}
catch (Exception e)
{
Log.Error(e);
}
}
}
}