public void OnEndDrag(PointerEventData eventData) { if (OrdersMenuController.atOrderStation && represent != null) { GraphicRaycaster gr = playerInventory.GetComponent <GraphicRaycaster>(); PointerEventData ped = new PointerEventData(null); ped.position = Input.mousePosition; List <RaycastResult> results = new List <RaycastResult>(); gr.Raycast(ped, results); if (results.Count > 0) { foreach (var item in results) { if (item.gameObject.GetComponent <OrderedMeal>() != null) { PlayerSlot.mealOrder = item.gameObject.GetComponent <OrderedMeal>().MealOrder; } } } if (represent == mealOrder.meal && Count >= mealOrder.Count && !mealOrder.completed) { mealOrder.completed = true; for (int i = 0; i < mealOrder.Count; i++) { InventoryOfPlayer.BackTransaction(represent, 1); } transform.localPosition = normalLocalPos; } else { transform.localPosition = normalLocalPos; } } }
public void Transfer() { bool execution = false; InventoryOfPlayer.BackTransaction(represent, sendQuantaty, out execution); adjuster.SetActive(false); PlayerController.kralinYarra = true; if (execution) { Station.Transaction(represent, sendQuantaty); } }
public void Create() { GetQuantaty(); GameObject Output = RecipeController.GetRecipe(); int[] takeFromInventory = new int[8]; int[] takeFromStation = new int[8]; for (int i = 0; i < 8; i++) { if (slots[i].typeOfItem != null) { if (slots[i].unitCount <= supplyCalculator(slots[i].typeOfItem, out takeFromInventory[i], out takeFromStation[i])) { } else { Debug.Log("eksik" + slots[i].typeOfItem); return; } } } for (int i = 0; i < 8; i++) { if (slots[i].unitCount * Count > takeFromStation[i]) { Station.BackTransaction(slots[i].typeOfItem, takeFromStation[i]); int surplus = (int)(slots[i].unitCount * Count - takeFromStation[i]); InventoryOfPlayer.BackTransaction(slots[i].typeOfItem, surplus); } else { Station.BackTransaction(slots[i].typeOfItem, (int)slots[i].unitCount * Count); } } PlayerController.current.GetComponent <Station>().Create(Output, Count); //GameObject[] outputAndCurrent = new GameObject[2] { Output, PlayerController.current }; //StartCoroutine("animateAndCreate", outputAndCurrent); }