public void deleteAllItemsInPosition(CounterPosition counterPosition) { Debug.Log("counter Pos: " + counterPosition); List <GameObject> items = makeListOfItems(counterPosition); for (int i = items.Count - 1; i > -1; i--) { Destroy(items[i]); } }
public Item getItemOnSpecificCounter(CounterPosition counterPosition) { List <GameObject> counters = getAllCounters(); CounterContoller controller = null; for (int i = 0; i < counters.Count; i++) { controller = counters[i].GetComponent <CounterContoller>(); if (controller.myCounterPosition == counterPosition) { i = counters.Count; } } return(controller.currentItemHeld); }
// Public Functions public List <GameObject> makeListOfItems(CounterPosition counterPosition) { List <GameObject> items = new List <GameObject>(); switch (counterPosition) { case CounterPosition.BACK_LEFT: items = GameObject.FindGameObjectsWithTag("BackLeft").ToList(); break; case CounterPosition.BACK_CENTER: items = GameObject.FindGameObjectsWithTag("BackCenter").ToList(); break; case CounterPosition.BACK_RIGHT: items = GameObject.FindGameObjectsWithTag("BackRight").ToList(); break; case CounterPosition.FRONT_LEFT: items = GameObject.FindGameObjectsWithTag("FrontLeft").ToList(); break; case CounterPosition.FRONT_CENTER: items = GameObject.FindGameObjectsWithTag("FrontCenter").ToList(); break; case CounterPosition.FRONT_RIGHT: items = GameObject.FindGameObjectsWithTag("FrontRight").ToList(); break; case CounterPosition.HAT: items = GameObject.FindGameObjectsWithTag("Hat").ToList(); break; default: Debug.Log("Wrong counter position"); break; } return(items); }
public void setItemHeldOnCounter(CounterPosition counterPosition, Item item) { List <GameObject> counters = getAllCounters(); CounterContoller controller = null; for (int i = 0; i < counters.Count; i++) { controller = counters[i].GetComponent <CounterContoller>(); if (controller.myCounterPosition == counterPosition) { i = counters.Count; } } if (counterPosition == CounterPosition.HAT) { stateManager.setItemInHat(item); } controller.setCurrentItemHeld(item); }
// Private Functions private void setChefCounterPosition() { if (currentPlayerDirection == PlayerDirection.UP && currentPlayerPosition == PlayerPostion.LEFT) { chefCounterPosition = CounterPosition.BACK_LEFT; } else if (currentPlayerDirection == PlayerDirection.UP && currentPlayerPosition == PlayerPostion.CENTER) { chefCounterPosition = CounterPosition.BACK_CENTER; } else if (currentPlayerDirection == PlayerDirection.UP && currentPlayerPosition == PlayerPostion.RIGHT) { chefCounterPosition = CounterPosition.BACK_RIGHT; } else if (currentPlayerDirection == PlayerDirection.DOWN && currentPlayerPosition == PlayerPostion.LEFT) { chefCounterPosition = CounterPosition.FRONT_LEFT; } else if (currentPlayerDirection == PlayerDirection.DOWN && currentPlayerPosition == PlayerPostion.CENTER) { chefCounterPosition = CounterPosition.FRONT_CENTER; } else if (currentPlayerDirection == PlayerDirection.DOWN && currentPlayerPosition == PlayerPostion.RIGHT) { chefCounterPosition = CounterPosition.FRONT_RIGHT; } else if (currentPlayerPosition == PlayerPostion.STORAGE) { chefCounterPosition = CounterPosition.STORAGE; } }
private void setNewItemsTag(CounterPosition counterPosition, GameObject newItem) { switch (counterPosition) { case CounterPosition.BACK_LEFT: newItem.tag = "BackLeft"; break; case CounterPosition.BACK_CENTER: newItem.tag = "BackCenter"; break; case CounterPosition.BACK_RIGHT: newItem.tag = "BackRight"; break; case CounterPosition.FRONT_LEFT: newItem.tag = "FrontLeft"; break; case CounterPosition.FRONT_CENTER: newItem.tag = "FrontCenter"; break; case CounterPosition.FRONT_RIGHT: newItem.tag = "FrontRight"; break; case CounterPosition.HAT: newItem.tag = "Hat"; break; default: Debug.Log("Wrong counterPosition"); break; } }