Warnings for Tags/Layers

This commit is contained in:
Antoine H 2020-12-07 17:22:30 +01:00
parent c710d3c38e
commit 00211b3170
3 changed files with 18 additions and 11 deletions

View file

@ -50,8 +50,10 @@ public class Client_controller : MonoBehaviour
// Start is called before the first frame update
void Start()
{
//Needs to be on Interactions layer and have the Client tag to work properly
gameObject.tag = "Client"; //Force gameobject tag
if(gameObject.layer != LayerMask.NameToLayer("Interactions"))
Debug.LogWarning(gameObject.name+" layer should be set to 'Interactions' to work properly");
if(gameObject.tag != "Client")
Debug.LogWarning(gameObject.name+" tag should be set to 'Client' to work properly");
}
// Update is called once per frame

View file

@ -44,8 +44,10 @@ public class Mug : MonoBehaviour, IGrabable
// Start is called before the first frame update
void Start()
{
//Needs to be on Interactions layer and have the Mug tag to work properly
gameObject.tag = "Mug"; //Force gameobject tag
if(gameObject.layer != LayerMask.NameToLayer("Interactions"))
Debug.LogWarning(gameObject.name+" layer should be set to 'Interactions' to work properly");
if(gameObject.tag != "Mug")
Debug.LogWarning(gameObject.name+" tag should be set to 'Mug' to work properly");
}
// Update is called once per frame

View file

@ -10,8 +10,8 @@ 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 product
GameObject currentMug = null; //Mug currently stocked in workshop
public 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
@ -20,22 +20,22 @@ 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 && !mug.dirty && _stock>0) //Mug clean & empty + remaining stock in workshop
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));
_stock--;
stock--;
return false;
}
else
{
Debug.Log(object_used.name+" cannot be filled with "+product_name+ " -stock:"+_stock);
Debug.Log(object_used.name+" cannot be filled with "+product_name+ " -stock:"+stock);
return false;
}
}
else
{
Debug.Log("Display order (or something else) of "+gameObject.name);
Debug.Log(gameObject.name+" doesn't handle : "+object_used);
return false;
}
}
@ -43,7 +43,10 @@ public class Workshop : MonoBehaviour
// Start is called before the first frame update
void Start()
{
if(gameObject.layer != LayerMask.NameToLayer("Interactions"))
Debug.LogWarning(gameObject.name+" layer should be set to 'Interactions' to work properly");
if(gameObject.tag != "Workshop")
Debug.LogWarning(gameObject.name+" tag should be set to 'Workshop' to work properly");
}
// Update is called once per frame