From 00211b31708382a0266706441eff56c279c62b2d Mon Sep 17 00:00:00 2001 From: Antoine H Date: Mon, 7 Dec 2020 17:22:30 +0100 Subject: [PATCH] Warnings for Tags/Layers --- Assets/Scripts/Client_controller.cs | 6 ++++-- Assets/Scripts/Mug.cs | 6 ++++-- Assets/Scripts/Workshop.cs | 17 ++++++++++------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Assets/Scripts/Client_controller.cs b/Assets/Scripts/Client_controller.cs index 521b9bd..ab1cce7 100644 --- a/Assets/Scripts/Client_controller.cs +++ b/Assets/Scripts/Client_controller.cs @@ -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 diff --git a/Assets/Scripts/Mug.cs b/Assets/Scripts/Mug.cs index 8cad71d..ccf7684 100644 --- a/Assets/Scripts/Mug.cs +++ b/Assets/Scripts/Mug.cs @@ -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 diff --git a/Assets/Scripts/Workshop.cs b/Assets/Scripts/Workshop.cs index c9d5cb9..9b7e8af 100644 --- a/Assets/Scripts/Workshop.cs +++ b/Assets/Scripts/Workshop.cs @@ -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(); - 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