2020-12-03 18:52:34 +01:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2020-12-04 13:12:01 +01:00
|
|
|
|
[RequireComponent(typeof(Collider2D))]
|
2020-12-03 18:52:34 +01:00
|
|
|
|
public class Mug : MonoBehaviour, IGrabable
|
|
|
|
|
{
|
|
|
|
|
public int size = 1; //Size (1 or 2 hands) of the object
|
2020-12-04 13:12:01 +01:00
|
|
|
|
bool dirty = false;
|
|
|
|
|
int content = 1;
|
2020-12-03 18:52:34 +01:00
|
|
|
|
|
|
|
|
|
public void use()
|
|
|
|
|
{
|
2020-12-04 13:12:01 +01:00
|
|
|
|
//Do nothing
|
2020-12-03 18:52:34 +01:00
|
|
|
|
}
|
2020-12-04 13:12:01 +01:00
|
|
|
|
public void take() //Object taken
|
2020-12-03 18:52:34 +01:00
|
|
|
|
{
|
2020-12-04 11:15:18 +01:00
|
|
|
|
gameObject.SetActive(false);
|
2020-12-03 18:52:34 +01:00
|
|
|
|
}
|
2020-12-04 11:15:18 +01:00
|
|
|
|
public void drop(Vector2 position) //Drop to position
|
2020-12-03 18:52:34 +01:00
|
|
|
|
{
|
2020-12-04 11:15:18 +01:00
|
|
|
|
gameObject.SetActive(true);
|
|
|
|
|
gameObject.transform.position = position;
|
2020-12-03 18:52:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-04 13:12:01 +01:00
|
|
|
|
public void fill(int new_content)
|
|
|
|
|
{
|
|
|
|
|
content = new_content;
|
|
|
|
|
}
|
|
|
|
|
public void consume()
|
|
|
|
|
{
|
|
|
|
|
content=0;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-03 18:52:34 +01:00
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
2020-12-04 13:12:01 +01:00
|
|
|
|
//Needs to be on Interactions layer and have the Mug tag to work properly
|
|
|
|
|
gameObject.tag = "Mug"; //Force gameobject tag
|
2020-12-03 18:52:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|