using System.Collections; using System.Collections.Generic; using UnityEngine; public class HoldPassive : ResourcePool { public HoldPassiveItem prefabItem; public List target; MapManager map; public void OnInitialized(MapManager mapManager) { if (map == null) { map = mapManager; map.player.character.skill.OnChangedInstall = OnChanged; } } [Space(10)] public List passives = new List(); void OnChanged(List items) { items = items.FindAll(a => a.type.Equals("Passive")); HoldPassiveItem item = null; for (int i = 0; i < items.Count; i++) { if (passives.Count <= i) { item = ObjectCreateLocalPos(prefabItem.gameObject, i % 2 == 0 ? target[0] : target[1], Vector3.one, Vector3.zero).GetComponent(); passives.Add(item); } else item = passives[i]; item.Setting(items[i]); } } }