Add Workshop (+tag)

This commit is contained in:
Antoine H 2020-12-05 13:38:13 +01:00
parent 16248cdf16
commit 538f05aa15
6 changed files with 114 additions and 15 deletions

View file

@ -7,18 +7,27 @@ public class Client_controller : MonoBehaviour
{
public float consumeTime = 3.0f; //Time to consume currentMug
public float waitingTime = 10.0f; //Patience after ordering
GameObject currentMug;
GameObject currentMug = null;
//Return wether the object is taken from tavernkeeper
public bool use(GameObject object_used)
{
if(object_used != null && object_used.tag=="Mug")
if(currentMug is null) //No mug in hand
{
Mug mug = object_used.GetComponent<Mug>();
if (mug.content != null)
if(object_used != null && object_used.tag=="Mug")
{
Debug.Log(gameObject.name+" take "+object_used.name+ " of "+mug.content.Type);
currentMug = object_used;
return true; //Object taken from tavernkeeper
Mug mug = object_used.GetComponent<Mug>();
if (mug!= null && mug.content != null)
{
Debug.Log(gameObject.name+" take "+object_used.name+ " of "+mug.content.Type);
currentMug = object_used;
return true;
}
else
{
Debug.Log("Display order (or something else) of "+gameObject.name);
return false;
}
}
else
{
@ -28,8 +37,8 @@ public class Client_controller : MonoBehaviour
}
else
{
Debug.Log("Display order (or something else) of "+gameObject.name);
return false; //Object not taken from tavernkeeper
Debug.Log(gameObject.name+" already consumming "+currentMug.name);
return false;
}
}