CharacterSystemModule.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using KairoEngine.Core.ModuleSystem;
  5. using Sirenix.OdinInspector;
  6. namespace KairoEngine.CharacterSystem
  7. {
  8. public class CharacterSystemModule : IGameModule
  9. {
  10. private string _name = "Character System Module";
  11. public string name { get => _name; set => _name = value; }
  12. public GameObject characterGenerator;
  13. public GameObject characterManager;
  14. public void Load(Transform parent)
  15. {
  16. if(characterGenerator == null)
  17. {
  18. Debug.LogError($"Character Generator is missing in {_name}.");
  19. return;
  20. }
  21. GameObject obj1 = GameObject.Instantiate(characterGenerator, parent);
  22. obj1.name = obj1.name.Replace("(Clone)", "");
  23. if(characterManager == null)
  24. {
  25. Debug.LogError($"Character Manager is missing in {_name}.");
  26. return;
  27. }
  28. GameObject obj2 = GameObject.Instantiate(characterManager, parent);
  29. obj2.name = obj2.name.Replace("(Clone)", "");
  30. Debug.Log($"Loaded {_name}");
  31. }
  32. public void Reset()
  33. {
  34. characterGenerator = null;
  35. characterManager = null;
  36. }
  37. public void Destroy()
  38. {
  39. }
  40. }
  41. }