void OnMouseUp() { if (!script_enabled) { return; } bool slot_collision = false; RaycastHit[] hits; hits = Physics.RaycastAll(Camera.main.ScreenPointToRay(Input.mousePosition), 100.0f); int i = 0; while (i < hits.Length) { RaycastHit hit = hits[i]; if (hit.collider.gameObject.layer == 8) { Debug.Log("placing card over a slot, collision"); Debug.Log(hit.collider.gameObject.name); slot_collision = true; } i++; } //drop outside of gameBoard, go back to start position of card if (!slot_collision) { transform.position = start_pos; Debug.Log("snap card back to its start position"); game_board_manager.snappingSlot = null; return; } //snap dragging card to card slot if (game_board_manager.snappingSlot != null) { GetComponent <CardProperties>().is_placed_on_slot = true; Vector3 tmp = game_board_manager.snappingSlot.transform.position; tmp.z = -0.1f; // TODO adapt this dynamically for adaquate z axis transform.position = tmp; transform.parent = game_board_manager.snappingSlot.transform.Find("Rahmen"); //check the neighbours card for a possible fight over SlotProperty slot_property = game_board_manager.snappingSlot.GetComponent <SlotProperty>(); Debug.Log("slot id " + slot_property.getSlotID()); Debug.Log("up_id" + slot_property.slotIdUpNeighbour); Debug.Log("down_id" + slot_property.slotIdDownNeighbour); Debug.Log("left_id" + slot_property.slotIdLeftNeighbour); Debug.Log("right_id" + slot_property.slotIdRightNeighbour); fightAgainstNeighbours(slot_property.slotIdUpNeighbour, slot_property.slotIdDownNeighbour, slot_property.slotIdLeftNeighbour, slot_property.slotIdRightNeighbour); } }
set => SetValue(SlotProperty, value);