public PROPAGATION onMessage(string message, object data) { if (message == "inspect_rotate") { Vector3 move = (Vector3)data; bool isPillBottleWithLiquid = BagContentProperties.currentInspectedItem.category == "pills"; bool restrictMovementSpeed = isPillBottleWithLiquid; float movementAmount = move.magnitude; if (restrictMovementSpeed && movementAmount > MAX_ROTATION_MOMENTUM) { move *= (MAX_ROTATION_MOMENTUM / movementAmount); } float rotX = move.x * ROTATION_SPEED * Mathf.Deg2Rad; float rotY = move.y * ROTATION_SPEED * Mathf.Deg2Rad; transform.Rotate(Game.instance.gameCamera.transform.rotation * Vector3.up, -rotX, Space.World); transform.Rotate(Vector3.right, rotY, Space.World); } else if (message == "inspect_action") { InspectUIButton.INSPECT_TYPE action = (InspectUIButton.INSPECT_TYPE)data; actionTaken = action; PersonBagDefinition currentBagDefinition = BagHandler.instance.currentBagInspect.bagDefinition; // Send signal about action taken for this istem PubSub.publish("bag_inspect_item", new InspectActionBag(BagHandler.instance.currentBagInspect.id, BagContentProperties.currentInspectedItem, action)); if (action == InspectUIButton.INSPECT_TYPE.TRASHCAN) { currentBagDefinition.removedItems.Add(currentInspectedItem); throwAway(); } else if (action == InspectUIButton.INSPECT_TYPE.OK) { acceptItem(); } else if (action == InspectUIButton.INSPECT_TYPE.MANUAL_INSPECT) { manualInspectTrayNumber = BagContentProperties.manualInspectTrayCounter; sendItemToManualInspect(); } else if (action == InspectUIButton.INSPECT_TYPE.MANUAL_INSPECT_NEW) { manualInspectTrayNumber = ++BagContentProperties.manualInspectTrayCounter; sendItemToManualInspect(false); } else if (action == InspectUIButton.INSPECT_TYPE.POLICE) { currentBagDefinition.removedItems.Add(currentInspectedItem); callPolice(); } } return(PROPAGATION.DEFAULT); }
public int calculatePoints() { if (actionTaken == InspectUIButton.INSPECT_TYPE.UNDEFINED) { actionTaken = InspectUIButton.INSPECT_TYPE.OK; } if (Array.IndexOf(acceptableActions, actionTaken) != -1) { consequences = new Generic.CONSEQUENCE[0]; return(POINTS_ALL_FINE_ACTION); } return(0); }
private void reactOnInspectAction(InspectUIButton.INSPECT_TYPE action, BagContentProperties item) { if (action == InspectUIButton.INSPECT_TYPE.MANUAL_INSPECT || action == InspectUIButton.INSPECT_TYPE.MANUAL_INSPECT_NEW) { // TODO - Maybe don't react on 50% (ajdust level) if (ItsRandom.randomBool(personRandom)) { StartCoroutine(reactOnAction("manual")); } } else if (action == InspectUIButton.INSPECT_TYPE.TRASHCAN) { StartCoroutine(reactOnAction("throw")); } else if (action == InspectUIButton.INSPECT_TYPE.POLICE) { StartCoroutine(reactOnAction("police")); } }
private void stopTimerAndPossiblyReact(InspectUIButton.INSPECT_TYPE action, BagContentProperties item) { Misc.StopCoroutine("inspect-reaction-" + item.id); reactOnInspectAction(action, item); }
public InspectActionBag(int bagId, BagContentProperties item, InspectUIButton.INSPECT_TYPE action) { this.bagId = bagId; this.item = item; this.action = action; }