ProjetPatate/Assets/Scripts/Mug.cs

55 lines
1.2 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Collider2D))]
public class Mug : MonoBehaviour, IGrabable
{
public int size = 1; //Size (1 or 2 hands) of the object
2020-12-04 21:49:58 +01:00
// bool dirty = false;
public Consumable content= null; //new Consumable("beer",1,null);
public void use()
{
//Do nothing
}
public void take() //Object taken
{
2020-12-04 11:15:18 +01:00
gameObject.SetActive(false);
}
2020-12-04 11:15:18 +01:00
public void drop(Vector2 position) //Drop to position
{
2020-12-04 11:15:18 +01:00
gameObject.SetActive(true);
gameObject.transform.position = position;
}
2020-12-04 21:49:58 +01:00
public void fill(Consumable new_content)
{
2020-12-04 21:49:58 +01:00
if(content is null)
{
content = new_content;
}
else
{
Debug.Log(gameObject.name+" cannot be filled (already full) with "+new_content.Type);
}
}
public void consume()
{
2020-12-04 21:49:58 +01:00
content=null;
}
// 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
}
// Update is called once per frame
void Update()
{
}
}