Exemple #1
0
    public void TapHasOccured()
    {
        if (ItemTouchController.hasItemBeenPlaced == false)
        {
            Debug.Log("tap occured");
            ItemTouchController.PlayAudio();

            ItemTouchController.hasItemBeenPlaced = true;
            if (ItemTouchController.GetItemAutoRotate() == true)
            {
                ItemTouchController.GetGameObjectToPlace().transform.position = LastPlacementPos;
            }

            Animator anim = ItemTouchController.GetGameObjectToPlace().GetComponentInChildren <Animator>();
            if (anim != null)
            {
                anim.ResetTrigger("PickUp");
                anim.SetTrigger("Land");
            }
            Quaternion fixedRotataion = Quaternion.Euler(0, ItemTouchController.GetGameObjectToPlace().transform.eulerAngles.y, 0);
            ItemTouchController.GetGameObjectToPlace().transform.rotation = fixedRotataion;
            SetPlaneOn(false);
            ItemTouchController.CanRotate();
            ItemTouchController.SetItemAutoRotate(true);
            ItemTouchController.ItemToSetIntoPlacer = null;
            ItemTouchController = null;
        }
    }
Exemple #2
0
    public void CheckTouchType()
    {
        if (EventSystem.current.IsPointerOverGameObject() ||
            EventSystem.current.currentSelectedGameObject != null)
        {
            HideItem();
            ItemTouchController = null;
            return;
        }



        if (Application.isEditor)
        {
            if (Input.GetMouseButtonUp(0))
            {
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;

                if (Physics.Raycast(ray, out hit, 500f, layerMask))
                {
                    TapHasOccured();
                }
                else
                {
                    ItemTouchController.PressUp();     // this removes icon bug
                    HideItem();
                    if (ItemTouchController != null)
                    {
                        ItemTouchController.NullOldClone();
                    }
                }
            }
        }
        else
        {
            if (Input.touchCount == 1)
            {
                Touch touch = Input.GetTouch(0);


                if (touch.phase == TouchPhase.Ended)
                {
                    if (m_SessionOrigin.Raycast(touch.position, s_Hits, TrackableType.PlaneWithinPolygon))
                    {
                        Pose hitPose = s_Hits[0].pose;
                        TapHasOccured();
                    }
                    else
                    {
                        ItemTouchController.PressUp();
                        HideItem();
                        ItemTouchController.NullOldClone();
                    }
                }
            }
        }
    }
Exemple #3
0
 public void RemoveItemToPlace()
 {
     ItemTouchController = null;
     SetPlaneOn(false);
 }
Exemple #4
0
 public void SetNewGameObjectToPlace(ItemTouchConnection ItemTouchController)
 {
     ShouldWeHideIt();
     this.ItemTouchController = ItemTouchController;
     SetPlaneOn(true);
 }