示例#1
0
        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);
        }
示例#2
0
    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();
    }
示例#3
0
        private void CreateSlot(RelicSlot slot)
        {
            var slotView = Instantiate(this.slotPrefab, this.slotContainer);

            slotView.Initialize(slot);
            this.slotViews.Add(slotView);
        }
示例#4
0
 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;
 }
示例#5
0
        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();
        }
示例#6
0
 private void OnUnequipped(RelicSlot slot)
 {
     Refresh();
 }
示例#7
0
 private void OnEquipped(RelicSlot slot, Relic relic)
 {
     Refresh();
 }
示例#8
0
 private void OnEquipIntoSlot(Relic relic, RelicSlot slot)
 {
     this.reliquary.Equip(relic, slot);
 }