Adding mute button.

This commit is contained in:
Anonymous Raccoon
2018-08-14 10:40:14 +02:00
parent ee6fa6381c
commit 488d737dc5
2 changed files with 164 additions and 0 deletions

View File

@@ -526,6 +526,162 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 1472403156812664, guid: 89e9215b05511f648b3306ce05aae35f,
type: 2}
m_PrefabInternal: {fileID: 1832592737}
--- !u!1 &295683769
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 295683770}
- component: {fileID: 295683772}
- component: {fileID: 295683771}
m_Layer: 5
m_Name: TextMeshPro Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &295683770
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 295683769}
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: 2138102597}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -314.19, y: 37}
m_SizeDelta: {x: 438.93, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &295683771
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 295683769}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_text: Press R to Retry, N to switch mission and M to mute music
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: ec3cd6eedf31b8240acafae391fca301, type: 2}
m_sharedMaterial: {fileID: 21461864525935096, guid: ec3cd6eedf31b8240acafae391fca301,
type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_outlineColor:
serializedVersion: 2
rgba: 4278190080
m_fontSize: 15
m_fontSizeBase: 15
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_textAlignment: 514
m_isAlignmentEnumConverted: 1
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_firstOverflowCharacterIndex: -1
m_linkedTextComponent: {fileID: 0}
m_isLinkedTextComponent: 0
m_isTextTruncated: 0
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_ignoreRectMaskCulling: 0
m_ignoreCulling: 1
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_firstVisibleCharacter: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 295683771}
characterCount: 57
spriteCount: 0
spaceCount: 12
wordCount: 13
linkCount: 0
lineCount: 1
pageCount: 1
materialCount: 1
m_havePropertiesChanged: 0
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_spriteAnimator: {fileID: 0}
m_isInputParsingRequired: 0
m_inputSource: 0
m_hasFontAssetChanged: 0
m_subTextObjects:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &295683772
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 295683769}
m_CullTransparentMesh: 0
--- !u!1 &298978967
GameObject:
m_ObjectHideFlags: 0
@@ -14220,6 +14376,7 @@ MonoBehaviour:
- {fileID: 11400000, guid: 8078b45f9a3232446956ed5fdd47ddb8, type: 2}
- {fileID: 11400000, guid: 372baa95be60a3c479f80c3e34781e9d, type: 2}
turnCount: {fileID: 972967528}
music: {fileID: 508468660}
slots:
- {fileID: 793124532}
- {fileID: 1181635282}
@@ -15523,6 +15680,7 @@ RectTransform:
- {fileID: 972967527}
- {fileID: 1264435081}
- {fileID: 1470635747}
- {fileID: 295683770}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@@ -13,6 +13,7 @@ public class InventoryManager : MonoBehaviour
public Tilemap selectorMap;
public TileBase[] selector;
public TextMeshProUGUI turnCount;
public AudioSource music;
[Space]
public GameObject[] slots;
@@ -80,6 +81,10 @@ public class InventoryManager : MonoBehaviour
GetComponent<Pokedex>().UpdateMissionText();
turnCount.text = "Turn: 01";
}
if (Input.GetKeyDown(KeyCode.M))
{
music.mute = !music.mute;
}
}
private bool CanPlantAt(Vector3 position, TreeItem item)
@@ -153,6 +158,7 @@ public class InventoryManager : MonoBehaviour
public void PlaceRandomTrees(int number)
{
TreeItem[] trees = items.Where(x => x.type != TreeType.Nothing).ToArray();
preSpawnedTree = new Dictionary<int, TreeType>();
for (int i = 0; i < number; i++)
{
TreeItem tree = trees[Random.Range(0, trees.Length)];