Browse Source

Add armor generation

master
Devin 4 years ago
parent
commit
0ff5bad061
  1. 17
      Assets/Resources/AllItemsFactory.asset
  2. 8
      Assets/Resources/AllItemsFactory.asset.meta
  3. 43
      Assets/Resources/BasicArmorFactory.asset
  4. 8
      Assets/Resources/BasicArmorFactory.asset.meta
  5. 2
      Assets/Resources/GigaSwordFactory.asset
  6. 2
      Assets/Resources/GigaSwordFactory.asset.meta
  7. 39
      Assets/Resources/GreatArmorFactory.asset
  8. 8
      Assets/Resources/GreatArmorFactory.asset.meta
  9. 2
      Assets/Resources/MegaSwordFactory.asset
  10. 2
      Assets/Resources/MegaSwordFactory.asset.meta
  11. 2
      Assets/Resources/NoobSwordFactory.asset
  12. 2
      Assets/Resources/NoobSwordFactory.asset.meta
  13. 2
      Assets/Resources/ProSwordFactory.asset
  14. 2
      Assets/Resources/ProSwordFactory.asset.meta
  15. 36
      Assets/Resources/RareArmorFactory.asset
  16. 8
      Assets/Resources/RareArmorFactory.asset.meta
  17. 18
      Assets/Resources/ShopArmorFactory.asset
  18. 8
      Assets/Resources/ShopArmorFactory.asset.meta
  19. 123
      Assets/Scenes/NewShop.unity
  20. 29
      Assets/Scripts/Shop/Components/ItemIconDisplay.cs
  21. 11
      Assets/Scripts/Shop/Components/ItemIconDisplay.cs.meta
  22. 25
      Assets/Scripts/Shop/Model/ItemArmor.cs
  23. 11
      Assets/Scripts/Shop/Model/ItemArmor.cs.meta
  24. 12
      Assets/Scripts/Shop/Scriptable Objects/ItemFactory.cs
  25. 29
      Assets/Scripts/Shop/Scriptable Objects/ProceduralArmorFactory.cs
  26. 11
      Assets/Scripts/Shop/Scriptable Objects/ProceduralArmorFactory.cs.meta
  27. 14
      Assets/Scripts/Shop/Scriptable Objects/ProceduralWeaponFactory.cs
  28. 0
      Assets/Scripts/Shop/Scriptable Objects/ProceduralWeaponFactory.cs.meta
  29. 16
      Assets/Scripts/Shop/Scriptable Objects/ScriptedArmor.cs
  30. 11
      Assets/Scripts/Shop/Scriptable Objects/ScriptedArmor.cs.meta
  31. 2
      Assets/Scripts/Shop/View/ShopViewGrid.cs
  32. 3
      Assets/Scripts/Shop/View/ShopViewList.cs
  33. 7
      Assets/Scripts/Shop/View/ViewItemInfoPanel.cs

17
Assets/Resources/AllItemsFactory.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: be184c10b845d1044abbc1c356837cac, type: 3}
m_Name: AllItemsFactory
m_EditorClassIdentifier:
ItemFactories:
- {fileID: 11400000, guid: ed86667a8c8440d489527401f6ada6b7, type: 2}
- {fileID: 11400000, guid: 5577191489773c24f95b649170284aa4, type: 2}

8
Assets/Resources/AllItemsFactory.asset.meta

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

43
Assets/Resources/BasicArmorFactory.asset

@ -0,0 +1,43 @@
%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: ebeacc5773329254488339277dadfae7, type: 3}
m_Name: BasicArmorFactory
m_EditorClassIdentifier:
Rarity: 16777215
DefenseMin: 5
DefenseMax: 8
PriceMin: 150
PriceMax: 300
Items:
- Sprite: {fileID: 6077338267653451029, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Mooscles
Description: If you drink the milk, your mooscles will be stronk, and you can
defend yourself with them.
Bonus: 0
- Sprite: {fileID: -7323674943459820596, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Champion's Tunic
Description: This blue tunic seems to have belonged to a fallen hero hundreds
of years ago.
Bonus: 3
- Sprite: {fileID: -8650232248937032532, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Tunic of Time
Description: This green tunic may look familiar.
Bonus: 4
- Sprite: {fileID: -4790045407390419966, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Hero's Boots
Description: These boots may look familiar.
Bonus: 2
Amount: 4

8
Assets/Resources/BasicArmorFactory.asset.meta

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

2
Assets/Resources/GigaSwordFactory.asset

@ -9,7 +9,7 @@ MonoBehaviour:
m_GameObject: {fileID: 0} m_GameObject: {fileID: 0}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 0} m_Script: {fileID: 11500000, guid: ea9644082b1c77a44849c5b6af28eb4f, type: 3}
m_Name: GigaSwordFactory m_Name: GigaSwordFactory
m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory
Rarity: 16711935 Rarity: 16711935

2
Assets/Resources/GigaSwordFactory.asset.meta

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

39
Assets/Resources/GreatArmorFactory.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: 11500000, guid: ebeacc5773329254488339277dadfae7, type: 3}
m_Name: GreatArmorFactory
m_EditorClassIdentifier:
Rarity: 255
DefenseMin: 14
DefenseMax: 19
PriceMin: 500
PriceMax: 800
Items:
- Sprite: {fileID: -1754823780530430466, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Helmet of the Sun
Description: This type of helmet is forged and used by the sun people. Not many
of them are in circulation in other parts of the world.
Bonus: 4
- Sprite: {fileID: -2660569609710428876, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Leather Chestplate
Description: Thick leather seems to be more protective of its wearer than thin
cloth.
Bonus: 3
- Sprite: {fileID: 3386722485073375770, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Steelcap Boots
Description: Boots with a steelcap are simply better than boots without one -
that is, unless you're trying to stay afloat!
Bonus: 1
Amount: 2

8
Assets/Resources/GreatArmorFactory.asset.meta

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

2
Assets/Resources/MegaSwordFactory.asset

@ -9,7 +9,7 @@ MonoBehaviour:
m_GameObject: {fileID: 0} m_GameObject: {fileID: 0}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 0} m_Script: {fileID: 11500000, guid: ea9644082b1c77a44849c5b6af28eb4f, type: 3}
m_Name: MegaSwordFactory m_Name: MegaSwordFactory
m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory
Rarity: 65280 Rarity: 65280

2
Assets/Resources/MegaSwordFactory.asset.meta

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

2
Assets/Resources/NoobSwordFactory.asset

@ -9,7 +9,7 @@ MonoBehaviour:
m_GameObject: {fileID: 0} m_GameObject: {fileID: 0}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 0} m_Script: {fileID: 11500000, guid: ea9644082b1c77a44849c5b6af28eb4f, type: 3}
m_Name: NoobSwordFactory m_Name: NoobSwordFactory
m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory
Rarity: 16777215 Rarity: 16777215

2
Assets/Resources/NoobSwordFactory.asset.meta

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

2
Assets/Resources/ProSwordFactory.asset

@ -9,7 +9,7 @@ MonoBehaviour:
m_GameObject: {fileID: 0} m_GameObject: {fileID: 0}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 0} m_Script: {fileID: 11500000, guid: ea9644082b1c77a44849c5b6af28eb4f, type: 3}
m_Name: ProSwordFactory m_Name: ProSwordFactory
m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory m_EditorClassIdentifier: SAShop::ProceduralWeaponFactory
Rarity: 255 Rarity: 255

2
Assets/Resources/ProSwordFactory.asset.meta

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

36
Assets/Resources/RareArmorFactory.asset

@ -0,0 +1,36 @@
%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: ebeacc5773329254488339277dadfae7, type: 3}
m_Name: RareArmorFactory
m_EditorClassIdentifier:
Rarity: 65280
DefenseMin: 25
DefenseMax: 40
PriceMin: 3500
PriceMax: 6000
Items:
- Sprite: {fileID: 117214147892069551, guid: b00993d063fbc4a87983115070f6145c, type: 3}
Name: Steel Gloves
Description: Very difficult to craft, therefore very rare, but immensely helpful
in combat.
Bonus: 2
- Sprite: {fileID: -5703758344047898144, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Steel Chestplate
Description: Name checks out
Bonus: 8
- Sprite: {fileID: -7905648789407400134, guid: b00993d063fbc4a87983115070f6145c,
type: 3}
Name: Strong Leather Chestplate
Description: This reinforced leather chestplate is extremely strong, yet mobile.
Bonus: 1
Amount: 2

8
Assets/Resources/RareArmorFactory.asset.meta

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

18
Assets/Resources/ShopArmorFactory.asset

@ -0,0 +1,18 @@
%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: ShopArmorFactory
m_EditorClassIdentifier:
ItemFactories:
- {fileID: 11400000, guid: a99cf577f5b2a5a4bbf949e8732bb406, type: 2}
- {fileID: 11400000, guid: d951ed0254060cf448168db909dc407c, type: 2}
- {fileID: 11400000, guid: 0480ad1a4fb45e544944b8a42a6ef541, type: 2}

8
Assets/Resources/ShopArmorFactory.asset.meta

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

123
Assets/Scenes/NewShop.unity

@ -427,7 +427,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: be8c4b332c72a3c4b85013b334ebde3a, type: 3} m_Script: {fileID: 11500000, guid: be8c4b332c72a3c4b85013b334ebde3a, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
factory: {fileID: 11400000, guid: ed86667a8c8440d489527401f6ada6b7, type: 2} factory: {fileID: 11400000, guid: b75166a8b7cdac24d9a9d1cd0edf4a15, type: 2}
shop: {fileID: 11400000, guid: 366ca79a0c4a2df4fac53ddd28f65f1a, type: 2} shop: {fileID: 11400000, guid: 366ca79a0c4a2df4fac53ddd28f65f1a, type: 2}
--- !u!1 &180905778 --- !u!1 &180905778
GameObject: GameObject:
@ -771,9 +771,9 @@ RectTransform:
m_Father: {fileID: 274071969} m_Father: {fileID: 274071969}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 466.68445, y: -24.63433}
m_SizeDelta: {x: 933.3689, y: 49.26866} m_SizeDelta: {x: 933.3689, y: 49.26866}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &240970668 --- !u!114 &240970668
@ -870,9 +870,9 @@ RectTransform:
m_Father: {fileID: 849412833} m_Father: {fileID: 849412833}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 58.397293, y: -20} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 116.794586, y: 38.03768} m_SizeDelta: {x: 116.794586, y: 38.03768}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &242976726 --- !u!114 &242976726
@ -2239,9 +2239,9 @@ RectTransform:
m_Father: {fileID: 849412833} m_Father: {fileID: 849412833}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 136.79459, y: -20} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 20} m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &552208507 --- !u!114 &552208507
@ -2389,9 +2389,9 @@ RectTransform:
m_Father: {fileID: 779240604} m_Father: {fileID: 779240604}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 136.79459, y: -20}
m_SizeDelta: {x: 20, y: 20} m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &591197038 --- !u!114 &591197038
@ -2583,9 +2583,9 @@ RectTransform:
m_Father: {fileID: 779240604} m_Father: {fileID: 779240604}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 208.98698, y: -20}
m_SizeDelta: {x: 104.384796, y: 40} m_SizeDelta: {x: 104.384796, y: 40}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &741829286 --- !u!114 &741829286
@ -2741,9 +2741,9 @@ RectTransform:
m_Father: {fileID: 240970667} m_Father: {fileID: 240970667}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 799.6245, y: -24.63433}
m_SizeDelta: {x: 150, y: 40.22} m_SizeDelta: {x: 150, y: 40.22}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &777484100 --- !u!114 &777484100
@ -3063,7 +3063,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!224 &822572996 --- !u!224 &822572996
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3465,9 +3465,9 @@ RectTransform:
m_Father: {fileID: 240970667} m_Father: {fileID: 240970667}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 199.62448, y: -24.63433}
m_SizeDelta: {x: 150, y: 40.22} m_SizeDelta: {x: 150, y: 40.22}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &904235320 --- !u!114 &904235320
@ -3931,9 +3931,9 @@ RectTransform:
m_Father: {fileID: 779240604} m_Father: {fileID: 779240604}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 58.397293, y: -20}
m_SizeDelta: {x: 116.794586, y: 38.03768} m_SizeDelta: {x: 116.794586, y: 38.03768}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1071789911 --- !u!114 &1071789911
@ -5859,9 +5859,9 @@ RectTransform:
m_Father: {fileID: 240970667} m_Father: {fileID: 240970667}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 42.31224, y: -24.63433}
m_SizeDelta: {x: 64.62448, y: 40.22} m_SizeDelta: {x: 64.62448, y: 40.22}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1374344515 --- !u!114 &1374344515
@ -6894,9 +6894,9 @@ RectTransform:
m_Father: {fileID: 240970667} m_Father: {fileID: 240970667}
m_RootOrder: 3 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 599.6245, y: -24.63433}
m_SizeDelta: {x: 150, y: 40.22} m_SizeDelta: {x: 150, y: 40.22}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1701112578 --- !u!114 &1701112578
@ -7488,9 +7488,9 @@ RectTransform:
m_Father: {fileID: 1424701243} m_Father: {fileID: 1424701243}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 400, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 50} m_SizeDelta: {x: 160, y: 50}
m_Pivot: {x: 0.5, y: 1} m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1763223519 --- !u!114 &1763223519
@ -7764,9 +7764,9 @@ RectTransform:
m_Father: {fileID: 1424701243} m_Father: {fileID: 1424701243}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 80, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 50} m_SizeDelta: {x: 160, y: 50}
m_Pivot: {x: 0.5, y: 1} m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1779774928 --- !u!114 &1779774928
@ -8153,9 +8153,9 @@ RectTransform:
m_Father: {fileID: 274071969} m_Father: {fileID: 274071969}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 475, y: -49.26866}
m_SizeDelta: {x: 950, y: 602} m_SizeDelta: {x: 950, y: 602}
m_Pivot: {x: 0.5, y: 1} m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1865708447 --- !u!114 &1865708447
@ -8459,9 +8459,9 @@ RectTransform:
m_Father: {fileID: 1424701243} m_Father: {fileID: 1424701243}
m_RootOrder: 3 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 560, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 50} m_SizeDelta: {x: 160, y: 50}
m_Pivot: {x: 0.5, y: 1} m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1918696018 --- !u!114 &1918696018
@ -8884,9 +8884,9 @@ RectTransform:
m_Father: {fileID: 849412833} m_Father: {fileID: 849412833}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 208.98698, y: -20} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 104.384796, y: 40} m_SizeDelta: {x: 104.384796, y: 40}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1947464188 --- !u!114 &1947464188
@ -9042,9 +9042,9 @@ RectTransform:
m_Father: {fileID: 240970667} m_Father: {fileID: 240970667}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 399.62448, y: -24.63433}
m_SizeDelta: {x: 150, y: 40.22} m_SizeDelta: {x: 150, y: 40.22}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1966788905 --- !u!114 &1966788905
@ -9364,9 +9364,9 @@ RectTransform:
m_Father: {fileID: 1424701243} m_Father: {fileID: 1424701243}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 240, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 50} m_SizeDelta: {x: 160, y: 50}
m_Pivot: {x: 0.5, y: 1} m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1982954963 --- !u!114 &1982954963
@ -9460,6 +9460,7 @@ GameObject:
- component: {fileID: 2071906704} - component: {fileID: 2071906704}
- component: {fileID: 2071906706} - component: {fileID: 2071906706}
- component: {fileID: 2071906705} - component: {fileID: 2071906705}
- component: {fileID: 2071906707}
m_Layer: 5 m_Layer: 5
m_Name: ItemIcon m_Name: ItemIcon
m_TagString: Untagged m_TagString: Untagged
@ -9524,6 +9525,20 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2071906703} m_GameObject: {fileID: 2071906703}
m_CullTransparentMesh: 0 m_CullTransparentMesh: 0
--- !u!114 &2071906707
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2071906703}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3061dcd664e618547bf8a20ebd8ff459, type: 3}
m_Name:
m_EditorClassIdentifier:
iconAtlas: {fileID: 4343727234628468602, guid: 61885a51c5dad46cd8f257139ddcc43a,
type: 2}
--- !u!1 &2075705431 --- !u!1 &2075705431
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -9718,7 +9733,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!224 &2131558511 --- !u!224 &2131558511
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

29
Assets/Scripts/Shop/Components/ItemIconDisplay.cs

@ -0,0 +1,29 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.U2D;
using UnityEngine.UI;
/// <summary>
/// This class' only purpose is to set the price of a UI element
/// </summary>
[RequireComponent(typeof(Sprite))]
public class ItemIconDisplay : MonoBehaviour
{
[SerializeField]
protected SpriteAtlas iconAtlas;
private Image sprite;
private void Start()
{
sprite = GetComponent<Image>(); // Because of the meta tag, Unity will make sure this exists. No sanity checks
}
public void SetIcon(string name)
{
if(sprite == null) sprite = GetComponent<Image>(); // Just in case this gets called before Start()
sprite.sprite = iconAtlas.GetSprite(name);
}
}

11
Assets/Scripts/Shop/Components/ItemIconDisplay.cs.meta

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

25
Assets/Scripts/Shop/Model/ItemArmor.cs

@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ItemArmor : Item
{
public readonly int Defense;
public readonly int Block;
public ItemArmor(string name, string iconName, int pbasePrice,int pDefense, int pBlock, string descr = "", ItemRarity rarity = ItemRarity.Common) : base(name, iconName, pbasePrice, descr,rarity)
{
Block = pBlock;
Defense = pDefense;
}
// This is used so we can identify a type purely through polymorphism. No hardcoding of types involved, nothing to see here!
public override ItemType GetItemType()
{
return ItemType.Armor;
}
public override string GetStats()
{
return "Defense: " + Defense + "\tBlock: " + Block;
}
}

11
Assets/Scripts/Shop/Model/ItemArmor.cs.meta

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

12
Assets/Scripts/Shop/Scriptable Objects/ItemFactory.cs

@ -1,6 +1,8 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
/// <summary> /// <summary>
/// An item factory is simply meant to procedurally (or pre-scripted) populate a shop model. /// An item factory is simply meant to procedurally (or pre-scripted) populate a shop model.
/// </summary> /// </summary>
@ -8,3 +10,13 @@ public abstract class ItemFactory : ScriptableObject
{ {
public abstract void PopulateModel(ShopModel model); public abstract void PopulateModel(ShopModel model);
} }
// 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;
[FormerlySerializedAs("AttackBonus")] public int Bonus; // FormerlySerializedAs so we don't have to reassign from when it was only used for weapons. Compatibility, yay!
}

29
Assets/Scripts/Shop/Scriptable Objects/ProceduralArmorFactory.cs

@ -0,0 +1,29 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
/// <summary>
/// This item factory uses all specified properties to procedurally generate a given amount of items. In this case, armor
/// </summary>
[CreateAssetMenu]//Allows creating ViewConfig objects in Assets -> Create menu in the Unity Editor
public class ProceduralArmorFactory : ItemFactory
{
public ItemRarity Rarity;
public int DefenseMin;
public int DefenseMax;
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 ItemArmor(item.Name,item.Sprite.name,Random.Range(PriceMin,PriceMax),Random.Range(DefenseMax,DefenseMax) + item.Bonus,Random.Range(DefenseMin,DefenseMax) + item.Bonus + 3,item.Description, Rarity));
}
}
}

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

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

14
Assets/Scripts/Shop/Scriptable Objects/ProceduralItemFactory.cs → Assets/Scripts/Shop/Scriptable Objects/ProceduralWeaponFactory.cs

@ -5,7 +5,7 @@ using UnityEngine;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
/// <summary> /// <summary>
/// This item factory literally just takes a handcrafted list of items and populates the model with that! /// This item factory uses all specified properties to procedurally generate a given amount of items. In this case, weapons
/// </summary> /// </summary>
[CreateAssetMenu]//Allows creating ViewConfig objects in Assets -> Create menu in the Unity Editor [CreateAssetMenu]//Allows creating ViewConfig objects in Assets -> Create menu in the Unity Editor
public class ProceduralWeaponFactory : ItemFactory public class ProceduralWeaponFactory : ItemFactory
@ -23,17 +23,7 @@ public class ProceduralWeaponFactory : ItemFactory
for (int i = 0; i < Amount; i++) for (int i = 0; i < Amount; i++)
{ {
var item = Items[Random.Range(0, Items.Length)]; 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)); model.inventory.AddItem(new ItemWeapon(item.Name,item.Sprite.name,Random.Range(PriceMin,PriceMax),Random.Range(DamageMin,DamageMax) + item.Bonus,Random.Range(DamageMin,DamageMax) + item.Bonus + 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;
}

0
Assets/Scripts/Shop/Scriptable Objects/ProceduralItemFactory.cs.meta → Assets/Scripts/Shop/Scriptable Objects/ProceduralWeaponFactory.cs.meta

16
Assets/Scripts/Shop/Scriptable Objects/ScriptedArmor.cs

@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// The scripted armor generates armor with the specified defense
/// </summary>
[CreateAssetMenu]//Allows creating ViewConfig objects in Assets -> Create menu in the Unity Editor
public class ScriptedArmor : ScriptedItem
{
public int Defense;
public int Block;
public override Item GenerateItem()
{
return new ItemArmor(Name, Sprite.name, Price, Defense, Block,Description,Rarity);
}
}

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

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

2
Assets/Scripts/Shop/View/ShopViewGrid.cs

@ -51,7 +51,7 @@ public class ShopViewGrid : ShopView
//bool isSelected = (item == model.GetSelectedItem()); //bool isSelected = (item == model.GetSelectedItem());
var unsub = model.RegisterObserver(itemContainer); var unsub = model.RegisterObserver(itemContainer);
itemContainer.Initialize(item,unsub); itemContainer.Initialize(item,unsub);
print("Attempt to add item " + item.name + " to view"); //print("Attempt to add item " + item.name + " to view");
} }
protected override void RemoveItemFromView(Item item) protected override void RemoveItemFromView(Item item)

3
Assets/Scripts/Shop/View/ShopViewList.cs

@ -2,6 +2,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Security.Permissions; using System.Security.Permissions;
using UnityEditor;
using UnityEngine; using UnityEngine;
using UnityEngine.Assertions; using UnityEngine.Assertions;
using UnityEngine.UI; using UnityEngine.UI;
@ -59,7 +60,7 @@ public class ShopViewList : ShopView, IShopModelObserver<Item>
//bool isSelected = (item == model.GetSelectedItem()); //bool isSelected = (item == model.GetSelectedItem());
var unsub = model.RegisterObserver(itemContainer); var unsub = model.RegisterObserver(itemContainer);
itemContainer.Initialize(item,unsub); itemContainer.Initialize(item,unsub);
print("Attempt to add item " + item.name + " to view"); //print("Attempt to add item " + item.name + " to view");
} }
protected override void RemoveItemFromView(Item item) protected override void RemoveItemFromView(Item item)

7
Assets/Scripts/Shop/View/ViewItemInfoPanel.cs

@ -17,6 +17,7 @@ public class ViewItemInfoPanel : MonoBehaviour
private List<ItemPriceDisplay> prices; private List<ItemPriceDisplay> prices;
private List<ItemDescriptionDisplay> descr; private List<ItemDescriptionDisplay> descr;
private List<ItemClassDisplay> rarity; private List<ItemClassDisplay> rarity;
private List<ItemIconDisplay> icons;
private void Awake() private void Awake()
{ {
UpdateComponentInfo(); UpdateComponentInfo();
@ -31,6 +32,7 @@ public class ViewItemInfoPanel : MonoBehaviour
prices = GetComponentsInChildren<ItemPriceDisplay>().ToList(); prices = GetComponentsInChildren<ItemPriceDisplay>().ToList();
descr = GetComponentsInChildren<ItemDescriptionDisplay>().ToList(); descr = GetComponentsInChildren<ItemDescriptionDisplay>().ToList();
rarity = GetComponentsInChildren<ItemClassDisplay>().ToList(); rarity = GetComponentsInChildren<ItemClassDisplay>().ToList();
icons = GetComponentsInChildren<ItemIconDisplay>().ToList();
//if (names == null) names = ; //if (names == null) names = ;
// TODO: Create and add all other types in here as components! // TODO: Create and add all other types in here as components!
} }
@ -74,5 +76,10 @@ public class ViewItemInfoPanel : MonoBehaviour
{ {
itemClass.SetClass(item.rarity); itemClass.SetClass(item.rarity);
} }
foreach (var icon in icons)
{
icon.SetIcon(item.iconName);
}
} }
} }

Loading…
Cancel
Save