diff --git a/Assets/Prefabs/Characters/Tavernkeeper.prefab b/Assets/Prefabs/Characters/Tavernkeeper.prefab index 96ce2c1..69a0b0b 100644 --- a/Assets/Prefabs/Characters/Tavernkeeper.prefab +++ b/Assets/Prefabs/Characters/Tavernkeeper.prefab @@ -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 diff --git a/Assets/Scripts/Mug.cs b/Assets/Scripts/Mug.cs index 5de7efe..4a08a3e 100644 --- a/Assets/Scripts/Mug.cs +++ b/Assets/Scripts/Mug.cs @@ -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 diff --git a/Assets/Scripts/Workshop.cs b/Assets/Scripts/Workshop.cs index f5e5ce6..80b6ee8 100644 --- a/Assets/Scripts/Workshop.cs +++ b/Assets/Scripts/Workshop.cs @@ -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(); - 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));