using System;
using System.Collections.Generic;
using UnityEngine;

public class BGPrefabLink : PartsMgrBase
{
	protected override void Start()
	{
		base.Start();
		base.IsActive = true;
	}

	public override void StartAction()
	{
		if (!this.m_GimicSetting.Gimic)
		{
			Debug.LogError("BGPrefabLink:大元のギミックが設定されてません");
			return;
		}
		foreach (string text in this.m_GimicSetting.PrefabName)
		{
			GameObject prefabFromBg = GameMain.Instance.BgMgr.GetPrefabFromBg(text);
			if (!prefabFromBg)
			{
				Debug.LogErrorFormat("現在の背景に{0}は存在しません", new object[]
				{
					text
				});
			}
			else
			{
				prefabFromBg.transform.SetParent(this.m_GimicSetting.Gimic.transform, this.m_IsworldStay);
			}
		}
	}

	[SerializeField]
	private BGPrefabLink.GimicData m_GimicSetting;

	[SerializeField]
	[Header("位置・回転をそのままにしておくか")]
	private bool m_IsworldStay = true;

	[Serializable]
	private class GimicData
	{
		[Header("大元のギミック")]
		public GameObject Gimic;

		[Header("紐付けるプレハブ名")]
		public List<string> PrefabName = new List<string>();
	}
}
