BGPrefabLink.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class BGPrefabLink : PartsMgrBase
  5. {
  6. protected override void Start()
  7. {
  8. base.Start();
  9. base.IsActive = true;
  10. }
  11. public override void StartAction()
  12. {
  13. if (!this.m_GimicSetting.Gimic)
  14. {
  15. Debug.LogError("BGPrefabLink:大元のギミックが設定されてません");
  16. return;
  17. }
  18. foreach (string text in this.m_GimicSetting.PrefabName)
  19. {
  20. GameObject prefabFromBg = GameMain.Instance.BgMgr.GetPrefabFromBg(text);
  21. if (!prefabFromBg)
  22. {
  23. Debug.LogErrorFormat("現在の背景に{0}は存在しません", new object[]
  24. {
  25. text
  26. });
  27. }
  28. else
  29. {
  30. prefabFromBg.transform.SetParent(this.m_GimicSetting.Gimic.transform, this.m_IsworldStay);
  31. }
  32. }
  33. }
  34. [SerializeField]
  35. private BGPrefabLink.GimicData m_GimicSetting;
  36. [SerializeField]
  37. [Header("位置・回転をそのままにしておくか")]
  38. private bool m_IsworldStay = true;
  39. [Serializable]
  40. private class GimicData
  41. {
  42. [Header("大元のギミック")]
  43. public GameObject Gimic;
  44. [Header("紐付けるプレハブ名")]
  45. public List<string> PrefabName = new List<string>();
  46. }
  47. }