Add dirty attribute on Mug
This commit is contained in:
parent
e35f652c56
commit
573dc63762
3 changed files with 8 additions and 4 deletions
|
@ -165,4 +165,5 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 5222b6d867fe67f4a973336825e0ee8c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
speed: 5
|
||||
mvt_speed: 5
|
||||
action_dist: 1.5
|
||||
|
|
|
@ -7,7 +7,7 @@ using UnityEngine;
|
|||
public class Mug : MonoBehaviour, IGrabable
|
||||
{
|
||||
public int size = 1; //Size (1 or 2 hands) of the object
|
||||
// bool dirty = false;
|
||||
public bool dirty = false;
|
||||
public Consumable content= null; //new Consumable("beer",1,null);
|
||||
|
||||
public void use()
|
||||
|
@ -38,6 +38,7 @@ public class Mug : MonoBehaviour, IGrabable
|
|||
public void consume() //Empty Mug of its Consumable
|
||||
{
|
||||
content=null;
|
||||
dirty = true; //Used and dirty
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
|
|
|
@ -10,7 +10,9 @@ public class Workshop : MonoBehaviour
|
|||
public int product_value;
|
||||
public Sprite product_sprite;
|
||||
public float prepTime = 2.0f; //Time for preparation of product
|
||||
protected int _stock = 5; //Stock of prodcut
|
||||
protected int _stock = 5; //Stock of product
|
||||
|
||||
GameObject currentMug = null; //Mug currently stocked in workshop
|
||||
|
||||
//Handle objects interactions w/ Workshop
|
||||
//Return wether the object is taken from tavernkeeper
|
||||
|
@ -19,7 +21,7 @@ public class Workshop : MonoBehaviour
|
|||
if(object_used != null && object_used.tag=="Mug")
|
||||
{
|
||||
Mug mug = object_used.GetComponent<Mug>();
|
||||
if (mug!= null && mug.content is null && _stock>0)
|
||||
if (mug!= null && mug.content is null && !mug.dirty && _stock>0) //Mug clean & empty + remaining stock in workshop
|
||||
{
|
||||
Debug.Log(gameObject.name+" fill "+object_used.name+ " with "+product_name);
|
||||
mug.fill(new Consumable(product_name,product_value,product_sprite));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue