AfterUnitCreate_CreateUnitView.cs 691 B

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