Update ItemStash for Dissapearing Pasties
This commit is contained in:
parent
fb9f847dbc
commit
fa8cffae13
@ -566,7 +566,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 353042924}
|
m_GameObject: {fileID: 353042924}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 4.28, y: 0.71000004, z: 0}
|
m_LocalPosition: {x: 7.18, y: 0.71000004, z: 0}
|
||||||
m_LocalScale: {x: 1.5, y: 1.5, z: 0.5}
|
m_LocalScale: {x: 1.5, y: 1.5, z: 0.5}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 965912684}
|
m_Father: {fileID: 965912684}
|
||||||
@ -1624,7 +1624,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1530896880}
|
m_GameObject: {fileID: 1530896880}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: -4.58, y: 0.71000004, z: 0}
|
m_LocalPosition: {x: -7.14, y: 0.71000004, z: 0}
|
||||||
m_LocalScale: {x: 1.5, y: 1.5, z: 0.5}
|
m_LocalScale: {x: 1.5, y: 1.5, z: 0.5}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 965912684}
|
m_Father: {fileID: 965912684}
|
||||||
|
@ -7,6 +7,8 @@ public class ItemStash : MonoBehaviour
|
|||||||
[Header("Dropped Item Amount")]
|
[Header("Dropped Item Amount")]
|
||||||
public int droppedItemAmount = 3;
|
public int droppedItemAmount = 3;
|
||||||
|
|
||||||
|
private GameObject[] pasties;
|
||||||
|
|
||||||
private void OnTriggerEnter2D(Collider2D other)
|
private void OnTriggerEnter2D(Collider2D other)
|
||||||
{
|
{
|
||||||
string objectTag = other.gameObject.tag;
|
string objectTag = other.gameObject.tag;
|
||||||
@ -22,8 +24,25 @@ public class ItemStash : MonoBehaviour
|
|||||||
droppedItemAmount += 1;
|
droppedItemAmount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
pasties = GameObject.FindGameObjectsWithTag("Pastie");
|
||||||
|
}
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
|
if (droppedItemAmount == 0 && pasties[0].GetComponent<SpriteRenderer>().enabled == true)
|
||||||
|
{
|
||||||
|
foreach (GameObject pastie in pasties)
|
||||||
|
{
|
||||||
|
pastie.GetComponent<SpriteRenderer>().enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (droppedItemAmount != 0 && pasties[0].GetComponent<SpriteRenderer>().enabled == false)
|
||||||
|
{
|
||||||
|
foreach (GameObject pastie in pasties)
|
||||||
|
{
|
||||||
|
pastie.GetComponent<SpriteRenderer>().enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user