34 lines
893 B
C#
34 lines
893 B
C#
using System;
|
|
using Bremsengine;
|
|
using UnityEngine;
|
|
|
|
public class Chemical : MonoBehaviour
|
|
{
|
|
public string chemicalName;
|
|
public Sprite icon;
|
|
public LayerMask potLayer;
|
|
private void OnMouseDrag()
|
|
{
|
|
transform.position = GameManager.instance.GetMouseWorldPos();
|
|
}
|
|
|
|
private void OnMouseUp()
|
|
{
|
|
//we need to detect of the object is overlapping the pot!
|
|
//i guess doing an overlap circle will work, not too intensive so it doesn't make sense to do anything complex
|
|
Collider2D isOverlapPot = Physics2D.OverlapPoint(transform.position, potLayer);
|
|
Debug.Log(isOverlapPot);
|
|
if (isOverlapPot)
|
|
{
|
|
MarisaPotionMaker.instance.AddChemical(this);
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
}
|
|
|
|
private void Break()
|
|
{
|
|
//if mouse not over pot, break lol
|
|
//gm explosion
|
|
}
|
|
}
|