AfterUnitCreate_CreateUnitView.cs 673 B

1234567891011121314151617181920
  1. using UnityEngine;
  2. namespace ET
  3. {
  4. [Event(EventIdType.AfterUnitCreate)]
  5. public class AfterUnitCreate_CreateUnitView: AEvent<Unit>
  6. {
  7. public override void Run(Unit unit)
  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. unit.AddComponent<AnimatorComponent>();
  15. }
  16. }
  17. }