void MapAction(interactionsP1 p1Action, interactionsP2 p2Action, sCashierAction action) { var interaction = new sDoubleInteraction() { p1Input = p1Action, p2Input = p2Action, action = action, }; m_interactionList.Add(interaction); }
public void MakeAction(sCashierAction action) { if (action.eAction == eCashierActions.Grab) { //The article is on the tray and you pressed to grab it! var picked = GetZone(eZones.Tray).GetArticle(action.eArticle); if (picked != null) { GetZone(eZones.Hand).MoveArticleHere(picked); picked.m_processingList.RemoveAt(0); } } if (action.eAction == eCashierActions.Scan || action.eAction == eCashierActions.Scale) { var picked = GetZone(eZones.Hand).GetArticle(); if (picked != null) { if (picked.m_processingList[0] == action.eAction) { var cashRegister = GetZone(eZones.CashRegister) as CashRegister; cashRegister?.m_invoice.Add(picked.m_articleData); } GetZone(eZones.Bag).MoveArticleHere(picked); picked.m_processingList.RemoveAt(0); } } if (action.eAction == eCashierActions.CashRegister) { var cashRegister = GetZone(eZones.CashRegister) as CashRegister; if (cashRegister != null) { var hand = GetZone(eZones.Hand); var picked = hand.GetArticle(); if (picked != null) { if (cashRegister.m_isOpen) { // We've put the whatever inside the register. picked.m_processingList.RemoveAt(0); cashRegister.MoveArticleHere(picked); } else { // We tried to put the payment in a closed register, so we drop it. hand.RemoveArticle(picked); Destroy(picked.gameObject); } } cashRegister.Toggle(); } } if (action.eAction == eCashierActions.Client) { var tray = GetZone(eZones.Tray); var client = GetZone(eZones.Client); var hand = GetZone(eZones.Hand); var picked = hand.GetArticle(); if (picked != null) { // We've given the client whatever thingy we had in hand. client.MoveArticleHere(picked); } else { // We've taken the payment from the client. var payment = tray.m_currentArticles.Any() ? null : client.GetArticle(eArticles.Payment); if (payment != null) { hand.MoveArticleHere(payment); } } } }