ProjetPatate/Assets/Scripts/Cleaning_workshop.cs

27 lines
840 B
C#
Raw Normal View History

2020-12-07 17:23:47 +01:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//Define the behavior of a cleaning workshop
2020-12-10 13:51:16 +01:00
public class Cleaning_workshop : Workshop
2020-12-07 17:23:47 +01:00
{
// List<GameObject> stock = new List<GameObject>(); //List of mug in workshop
//Handle objects interactions w/ Workshop
//Return wether the object is taken from tavernkeeper
2020-12-10 13:51:16 +01:00
public override bool use(GameObject object_used)
2020-12-07 17:23:47 +01:00
{
2020-12-10 13:51:16 +01:00
if(object_used != null && object_used.tag=="Grabable")
2020-12-07 17:23:47 +01:00
{
Mug mug = object_used.GetComponent<Mug>();
if (mug!= null && mug.content is null && mug.dirty) //Mug dirty & empty
{
Debug.Log(object_used.name+ "cleaned by"+gameObject.name);
mug.dirty=false;
return false;
}
}
return false;
}
}