Skip to content

Commit

Permalink
fixed shop manager
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminHvidberg committed Apr 24, 2021
1 parent 0f2f58f commit aa7325b
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 46 deletions.
112 changes: 84 additions & 28 deletions Assets/Scenes/Game World.unity
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ MonoBehaviour:
- name: greeting1b
clip: {fileID: 8300000, guid: 324930ef952ced44f8baba9d5601b72f, type: 3}
volume: 0.6
pitch: 0.1
pitch: 1
spatialBlend: 0
source: {fileID: 0}
loop: 0
Expand All @@ -443,21 +443,21 @@ MonoBehaviour:
loop: 0
- name: song1
clip: {fileID: 8300000, guid: d2d225b9b9dbc814da8ed31337a2229b, type: 3}
volume: 0.3
volume: 0.15
pitch: 1
spatialBlend: 0
source: {fileID: 0}
loop: 0
- name: song2
clip: {fileID: 8300000, guid: 225e8daadfb867d409d7414c0ac367b2, type: 3}
volume: 0.3
volume: 0.15
pitch: 1
spatialBlend: 0
source: {fileID: 0}
loop: 0
- name: song3
clip: {fileID: 8300000, guid: 45c6866c6e3d9e446ba9e8d0269eb995, type: 3}
volume: 0.3
volume: 0.15
pitch: 1
spatialBlend: 0
source: {fileID: 0}
Expand Down Expand Up @@ -115053,7 +115053,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 138023830}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 29.4, y: 133.9, z: 0}
m_LocalPosition: {x: 121.6, y: 52.2, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 73652495}
Expand All @@ -115062,7 +115062,7 @@ Transform:
- {fileID: 1230992981}
- {fileID: 1295465911}
m_Father: {fileID: 0}
m_RootOrder: 9
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!95 &138023836
Animator:
Expand Down Expand Up @@ -115589,7 +115589,7 @@ Transform:
- {fileID: 488405110}
- {fileID: 491129869}
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &181224487
PrefabInstance:
Expand Down Expand Up @@ -118832,7 +118832,7 @@ Transform:
- {fileID: 1820364258}
- {fileID: 1678128635}
m_Father: {fileID: 0}
m_RootOrder: 17
m_RootOrder: 18
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &356782405
PrefabInstance:
Expand Down Expand Up @@ -121935,7 +121935,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 13
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &475920780
PrefabInstance:
Expand Down Expand Up @@ -133116,7 +133116,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 16
m_RootOrder: 17
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &497740087
PrefabInstance:
Expand Down Expand Up @@ -137864,7 +137864,7 @@ Transform:
- {fileID: 120438634}
- {fileID: 270767629}
m_Father: {fileID: 0}
m_RootOrder: 12
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &767536740
GameObject:
Expand Down Expand Up @@ -137979,8 +137979,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: 604d9a6501e05084a866e38072d0162d, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
Expand Down Expand Up @@ -580214,7 +580214,7 @@ PrefabInstance:
- target: {fileID: 3218615963001515893, guid: 9f565a371242136498da1a7475150932,
type: 3}
propertyPath: m_RootOrder
value: 20
value: 21
objectReference: {fileID: 0}
- target: {fileID: 3218615963001515893, guid: 9f565a371242136498da1a7475150932,
type: 3}
Expand Down Expand Up @@ -584277,7 +584277,7 @@ Transform:
m_Children:
- {fileID: 1386329747}
m_Father: {fileID: 0}
m_RootOrder: 14
m_RootOrder: 15
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1390286614
PrefabInstance:
Expand Down Expand Up @@ -587599,7 +587599,7 @@ Transform:
- {fileID: 853475661}
- {fileID: 1406113933}
m_Father: {fileID: 0}
m_RootOrder: 18
m_RootOrder: 19
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1521641244
PrefabInstance:
Expand Down Expand Up @@ -588133,11 +588133,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1538959221}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 29.4, y: 133.9, z: -10}
m_LocalPosition: {x: 121.6, y: 52.2, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1538959225
MonoBehaviour:
Expand Down Expand Up @@ -588453,7 +588453,7 @@ RectTransform:
- {fileID: 1218141226}
- {fileID: 331314795}
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
Expand Down Expand Up @@ -589079,7 +589079,7 @@ Transform:
- {fileID: 305813878}
- {fileID: 1540803391}
m_Father: {fileID: 0}
m_RootOrder: 15
m_RootOrder: 16
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1568526701
GameObject:
Expand Down Expand Up @@ -786458,7 +786458,7 @@ MonoBehaviour:
m_HandleRect: {fileID: 318910646}
m_Direction: 2
m_Value: 1
m_Size: 0.38495302
m_Size: 0.384953
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
Expand Down Expand Up @@ -802595,12 +802595,12 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1920132283}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 29.4, y: 133.9, z: -10}
m_LocalPosition: {x: 121.6, y: 52.2, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2053896955}
m_Father: {fileID: 0}
m_RootOrder: 11
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1921368673
PrefabInstance:
Expand Down Expand Up @@ -1155136,7 +1155136,7 @@ Transform:
- {fileID: 126699700}
- {fileID: 1802886814}
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &2006572203
PrefabInstance:
Expand Down Expand Up @@ -1165835,6 +1165835,57 @@ Transform:
m_Father: {fileID: 1571537867}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2098449796
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2098449798}
- component: {fileID: 2098449797}
m_Layer: 0
m_Name: ShopManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2098449797
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2098449796}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b7ff469da0e42954e843299a6d973468, type: 3}
m_Name:
m_EditorClassIdentifier:
itemBox: {fileID: 4346921440786638807, guid: 5272ef02cb161f846a8ff9e228ec2261, type: 3}
shopUI: {fileID: 331314794}
itemBoxParent: {fileID: 1535285065}
selectItemSprite: {fileID: 1064024771}
selectItemName: {fileID: 233455592}
selectItemDescription: {fileID: 1746939473}
btnBuy: {fileID: 767536742}
isOpen: 0
--- !u!4 &2098449798
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2098449796}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &2099965877
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1166873,7 +1166924,7 @@ PrefabInstance:
- target: {fileID: 1177651255775636478, guid: d565bd0a56c30674abdac795927fc8ee,
type: 3}
propertyPath: m_RootOrder
value: 19
value: 20
objectReference: {fileID: 0}
- target: {fileID: 1177651255775636478, guid: d565bd0a56c30674abdac795927fc8ee,
type: 3}
Expand Down Expand Up @@ -1167049,6 +1167100,11 @@ PrefabInstance:
propertyPath: m_Name
value: ItemBox
objectReference: {fileID: 0}
- target: {fileID: 4346921440786638807, guid: 5272ef02cb161f846a8ff9e228ec2261,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5272ef02cb161f846a8ff9e228ec2261, type: 3}
--- !u!1001 &5069555597215153093
Expand Down Expand Up @@ -1167191,7 +1167247,7 @@ PrefabInstance:
- target: {fileID: 7151649308056299379, guid: 738f328b548460d4c9c2883a0d2358a2,
type: 3}
propertyPath: m_RootOrder
value: 21
value: 22
objectReference: {fileID: 0}
- target: {fileID: 7151649308056299379, guid: 738f328b548460d4c9c2883a0d2358a2,
type: 3}
Expand Down Expand Up @@ -1167255,7 +1167311,7 @@ PrefabInstance:
- target: {fileID: 363026534250479395, guid: 6d1d7a0433a64a845bcaf78c335b92e0,
type: 3}
propertyPath: m_RootOrder
value: 23
value: 24
objectReference: {fileID: 0}
- target: {fileID: 363026534250479395, guid: 6d1d7a0433a64a845bcaf78c335b92e0,
type: 3}
Expand Down Expand Up @@ -1167359,7 +1167415,7 @@ PrefabInstance:
- target: {fileID: 8869736918704472803, guid: d3ca4b56c31c1c04a943cc9b57d7a653,
type: 3}
propertyPath: m_RootOrder
value: 22
value: 23
objectReference: {fileID: 0}
- target: {fileID: 8869736918704472803, guid: d3ca4b56c31c1c04a943cc9b57d7a653,
type: 3}
Expand Down
5 changes: 3 additions & 2 deletions Assets/Scripts/PlayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private void Interact(InputAction.CallbackContext obj)
break;

case "ShopVendor":
currentTrigger.gameObject.GetComponent<ShopVendor>().OpenShop(rb);
currentTrigger.gameObject.GetComponent<ShopVendor>().OpenShop(rb, this);
break;
}
}
Expand Down Expand Up @@ -206,6 +206,8 @@ public void TakeDamage(int _damage)

void openMap(InputAction.CallbackContext obj)
{
if (ShopManager.instance.isOpen == true) return;

if (Inventory.Controller.instance.isOpen == true) return;
if (DialogueManager.instance.isDialogueStarted == true) return;
isMapOpen = !isMapOpen;
Expand All @@ -216,7 +218,6 @@ void openMap(InputAction.CallbackContext obj)
g.SetActive(!g.activeSelf);
}


if (hideObjectsOnMap[0].activeSelf == true)
{
rb.constraints = RigidbodyConstraints2D.FreezePosition;
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Quest/Types/TurnInQuest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public override void CheckCompleteConditions(Collider2D _trigger, GameObject _ca
if (TurnInItem != null)
{
Inventory.Controller.instance.RemoveItems(1, TurnInItem.name);
if (followUpDialogue.Length != 0) DialogueManager.instance.StartDialogue(followUpDialogue[0]);
QuestManager.instance.CompleteActive();
}
}
Expand Down
41 changes: 41 additions & 0 deletions Assets/Scripts/Shop/ShopManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class ShopManager : MonoBehaviour
{
public static ShopManager instance;

[Header("UI")]
public GameObject itemBox;

public GameObject shopUI;

public RectTransform itemBoxParent;

[Header("Selected Item UI")]
public Image selectItemSprite;

public TextMeshProUGUI selectItemName;
public TextMeshProUGUI selectItemDescription;
public Button btnBuy;

public bool isOpen = false;

public void Awake()
{
if (instance == null)
{
instance = this;
}
else
{
Destroy(gameObject);
}

DontDestroyOnLoad(gameObject);
}

}
11 changes: 11 additions & 0 deletions Assets/Scripts/Shop/ShopManager.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit aa7325b

Please sign in to comment.