Fix Cleaning_workshop for multiple Mugs
This commit is contained in:
parent
e2a9931788
commit
8c2c988c70
4 changed files with 82 additions and 9 deletions
|
@ -21,14 +21,6 @@ public class Cleaning_workshop : Workshop
|
|||
if (mug!= null)
|
||||
{
|
||||
Debug.Log(userObject.name+ " stocked in "+gameObject.name);
|
||||
if(mug.content != null)//Empty mug
|
||||
{
|
||||
mug.consume();
|
||||
prepTimer=0.0f;
|
||||
}
|
||||
else if(!mug.dirty)//Mug already clean
|
||||
prepTimer=prepTime;
|
||||
|
||||
stock.Add(userObject);
|
||||
|
||||
return true; //Object taken
|
||||
|
@ -61,12 +53,23 @@ public class Cleaning_workshop : Workshop
|
|||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(currentMug!=null)
|
||||
Debug.Log(stock.Count+ " - CurrentMug: "+currentMug.name+" "+currentMug.GetComponent<Mug>().dirty);
|
||||
//Set current mug if there's stock
|
||||
if(currentMug is null && stock.Count>0)
|
||||
{
|
||||
currentMug=stock[0];
|
||||
stock.RemoveAt(0);
|
||||
|
||||
Mug mug = currentMug.GetComponent<Mug>();
|
||||
if(mug.content != null)//Empty mug
|
||||
{
|
||||
mug.consume();
|
||||
prepTimer=0.0f;
|
||||
}
|
||||
else if(!mug.dirty)//Mug already clean
|
||||
prepTimer=prepTime;
|
||||
|
||||
if(UIPrepTimer != null) //Display UI prep timer
|
||||
{
|
||||
UIPrepTimer.SetValue(prepTimer/prepTime);
|
||||
|
|
|
@ -21,7 +21,7 @@ public class Client_controller : MonoBehaviour, IUsable
|
|||
set{
|
||||
if (_availStatus.Contains(value))
|
||||
_status = value;
|
||||
Debug.Log(gameObject.name+" "+_status);
|
||||
// Debug.Log(gameObject.name+" "+_status);
|
||||
|
||||
//Switch Agent to obstacle if waiting
|
||||
if(value=="waiting")
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using UnityEngine;
|
||||
|
||||
//Define the behavior of a workshop
|
||||
//TODO : Only stock Component instead of GameObject in currentMug ?
|
||||
[RequireComponent(typeof(Collider2D))]
|
||||
public abstract class Workshop : MonoBehaviour, IUsable
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue