Start assignOrder
This commit is contained in:
parent
1696694db5
commit
1360a3f978
3 changed files with 19 additions and 5 deletions
|
@ -3899,6 +3899,12 @@ PrefabInstance:
|
|||
propertyPath: m_Name
|
||||
value: Vodka bottle
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6538871060898918852, guid: 3baa223794d1dea4c986a5384a835c16,
|
||||
type: 3}
|
||||
propertyPath: m_Sprite
|
||||
value:
|
||||
objectReference: {fileID: 21300000, guid: 17d59b2d4d882c04480a40119a442279,
|
||||
type: 3}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 3baa223794d1dea4c986a5384a835c16, type: 3}
|
||||
--- !u!1 &966209153
|
||||
|
|
|
@ -53,6 +53,7 @@ public class Client_controller : MonoBehaviour, IUsable
|
|||
}
|
||||
}
|
||||
|
||||
string order = "none"; //Order requested by the client
|
||||
float consumeTimer;
|
||||
float waitTimer;
|
||||
GameObject currentMug = null; //Mug currently held by the client
|
||||
|
@ -72,7 +73,7 @@ public class Client_controller : MonoBehaviour, IUsable
|
|||
if(object_used != null && object_used.tag=="Grabable")
|
||||
{
|
||||
Mug mug = object_used.GetComponent<Mug>();
|
||||
if (mug!= null && mug.content != null)
|
||||
if (mug!= null && mug.content != null && mug.content.Type==order)
|
||||
{
|
||||
status = "consuming";
|
||||
Debug.Log(gameObject.name+" "+status+" "+object_used.name+ " of "+mug.content.Type);
|
||||
|
@ -82,13 +83,13 @@ public class Client_controller : MonoBehaviour, IUsable
|
|||
}
|
||||
else
|
||||
{
|
||||
Debug.Log(gameObject.name+" doesn't want that "+object_used.name);
|
||||
Debug.Log(gameObject.name+" doesn't want that "+object_used.name+" - Request : "+order);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log(gameObject.name+" doesn't want that "+object_used.name);
|
||||
Debug.Log(gameObject.name+" doesn't want that "+object_used.name+" - Request : "+order);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -137,6 +138,7 @@ public class Client_controller : MonoBehaviour, IUsable
|
|||
{
|
||||
status="waiting";
|
||||
waitTimer=waitingTime;
|
||||
order = ClientManager.Instance.assignOrder();
|
||||
}
|
||||
|
||||
if(status=="waiting")
|
||||
|
|
|
@ -6,7 +6,7 @@ using UnityEditor;
|
|||
//Define the system managing the clients. (Singleton)
|
||||
public sealed class ClientManager : MonoBehaviour
|
||||
{
|
||||
int nbMaxClients = 1;
|
||||
int nbMaxClients = 3;
|
||||
bool clientSpawnReady = false;
|
||||
float clientSpawnTimer = 0.5f; //Intial time before first spawn (pseudo-random after that)
|
||||
float maxTimeNewClients = 2.0f;
|
||||
|
@ -79,9 +79,15 @@ public sealed class ClientManager : MonoBehaviour
|
|||
}
|
||||
|
||||
//Return a random order from available consummable
|
||||
//TODO : Check stock before assignement
|
||||
//TODO : Share available types w/ consummable
|
||||
//TODO : Give sprite
|
||||
public string assignOrder()
|
||||
{
|
||||
return "beer";
|
||||
List<string> available_types = new List<string>(new [] {"beer", "vodka"});
|
||||
|
||||
string order_type = available_types[Random.Range(0, available_types.Count)];
|
||||
return order_type;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue