AfterUnitCreate_CreateUnitView.cs 687 B

12345678910111213141516171819
  1. using UnityEngine;
  2. namespace ET
  3. {
  4. public class AfterUnitCreate_CreateUnitView: AEvent<EventType.AfterUnitCreate>
  5. {
  6. public override async ETTask Run(EventType.AfterUnitCreate args)
  7. {
  8. // Unit View层
  9. ResourcesComponent resourcesComponent = Game.Scene.GetComponent<ResourcesComponent>();
  10. GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset("Unit.unity3d", "Unit");
  11. GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton");
  12. GameObject go = UnityEngine.Object.Instantiate(prefab);
  13. args.Unit.AddComponent<AnimatorComponent>();
  14. }
  15. }
  16. }