예제 #1
0
 public Item(string Name, string Description, int Value, Equipable EquipableSlot = Equipable.None) : base()
 {
     this.Name          = Name;
     this.Description   = Description;
     this.Value         = Value;
     this.EquipableSlot = EquipableSlot;
 }
예제 #2
0
    public void Equip(Equipable equipable)
    {
        int slotIndex = (int)equipable.slot;

        Unequip(slotIndex);
        equipmentSlots[slotIndex] = equipable;
    }
 /// <summary>
 /// Unequipe an object if the object is equipped and put in the inventory.
 /// return true if the item was unequipped.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="inventory"></param>
 /// <returns></returns>
 public override bool UnequipObject(Equipable item, Inventory inventory)
 {
     if (item != null)
     {
         if (inventory.CanAddItem(item))
         {
             if (item.Equals(body))
             {
                 inventory.AddItem(body);
                 Body = null;
             }
             else if (item.Equals(rightHand))
             {
                 inventory.AddItem(rightHand);
                 RightHand = null;
             }
             else if (item.Equals(leftHand))
             {
                 inventory.AddItem(leftHand);
                 LeftHand = null;
             }
         }
     }
     return(false);
 }
예제 #4
0
    public void Equip(Equipable equipable)
    {
        Equipable slotToSet = null;

        switch (equipable)
        {
        case Armor notUsed:
            armor = (Armor)SetNew(armor, equipable);
            break;

        case Weapon notUsed:
            weapon = (Weapon)SetNew(weapon, equipable);
            break;

        case Ring notUsed:
            ring = (Ring)SetNew(ring, equipable);
            break;

        case Helmet notUsed:
            helmet = (Helmet)SetNew(helmet, equipable);
            break;
        }

        SetNew(slotToSet, equipable);
    }
예제 #5
0
 private void Equip(Equipable equipable, Transform transform)
 {
     equipable.transform.parent        = transform;
     equipable.transform.localPosition = Vector3.zero;
     equipable.transform.localRotation = Quaternion.identity;
     equipable.OnEquip(this);
 }
예제 #6
0
    void OnTriggerEnter2D(Collider2D item)
    {
        Equipable equipped = item.GetComponent <Equipable>();

        if (equipped != null)
        {
            switch (equipped.myType)
            {
            case EquipableType.GUN:
                Gun playerGun = GetComponentInChildren <Gun>();
                playerGun.gameObject.SetActive(true);
                playerGun.SetProjectile(equipped.myItem);
                playerGun.SetSprite(equipped.Collected());
                playerGun.SetFirePoint(equipped.firePoint.localPosition);
                break;

            case EquipableType.MELEE:
                break;

            case EquipableType.ARMOR:
                PlayerHealth health = GetComponent <PlayerHealth>();
                health.ArmorUp(1);
                equipped.Collected();
                break;
            }
        }
    }
예제 #7
0
 public void Equip(Equipable itemToEquip)
 {
     item = itemToEquip;
     if (slot == Slots.None)
     {
     }
     eManager.Owner.C.Equip(item, slot);
 }
예제 #8
0
 private void RemoveEquipmentEffects(Equipable itemToRemove)
 {
     foreach (Status status in itemToRemove.statusesToUnequip)
     {
         battlePcToEquip.FinishStatus(status);
     }
     itemToRemove.statusesToUnequip.Clear();
 }
예제 #9
0
    public void Unequip(EquipSlot slot)
    {
        Equipable e = _equipment[(int)slot];

        _equipment[(int)slot]?.OnUnequip();
        _equipment[(int)slot] = null;

        OnUnequipped?.Invoke(e);
    }
예제 #10
0
 private void AddEquipmentEffects(Equipable itemToSet)
 {
     foreach (Status status in itemToSet.statusesOnEquip)
     {
         Status statusInstance = status.CreateStatusInstance(battlePcToEquip.stats);
         itemToSet.statusesToUnequip.Add(statusInstance);
         battlePcToEquip.AddStatus(status);
     }
 }
예제 #11
0
        public void UnequipItem(Player player, string itemName)
        {
            Equipable item = EquipableGlossary.Parse(itemName);

            if (item != null)
            {
                player.UnequipObject(item);
            }
        }
 void EquipItem(Equipable item)
 {
     if (!item)
     {
         return;
     }
     if (bodyParts.TryGetValue(item.type, out var part))
     {
         part.Equip(item);
     }
 }
예제 #13
0
 public void Equip(Equipable equip, int skillIndex)
 {
     if (skillIndex > 4 || skillIndex < 0)
     {
         return;
     }
     //unequip previous skill if there was one
     if (skillSlots[skillIndex] != null)
     {
         skillSlots[skillIndex].OnUnequip(game, this);
     }
     //equip new skill
     skillSlots[skillIndex] = equip;
     equip.OnEquip(game, this);
 }
예제 #14
0
 public bool SpawnInWorld(Vector3 position, Quaternion rotation, Vector3 velocity)
 {
     Deactivate();
     RemoveFromWorld();
     equipable = (Equipable)Instantiate(equipablePrefab, position, rotation);
     equipable.SetEquipment(this);
     Rigidbody rigidbody = equipable.GetComponent<Rigidbody>();
     if (rigidbody != null)
         rigidbody.velocity = velocity;
     return true;
 }
예제 #15
0
 public void addEquipable(Equipable equip)
 {
     inventory.Add(equip);
 }
예제 #16
0
 public Equipable Equip(Equipable i)
 {
     throw new NotImplementedException();
 }
예제 #17
0
 Equipable Remove(Equipable i)
 {
     return helm;
 }