Example #1
0
    public void deregister_item(IEquiptable item)
    {
        if (item == null)
        {
            return;
        }

        switch (item.getType())
        {
        case Equipable_generic.ITEM_TYPE.ammo:
            if (!Ammoboxes.Contains((Ammo_generic)item))
            {
                return;
            }
            Ammoboxes.Remove((Ammo_generic)item);
            break;

        case Equipable_generic.ITEM_TYPE.gun:
            if (!Guns.Contains((Gun_generic)item))
            {
                return;
            }
            Guns.Remove((Gun_generic)item);
            break;
        }
    }
Example #2
0
        public static string ReplaceNull(IEquiptable test)
        {
            if (test == null)
            {
                return("Nothing");
            }

            return(test.Name.ToString());
        }
Example #3
0
    public void register_item(IEquiptable item)
    {
        if (item == null)
        {
            return;
        }

        switch (item.getType())
        {
        case Equipable_generic.ITEM_TYPE.ammo:
            if (Ammoboxes.Contains((Ammo_generic)item))
            {
                return;
            }
            Ammoboxes.Add((Ammo_generic)item);
            //Remove additional
            if (Ammoboxes.Count > max_ammobox)
            {
                NetworkServer.Destroy(Ammoboxes[0].gameObject);
                Ammoboxes.RemoveAt(0);
            }
            break;

        case Equipable_generic.ITEM_TYPE.gun:
            if (Guns.Contains((Gun_generic)item))
            {
                return;
            }
            Guns.Add((Gun_generic)item);
            //Remove additional
            if (Guns.Count > max_guns)
            {
                NetworkServer.Destroy(Guns[0].gameObject);
                Guns.RemoveAt(0);
            }
            break;
        }
    }
Example #4
0
    public void prolong_item(IEquiptable item)
    {
        switch (item.getType())
        {
        case Equipable_generic.ITEM_TYPE.ammo:
            Ammo_generic ammo = (Ammo_generic)item;
            if (Ammoboxes.Contains(ammo))
            {
                Ammoboxes.Remove(ammo);
                Ammoboxes.Add(ammo);
            }
            break;

        case Equipable_generic.ITEM_TYPE.gun:
            Gun_generic gun = (Gun_generic)item;
            if (Guns.Contains(gun))
            {
                Guns.Remove(gun);
                Guns.Add(gun);
            }
            break;
        }
    }