Browse Source

Add combined procedural and unique item factory to shop

Devin Braune 5 years ago
parent
commit
ac9cad3b6b
  1. 10
      Assets/Prefabs/GridViewItem.prefab
  2. 38
      Assets/Resources/GigaSwordFactory.asset
  3. 8
      Assets/Resources/GigaSwordFactory.asset.meta
  4. 37
      Assets/Resources/MegaSwordFactory.asset
  5. 8
      Assets/Resources/MegaSwordFactory.asset.meta
  6. 47
      Assets/Resources/NoobSwordFactory.asset
  7. 8
      Assets/Resources/NoobSwordFactory.asset.meta
  8. 39
      Assets/Resources/ProSwordFactory.asset
  9. 8
      Assets/Resources/ProSwordFactory.asset.meta
  10. 1
      Assets/Resources/ScriptedItems/ActualSword.asset
  11. 22
      Assets/Resources/ScriptedItems/DualBlade.asset
  12. 8
      Assets/Resources/ScriptedItems/DualBlade.asset.meta
  13. 22
      Assets/Resources/ScriptedItems/ImperialJapan.asset
  14. 8
      Assets/Resources/ScriptedItems/ImperialJapan.asset.meta
  15. 20
      Assets/Resources/ShopWeaponFactory.asset
  16. 8
      Assets/Resources/ShopWeaponFactory.asset.meta
  17. 17
      Assets/Resources/UniqueItems.asset
  18. 8
      Assets/Resources/UniqueItems.asset.meta
  19. 8
      Assets/Scenes/NewShop.unity
  20. 3
      Assets/Scripts/Shop/Components/ItemClassDisplay.cs
  21. 18
      Assets/Scripts/Shop/Model/Item.cs
  22. 2
      Assets/Scripts/Shop/Model/ItemWeapon.cs
  23. 19
      Assets/Scripts/Shop/Scriptable Objects/MultiItemFactory.cs
  24. 11
      Assets/Scripts/Shop/Scriptable Objects/MultiItemFactory.cs.meta
  25. 39
      Assets/Scripts/Shop/Scriptable Objects/ProceduralItemFactory.cs
  26. 11
      Assets/Scripts/Shop/Scriptable Objects/ProceduralItemFactory.cs.meta
  27. 1
      Assets/Scripts/Shop/Scriptable Objects/ScriptedItem.cs
  28. 2
      Assets/Scripts/Shop/Scriptable Objects/ScriptedWeapon.cs

10
Assets/Prefabs/GridViewItem.prefab

@ -662,7 +662,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &7781414650624386517
RectTransform:
m_ObjectHideFlags: 0
@ -677,9 +677,9 @@ RectTransform:
m_Father: {fileID: 2236248579476745813}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 100, y: -25}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6575481395058307399
@ -1527,7 +1527,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 125}
m_SizeDelta: {x: 200, y: 85.52164}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &644337133234863296
CanvasRenderer:

38
Assets/Resources/GigaSwordFactory.asset

@ -0,0 +1,38 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 0}
m_Name: GigaSwordFactory
m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory
Rarity: 16711935
DamageMin: 40
DamageMax: 60
PriceMin: 4500
PriceMax: 8000
Items:
- Sprite: {fileID: -4016013334462737405, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Giga-Axe
Description: This battle axe is two-sided and huge. While only the most skilled
heroes can master it, their foes are going to have a bad time.
AttackBonus: 5
- Sprite: {fileID: -5362799649635832982, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Falcon Punch
Description: Who needs a weapon when you can just falcon punch people?
AttackBonus: 12
- Sprite: {fileID: 5947598201806246533, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Electric Blade
Description: This sword is electrically charged and will deal massive damage
to anything it hits.
AttackBonus: 7
Amount: 2

8
Assets/Resources/GigaSwordFactory.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7e20569483b8ce942a78031bd0b0121c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

37
Assets/Resources/MegaSwordFactory.asset

@ -0,0 +1,37 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 0}
m_Name: MegaSwordFactory
m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory
Rarity: 65280
DamageMin: 20
DamageMax: 25
PriceMin: 800
PriceMax: 2500
Items:
- Sprite: {fileID: 3447626333678633045, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Diamond Sword
Description: Blatant copyright infringement!
AttackBonus: 10
- Sprite: {fileID: -7479063964076681684, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Mace
Description: Not to be confused with Mace Windu, the jedi master!
AttackBonus: 5
- Sprite: {fileID: 4292883687895924744, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Stab Stick
Description: This weapon is quite rare, and quite difficult to use. But a hit
is sure to be fatal!
AttackBonus: 12
Amount: 2

8
Assets/Resources/MegaSwordFactory.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 99965d8d09fad704fb867941e17eec1a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

47
Assets/Resources/NoobSwordFactory.asset

@ -0,0 +1,47 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 0}
m_Name: NoobSwordFactory
m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory
Rarity: 16777215
DamageMin: 2
DamageMax: 7
PriceMin: 50
PriceMax: 120
Items:
- Sprite: {fileID: -6229739577819397656, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Wooden Sword
Description: This wooden sword is quite awful!
AttackBonus: 0
- Sprite: {fileID: -4063295180217184869, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Basic Sword
Description: A basic common sword, which is not particularly useful in battle,
but keeps you safe from wildlife.
AttackBonus: 2
- Sprite: {fileID: -7651958066320933242, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Weird Sword
Description: This sword is kind of weird. But it seems to do the job!
AttackBonus: 1
- Sprite: {fileID: 206911327383899660, guid: b00993d063fbc4a87983115070f6145c, type: 3}
Name: Dagger
Description: Small dagger, easy to use and deadly, but with little range.
AttackBonus: 1
- Sprite: {fileID: -8295029410813222302, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Wood Axe
Description: This axe was built to chop down trees. Apparently it also chops
down your enemies!
AttackBonus: 3
Amount: 4

8
Assets/Resources/NoobSwordFactory.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 36357d288f5e56f4e91c809ea7909f67
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

39
Assets/Resources/ProSwordFactory.asset

@ -0,0 +1,39 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 0}
m_Name: ProSwordFactory
m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory
Rarity: 255
DamageMin: 12
DamageMax: 19
PriceMin: 350
PriceMax: 750
Items:
- Sprite: {fileID: -5939302461621596088, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Pirate Sword
Description: Pirates certainly know how to make swords. They may not slay a dragon,
but they are a safe bet for a battle.
AttackBonus: 2
- Sprite: {fileID: -851246318378289833, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Short Sword
Description: This sword looks very short, but when it actually connects with
its target, it has devastating consequences.
AttackBonus: 5
- Sprite: {fileID: -5996106085844551684, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Spike Club
Description: It may look primitive. But you certainly do not want to get hit
on the head by it!
AttackBonus: 0
Amount: 3

8
Assets/Resources/ProSwordFactory.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 74b8070851d98094dbbaa907e8a7648d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

1
Assets/Resources/ScriptedItems/ActualSword.asset

@ -16,5 +16,6 @@ MonoBehaviour:
Description: This sword is actually a sword though
Sprite: {fileID: 3447626333678633045, guid: b00993d063fbc4a87983115070f6145c, type: 3}
Price: 1000
Rarity: 65280
Attack: 35
Damage: 45

22
Assets/Resources/ScriptedItems/DualBlade.asset

@ -0,0 +1,22 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1a6faf63d685386429bab9c581992b61, type: 3}
m_Name: DualBlade
m_EditorClassIdentifier:
Name: Dual Blade
Description: The legendary dual blade. Forged by the legendary legend himself.
It is so legendary that only the legend could wield it.
Sprite: {fileID: -1704500264438275045, guid: b00993d063fbc4a87983115070f6145c, type: 3}
Price: 50000
Rarity: 16776960
Attack: 350
Damage: 420

8
Assets/Resources/ScriptedItems/DualBlade.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6219ccc5039acc1489e2da701bc93d82
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

22
Assets/Resources/ScriptedItems/ImperialJapan.asset

@ -0,0 +1,22 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1a6faf63d685386429bab9c581992b61, type: 3}
m_Name: ImperialJapan
m_EditorClassIdentifier:
Name: Imperial Japan
Description: Wielding Imperial Japan comes with great responsibility, but also
with great power! Although it is yellow for some reason.
Sprite: {fileID: -1083111729585998019, guid: b00993d063fbc4a87983115070f6145c, type: 3}
Price: 15000
Rarity: 16776960
Attack: 280
Damage: 325

8
Assets/Resources/ScriptedItems/ImperialJapan.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cffb69fad9a3c914daa990daa78bcff4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

20
Assets/Resources/ShopWeaponFactory.asset

@ -0,0 +1,20 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: be184c10b845d1044abbc1c356837cac, type: 3}
m_Name: ShopWeaponFactory
m_EditorClassIdentifier:
ItemFactories:
- {fileID: 11400000, guid: 36357d288f5e56f4e91c809ea7909f67, type: 2}
- {fileID: 11400000, guid: 74b8070851d98094dbbaa907e8a7648d, type: 2}
- {fileID: 11400000, guid: 99965d8d09fad704fb867941e17eec1a, type: 2}
- {fileID: 11400000, guid: 7e20569483b8ce942a78031bd0b0121c, type: 2}
- {fileID: 11400000, guid: c91975636a4024b46997f72b950e1977, type: 2}

8
Assets/Resources/ShopWeaponFactory.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ed86667a8c8440d489527401f6ada6b7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

17
Assets/Resources/UniqueItems.asset

@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d4a440686e1eaa042a9d58081a9b8dbe, type: 3}
m_Name: UniqueItems
m_EditorClassIdentifier:
Items:
- {fileID: 11400000, guid: cffb69fad9a3c914daa990daa78bcff4, type: 2}
- {fileID: 11400000, guid: 6219ccc5039acc1489e2da701bc93d82, type: 2}

8
Assets/Resources/UniqueItems.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c91975636a4024b46997f72b950e1977
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scenes/NewShop.unity

@ -427,7 +427,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: be8c4b332c72a3c4b85013b334ebde3a, type: 3}
m_Name:
m_EditorClassIdentifier:
factory: {fileID: 11400000, guid: d16c0801001245545908f8b001145a3d, type: 2}
factory: {fileID: 11400000, guid: ed86667a8c8440d489527401f6ada6b7, type: 2}
shop: {fileID: 11400000, guid: 366ca79a0c4a2df4fac53ddd28f65f1a, type: 2}
--- !u!1 &180905778
GameObject:
@ -1131,7 +1131,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 150, y: -100}
m_AnchoredPosition: {x: 150, y: -0}
m_SizeDelta: {x: 280, y: 150}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &317898841
@ -8561,7 +8561,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1941898338
RectTransform:
m_ObjectHideFlags: 0
@ -9636,7 +9636,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 150, y: -150}
m_SizeDelta: {x: 300, y: 250}
m_SizeDelta: {x: 300, y: 121.803894}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &2106869074
MonoBehaviour:

3
Assets/Scripts/Shop/Components/ItemClassDisplay.cs

@ -20,6 +20,7 @@ public class ItemClassDisplay : MonoBehaviour
{
if(text == null) text = GetComponent<TextMeshProUGUI>(); // Just in case this gets called before Start()
text.text = clas.ToString();
text.color = new Color32((byte)((uint)clas >> 24), (byte)((uint)clas >> 16), (byte)((uint)clas >> 8), (byte)((uint)clas));
//text.color = new Color32((byte)((uint)clas >> 24), (byte)((uint)clas >> 16), (byte)((uint)clas >> 8), (byte)((uint)clas));
text.color = new Color32((byte)((int)clas >> 16), (byte)((int)clas >> 8), (byte)((int)clas), 0xFF);
}
}

18
Assets/Scripts/Shop/Model/Item.cs

@ -17,13 +17,13 @@ public abstract class Item
//------------------------------------------------------------------------------------------------------------------------
// Item()
//------------------------------------------------------------------------------------------------------------------------
public Item(string name, string iconName, int pbasePrice, string itemDescr = "")
public Item(string name, string iconName, int pbasePrice, string itemDescr = "", ItemRarity rarity = ItemRarity.Common)
{
this.name = name;
this.iconName = iconName;
this.basePrice = pbasePrice;
description = itemDescr;
rarity = ItemRarity.UltraRare;
this.rarity = rarity;
}
// This is supposed to return what type an item identifies as, purely used for filtering
@ -42,13 +42,13 @@ public enum ItemType
Armor,
Potion
}
public enum ItemRarity : uint // Int representing color, so that this enum not only works as an identifier, but also contains name and col in just 32 bits. C#-Magic!
[System.Serializable]
public enum ItemRarity : int // Int representing color, so that this enum not only works as an identifier, but also contains name and col in just 32 bits. C#-Magic!
{
Common = 0xFFFFFFFF,
Uncommon = 0xFFFF00FF,
Rare = 0xFF0000FF,
UltraRare = 0xFF00FFFF,
Unique = 0x00FF00FF
Common = 0xFFFFFF,
Uncommon = 0x0000FF,
Rare = 0x00FF00,
Legendary = 0xFF00FF,
Unique = 0xFFFF00
}

2
Assets/Scripts/Shop/Model/ItemWeapon.cs

@ -6,7 +6,7 @@ public class ItemWeapon : Item
{
public readonly int Attack;
public readonly int Damage;
public ItemWeapon(string name, string iconName, int pbasePrice,int pAttack, int pDamage, string descr = "") : base(name, iconName, pbasePrice, descr)
public ItemWeapon(string name, string iconName, int pbasePrice,int pAttack, int pDamage, string descr = "", ItemRarity rarity = ItemRarity.Common) : base(name, iconName, pbasePrice, descr,rarity)
{
Attack = pAttack;
Damage = pDamage;

19
Assets/Scripts/Shop/Scriptable Objects/MultiItemFactory.cs

@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// This is an item factory of item factories, simply put. Allows you to combine all sorts of factories to populate
/// just one inventory with different types and levels of items.
/// </summary>
[CreateAssetMenu]//Allows creating ViewConfig objects in Assets -> Create menu in the Unity Editor
public class MultiItemFactory : ItemFactory
{
public ItemFactory[] ItemFactories;
public override void PopulateModel(ShopModel model)
{
foreach (var factory in ItemFactories)
{
factory.PopulateModel(model);
}
}
}

11
Assets/Scripts/Shop/Scriptable Objects/MultiItemFactory.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: be184c10b845d1044abbc1c356837cac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

39
Assets/Scripts/Shop/Scriptable Objects/ProceduralItemFactory.cs

@ -0,0 +1,39 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
/// <summary>
/// This item factory literally just takes a handcrafted list of items and populates the model with that!
/// </summary>
[CreateAssetMenu]//Allows creating ViewConfig objects in Assets -> Create menu in the Unity Editor
public class ProceduralWeaponFactory : ItemFactory
{
public ItemRarity Rarity;
public int DamageMin;
public int DamageMax;
public int PriceMin;
public int PriceMax;
public ItemPrototype[] Items;
public int Amount;
public override void PopulateModel(ShopModel model)
{
for (int i = 0; i < Amount; i++)
{
var item = Items[Random.Range(0, Items.Length)];
model.inventory.AddItem(new ItemWeapon(item.Name,item.Sprite.name,Random.Range(PriceMin,PriceMax),Random.Range(DamageMin,DamageMax) + item.AttackBonus,Random.Range(DamageMin,DamageMax) + item.AttackBonus + 3,item.Description, Rarity));
}
}
}
// This has the sole purpose of associating a sprite with a name for the factory. Not making it a scriptable object because doing this in the factory editor view is faster
[System.Serializable]
public struct ItemPrototype
{
public Sprite Sprite;
public string Name;
public string Description;
public int AttackBonus;
}

11
Assets/Scripts/Shop/Scriptable Objects/ProceduralItemFactory.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ea9644082b1c77a44849c5b6af28eb4f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

1
Assets/Scripts/Shop/Scriptable Objects/ScriptedItem.cs

@ -10,6 +10,7 @@ public abstract class ScriptedItem : ScriptableObject
public string Description;
public Sprite Sprite;
public int Price;
public ItemRarity Rarity;
public abstract Item GenerateItem();
}

2
Assets/Scripts/Shop/Scriptable Objects/ScriptedWeapon.cs

@ -11,6 +11,6 @@ public class ScriptedWeapon : ScriptedItem
public int Damage;
public override Item GenerateItem()
{
return new ItemWeapon(Name, Sprite.name, Price, Attack, Damage,Description);
return new ItemWeapon(Name, Sprite.name, Price, Attack, Damage,Description,Rarity);
}
}

Loading…
Cancel
Save