Ejemplo n.º 1
0
    public static void GiveWeapon(ScriptableUnitConfig data, GameObject unit_mesh, UnitInventory inventory)
    {
        Weapon weapon = SpawnWeaponToUnit(unit_mesh, data.Weapon);


        weapon.transform.SetParent(unit_mesh.transform);

        inventory.AddItem(weapon, 1);
    }
Ejemplo n.º 2
0
    protected void OnUnitKilled()
    {
        UnitInventory inv = GetComponent <UnitInventory>();

        if (inv.SpaceInInventory())
        {
            Item dropedItem = ItemSpawner.instance.SpawnItem(stats);
            if (dropedItem != null)
            {
                inv.AddItem(dropedItem);
            }
        }
    }