InstantiateCommand.cs 516 B

123456789101112131415161718192021
  1. using Blue;
  2. using UnityEngine;
  3. /// <summary>
  4. /// 实例化命令
  5. /// 添加要实例化的物体、实例化物体的内容
  6. /// </summary>
  7. public class InstantiateCommand : ICommand
  8. {
  9. private GameObject prefab;
  10. private string content;
  11. public InstantiateCommand(GameObject prefab,string content="")
  12. {
  13. this.prefab = prefab;
  14. this.content = content;
  15. }
  16. public void OnExcute()
  17. {
  18. InstantiateSystem.Instance.InstantiatePrefab(prefab, content);
  19. }
  20. }