Super Knight : Enter the Dungeon
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class HoldPassive : ResourcePool
|
|
|
|
|
{
|
|
|
|
|
public HoldPassiveItem prefabItem;
|
|
|
|
|
public List<Transform> target;
|
|
|
|
|
|
|
|
|
|
MapManager map;
|
|
|
|
|
public void OnInitialized(MapManager mapManager)
|
|
|
|
|
{
|
|
|
|
|
if (map == null)
|
|
|
|
|
{
|
|
|
|
|
map = mapManager;
|
|
|
|
|
map.player.character.skill.OnChangedInstall = OnChanged;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Space(10)]
|
|
|
|
|
public List<HoldPassiveItem> passives = new List<HoldPassiveItem>();
|
|
|
|
|
void OnChanged(List<ItemData> 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<HoldPassiveItem>();
|
|
|
|
|
passives.Add(item);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
item = passives[i];
|
|
|
|
|
|
|
|
|
|
item.Setting(items[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|