Added item trashcan and mechanic for it, fixed audio bug, v1.3.1
This commit is contained in:
@@ -23,7 +23,7 @@ public class AudioHandler : MonoBehaviour
|
||||
string filepath = "./audiosettings.txt";
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
public void Start()
|
||||
{
|
||||
cameraAudio = GameObject.Find("Main Camera").GetComponent<AudioSource>();
|
||||
playerAudio = GameObject.Find("Player").GetComponent<AudioSource>();
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace Assets.Scripts
|
||||
sw.WriteLine("Music:" + music);
|
||||
sw.WriteLine("Effects:" + effects);
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
}
|
||||
|
||||
public static void loadAudio(string path, AudioSource cameraAudio, AudioSource playerAudio)
|
||||
@@ -61,6 +62,7 @@ namespace Assets.Scripts
|
||||
sw.WriteLine("Music:0.5");
|
||||
sw.WriteLine("Effects:0.5");
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
51
Assets/Scripts/InventoryTrash.cs
Normal file
51
Assets/Scripts/InventoryTrash.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts
|
||||
{
|
||||
public class InventoryTrash : MonoBehaviour
|
||||
{
|
||||
public Texture close;
|
||||
public Texture open;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void onMouseEnter()
|
||||
{
|
||||
gameObject.GetComponent<RawImage>().texture = open;
|
||||
}
|
||||
|
||||
public void onMouseLeave()
|
||||
{
|
||||
gameObject.GetComponent<RawImage>().texture = close;
|
||||
}
|
||||
|
||||
public void deleteItem()
|
||||
{
|
||||
InventorySlot toDelete = GameObject.Find("Inventory").GetComponent<Inventory>().getDrag().GetComponent<InventorySlot>();
|
||||
if (toDelete.place == ItemPlace.BAG)
|
||||
{
|
||||
toDelete.removeItem();
|
||||
}
|
||||
else
|
||||
{
|
||||
toDelete.removeEquip();
|
||||
}
|
||||
GameObject.Find("Inventory").GetComponent<Inventory>().dragImage.GetComponent<RawImage>().color = new Color(0, 0, 0, 0);
|
||||
GameObject.Find("Inventory").GetComponent<Inventory>().dragImage.GetComponent<RawImage>().texture = null;
|
||||
GameObject.Find("Inventory").GetComponent<Inventory>().dragImage.transform.position = new Vector3(0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/InventoryTrash.cs.meta
Normal file
11
Assets/Scripts/InventoryTrash.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53ed28f6f59b2f4439ae0a7ee60258a2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -506,6 +506,7 @@ namespace Assets.Scripts
|
||||
|
||||
public void openIntroduction()
|
||||
{
|
||||
GameObject.Find("AudioHandler").GetComponent<AudioHandler>().Start();
|
||||
if (PlayerPrefs.GetInt("isLoad") == 0)
|
||||
{
|
||||
GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>().resetGame(PlayerPrefs.GetInt("cityAmount"));
|
||||
|
||||
Reference in New Issue
Block a user