using ET.EventType; using ET; using System; using System.Collections.Generic; using UnityEngine; namespace ET { public class OnCreateUnitEvent : AEvent { public override async ETTask Run(OnCreateUnit args) { Unit unit = args.unit; var zoneScene = args.zoneScene; GameObject go = (await ResourceViewHelper.LoadPrefabAsync(args.prefabId)).gameObject; unit.AddComponent(go); unit.AddComponent(); HudComponent.Instance.Init(unit); if (unit.UnitType == UnitType.Player || unit.UnitType == UnitType.TeamMember || unit.UnitType == UnitType.OtherPlayer ) { unit.AddComponent(); } if (unit.Id == zoneScene.GetComponent().MyId) { unit.AddComponent(-15, 15); } await ETTask.CompletedTask; } } }