using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace SoftKitty.InventoryEngine
{
///
/// This module is used to drag items around.
///
public class ItemDragManager : MonoBehaviour
{
#region Variables
public static bool isDragging = false;
public static Vector3 DropPos;
public ItemIcon DragItem;
public RectTransform Rect;
private static ItemDragManager instance;
public static ItemIcon DraggingSource;
public static bool DropReceived = true;
public static bool SplitMode = false;
public static InventoryStack SplitData;
private bool playingDeleteAnimation = false;
private float dropSpeed = 9.8F;
private float rotateSpeed = 90F;
#endregion
#region MonoBehaviour
void Start()
{
DragItem.Fav.GetComponent().color = InventorySkin.instance.FavoriteColor;
}
void Update()
{
if (playingDeleteAnimation)
{
dropSpeed += 100F * Time.deltaTime;
if (DragItem.transform.position.y > -2000F)
{
DragItem.transform.position += Vector3.down * 120F * dropSpeed * Time.deltaTime;
DragItem.transform.localEulerAngles = new Vector3(0F, 0F, DragItem.transform.localEulerAngles.z + Time.deltaTime * rotateSpeed);
}
else
{
Destroy(gameObject);
}
return;
}
else
{
dropSpeed = 9.8F;
}
if (isDragging)
{
if (!DragItem.gameObject.activeSelf) DragItem.gameObject.SetActive(true);
DragItem.Rect.position = TransferPos(InputProxy.mousePosition, Rect, GetComponentInParent