public void Equip(Relic relic, RelicSlot slot) { var previousSlot = FindContainingSlot(relic); if (previousSlot != null) { if (!slot.IsEmpty) { var temp = previousSlot.Relic; previousSlot.Equip(slot.Relic); slot.Equip(temp); return; } Unequip(relic); } if (!slot.IsEmpty) { Unequip(slot.Relic); } relic.Owner = gameObject; relic.Equip(); slot.Equip(relic); Equipped?.Invoke(this, relic); }
public void Reroll() { int newSlot = Random.Range(0, 4); int newRarity = Random.Range(0, 4); affectedStats = new AffectedStat[newRarity + 1]; values = new int[newRarity + 1]; rarity = (RelicRarity)newRarity; slot = (RelicSlot)newSlot; for (int i = 0; i < newRarity; i++) { affectedStats[i] = (AffectedStat)Random.Range(0, 7); if (affectedStats[i] == AffectedStat.ATKSPD) { values[i] = Random.Range(-30, 40); } else if (affectedStats[i] == AffectedStat.MVMSPD) { values[i] = Random.Range(-2, 2); } else { values[i] = Random.Range(-3, 11); } } itemName = GenerateName(); }
private void CreateSlot(RelicSlot slot) { var slotView = Instantiate(this.slotPrefab, this.slotContainer); slotView.Initialize(slot); this.slotViews.Add(slotView); }
public Relic(Sprite icon, string name, RelicSlot slot, RelicRarity rarity, AffectedStat[] affectedStats, int[] values) { itemIcon = icon; itemName = name; this.slot = slot; this.rarity = rarity; this.affectedStats = affectedStats; this.values = values; }
public void Initialize(RelicSlot slot) { Slot = slot; Slot.Equipped += OnEquipped; Slot.Unequipped += OnUnequipped; this.draggable.BeginDrag += OnDraggableBeginDrag; this.draggable.EndDrag += OnDraggableEndDrag; this.draggable.Clicked += OnDraggableClicked; this.draggable.SetAlpha(0); this.draggable.MakeOnlyDraggable(); this.draggable.Initialize(Relic.Empty); Refresh(); }
private void OnUnequipped(RelicSlot slot) { Refresh(); }
private void OnEquipped(RelicSlot slot, Relic relic) { Refresh(); }
private void OnEquipIntoSlot(Relic relic, RelicSlot slot) { this.reliquary.Equip(relic, slot); }