Skip to content

Commit

Permalink
sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Amatsugu committed Aug 20, 2024
1 parent b60027e commit 15700ff
Show file tree
Hide file tree
Showing 8 changed files with 360 additions and 17 deletions.
18 changes: 9 additions & 9 deletions Assets/Prefabs/Tiles/Planter Box.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_SortingOrder: 2370
m_Sprite: {fileID: 21300000, guid: d2297197bb161bf40be7747398649dd4, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
Expand Down Expand Up @@ -168,7 +168,7 @@ BoxCollider2D:
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: -0.16229719}
m_Offset: {x: 0, y: -0.13}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
Expand Down Expand Up @@ -253,7 +253,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_SortingOrder: 2370
m_Sprite: {fileID: 21300000, guid: cb09b5444aaede6469a8833e1e528eb7, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
Expand Down Expand Up @@ -290,7 +290,7 @@ Transform:
m_GameObject: {fileID: 7114657223328939161}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.00999999, z: 0}
m_LocalPosition: {x: -0.131, y: 0.082, z: 0}
m_LocalScale: {x: 1, y: 0.3298, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
Expand Down Expand Up @@ -322,8 +322,8 @@ Transform:
m_GameObject: {fileID: 8579093098624931850}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -0.16061258, z: 0}
m_LocalScale: {x: 0.56, y: 0.3298, z: 1}
m_LocalPosition: {x: 0.089, y: -0.16061258, z: 0}
m_LocalScale: {x: 0.090942316, y: 0.090942316, z: 0.090942316}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7678366900620055985}
Expand Down Expand Up @@ -368,9 +368,9 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 95
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Color: {r: 0.21345346, g: 0.6754716, b: 0.17205401, a: 1}
m_SortingOrder: 862
m_Sprite: {fileID: 21300000, guid: 8aa75a720c5491d4fb2ce88ac43ceb3d, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
Expand Down
99 changes: 99 additions & 0 deletions Assets/Prefabs/UI/NewQuestWindow.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ GameObject:
- component: {fileID: 6015776351326023978}
- component: {fileID: 722606971510406869}
- component: {fileID: 8678720902481481320}
- component: {fileID: 1526789412065937981}
m_Layer: 5
m_Name: NewQuestWindow
m_TagString: Untagged
Expand Down Expand Up @@ -491,9 +492,107 @@ MonoBehaviour:
hideOnStart: 0
hideOnBlur: 0
hideInEditor: 0
openSound: {fileID: 8300000, guid: 4e63a448f1ae433449385ea0a58fdc50, type: 3}
closeSound: {fileID: 8300000, guid: c891b9d21e598ee4ba3859367650480d, type: 3}
questTracker: {fileID: 0}
questPrefab: {fileID: 4478826446047847159, guid: 9e1dd0f4b49591a45919be36b99df4b1, type: 3}
content: {fileID: 4274209332839327472}
--- !u!82 &1526789412065937981
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8493308330882180925}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &8865791903720412892
GameObject:
m_ObjectHideFlags: 0
Expand Down
99 changes: 99 additions & 0 deletions Assets/Prefabs/UI/QuestWindow.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 2167627894156268134}
- component: {fileID: 8046598268275921287}
- component: {fileID: 4558182785100788795}
- component: {fileID: 8712000343167520612}
m_Layer: 5
m_Name: QuestWindow
m_TagString: Untagged
Expand Down Expand Up @@ -97,9 +98,107 @@ MonoBehaviour:
hideOnStart: 0
hideOnBlur: 0
hideInEditor: 0
openSound: {fileID: 8300000, guid: 4e63a448f1ae433449385ea0a58fdc50, type: 3}
closeSound: {fileID: 8300000, guid: c891b9d21e598ee4ba3859367650480d, type: 3}
questTracker: {fileID: 0}
questPrefab: {fileID: 4478826446047847159, guid: cf63f36d3ede2534fb7d93219a47b718, type: 3}
content: {fileID: 5031455236733561610}
--- !u!82 &8712000343167520612
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 700276426307801321}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &735961479274091000
GameObject:
m_ObjectHideFlags: 0
Expand Down
2 changes: 2 additions & 0 deletions Assets/Prefabs/UI/ShopWindow.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,8 @@ MonoBehaviour:
- TabRoot: {fileID: 4927144272260067459}
ButtonTab: {fileID: 6339789949620172750}
buySound: {fileID: 8300000, guid: 6127f3107f0e25e4a918b7359166b94a, type: 3}
openSound: {fileID: 8300000, guid: 4e63a448f1ae433449385ea0a58fdc50, type: 3}
closeSound: {fileID: 8300000, guid: c891b9d21e598ee4ba3859367650480d, type: 3}
--- !u!82 &5447955801292949221
AudioSource:
m_ObjectHideFlags: 0
Expand Down
14 changes: 6 additions & 8 deletions Assets/Scripts/UX/ShopUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,21 @@ public class ShopTabProperties
public Button ButtonTab;
}

[RequireComponent(typeof(AudioSource))]
public class ShopUI : UIPanel
{
public ShopResource resourcePrefab;
public RectTransform content;
public ShopTabProperties[] _tabsProperties;
public AudioClip buySound;



private List<ShopResource> _shopItems = new();


private AudioSource _shopAudioSource;
// Start is called before the first frame update
protected override void Start()
{
_shopAudioSource = GetComponent<AudioSource>();
if(_shopAudioSource == null)
_shopAudioSource = gameObject.AddComponent<AudioSource>();

base.Start();
GameManager.Events.OnResourcesChange += RefreshIcons;
}
Expand All @@ -47,7 +44,7 @@ public void RefreshIcons(ResourceIdentifier _)
public override void Show()
{
base.Show();

DestroyChildren(content);
_shopItems.Clear();
var resources = GameManager.Unlocks.GetUnlocks();
Expand All @@ -59,7 +56,7 @@ public override void Show()
btn.onClick.AddListener(() =>
{
if(buySound != null)
_shopAudioSource.PlayOneShot(buySound);
audioSource.PlayOneShot(buySound);
if (GameManager.ResourcesService.SpendResources(resource.GetCost()))
GameManager.ResourcesService.AddResources((resource, 1));
});
Expand All @@ -79,6 +76,7 @@ public override void Show()

public override void Hide()
{

base.Hide();
DestroyChildren(content);
_shopItems.Clear();
Expand Down
Loading

0 comments on commit 15700ff

Please sign in to comment.