Example #1
0
    public void OnFingerDown(Lean.LeanFinger finger)
    {
        //Debug.Log("OnFingerDown called by " + gameObject.name);
        // Raycast information
        Ray        ray = finger.GetRay(CameraToUse);
        RaycastHit hit;

        //Debug.DrawRay(CameraToUse.transform.position, CameraToUse.transform.forward, Color.green, 10, true);

        //Debug.Log(ray.origin);
        //Debug.Log(transform.position + "HI");

        // Was this finger pressed down on a collider?

        if (Physics.Raycast(ray, out hit, Mathf.Infinity, LayerMask) == true)
        {
            //Debug.Log(hit.transform.name);
            // Was that collider this one?
            if (hit.collider.gameObject == gameObject)
            {
                //Debug.Log("Touched " + hit.collider.gameObject.name);
                // Set the current finger to this one
                draggingFinger = finger;
            }
        }
    }
Example #2
0
    /*protected virtual void LateUpdate()
     * {
     *      // If there is an active finger, move this GameObject based on it
     *      if (draggingFinger != null)
     *      {
     *              Lean.LeanTouch.MoveObject(transform, draggingFinger.DeltaScreenPosition);
     *      }
     * }*/

    public void OnFingerDown(Lean.LeanFinger finger)
    {
        // Raycast information
        var ray = finger.GetRay();
        var hit = default(RaycastHit);

        // Was this finger pressed down on a collider?
        if (Physics.Raycast(ray, out hit, float.PositiveInfinity, LayerMask) == true)
        {
            // Was that collider this one?
            if (hit.collider.gameObject == gameObject)
            {
                // Set the current finger to this one
                draggingFinger = finger;
                if (Collected == false)
                {
                    //play fireworks animation
                    //gameObject.GetComponent<SpinScript>().spinning = true;
                    gameControl.chestsCollected++;
                    Collected = true;
                    gameControl.chestNumbersList.Add(targetNumber);
                    gameControl.saveChests();
                }
            }
        }
    }
    //Method while tap or selecting the character
    public void OnFingerTap(Lean.LeanFinger finger)
    {
        // Does the prefab exist?
        // Make sure the finger isn't over any GUI elements
        if (finger.IsOverGui == false)
        {
            var ray = finger.GetRay();
            var hit = default(RaycastHit);

            // Was this finger pressed down on a collider?
            if (Physics.Raycast(ray, out hit, float.PositiveInfinity, LayerMask) == true)
            {
                // The collider is the player1 zarapa boy
                if (hit.collider.gameObject.name == "Player1")
                {
                    charNameText.text = charName + "Zarapa Boy";
                    PlayerPrefs.SetString("gender", "man");
                }
                // The collider is the player2 zarapa girl
                else if (hit.collider.gameObject.name == "Player2")
                {
                    charNameText.text = charName + "Zarapa Girl";
                    PlayerPrefs.SetString("gender", "woman");
                }
            }
        }
    }
Example #4
0
    public void OnFingerDown(Lean.LeanFinger finger)
    {
        // Raycast information
        Ray        ray = finger.GetRay(CameraToUse);
        RaycastHit hit;

        if (MySceneController.GetComponent <SceneController>().LockTarget == false)
        {
            // Was this finger pressed down on a collider?
            if (Physics.Raycast(ray, out hit, Mathf.Infinity, LayerMask) == true)
            {
                // Was that collider this one?
                if ((hit.collider.gameObject.transform.parent == gameObject.transform.parent) && (hit.collider.gameObject.layer != 9) && (!Studied))
                {
                    // Set the current finger to this one
                    draggingFinger = finger;

                    _SceneControllerRef._selected          = hit.collider.gameObject.transform.parent.gameObject;
                    _SceneControllerRef.SelectedObjectType = MySceneController.GetComponent <SceneController>()._selected.GetComponent <OrbitalMovement>().MyObjectType.ToString();
                    Capi.set("Globals.SelectedObject", MySceneController.GetComponent <SceneController>()._selected.name);
                    Capi.set("Globals.SelectedObjectType", MySceneController.GetComponent <SceneController>()._selected.GetComponent <OrbitalMovement>().MyObjectType.ToString());

                    CUPCamera.gameObject.GetComponent <CloseUpCamera>().SetMinAndMaxZoom(CloseUpMaxDistance, CloseUpMinDistance, CloseUpStartPercentage);

                    Reticle = GameObject.Find("Reticle ENV");

                    Reticle.GetComponent <ReticleTracker>().FacingIndicator.transform.position = MySceneController.GetComponent <SceneController>()._selected.transform.position;

                    if (Studied)
                    {
                        Reticle.transform.GetChild(0).GetComponent <Image>().sprite = Reticle.GetComponent <ReticleTracker>().BadTargetReticle;
                        //Reticle.GetComponent<Image>().color = Color.red;
                        Reticle.GetComponent <RectTransform>().localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f);
                    }
                    else
                    {
                        //Debug.Log("CHECK");
                        Reticle.transform.GetChild(0).GetComponent <Image>().sprite = Reticle.GetComponent <ReticleTracker>().OriginalImage;
                        //Reticle.GetComponent<Image>().color = Color.yellow;
                        Reticle.GetComponent <RectTransform>().localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f);
                    }

                    RepositionReticle(MySceneController.GetComponent <SceneController>()._selected);

                    //UpdateOrbitalZoneInfo();

                    CUPCamera.gameObject.GetComponent <CloseUpCamera>().target = MySceneController.GetComponent <SceneController>()._selected.transform;
                    MyFactoidController.CurrentDataset = transform.parent.GetComponent <OrbitalMovement>();
                    MyFactoidController.FixMyFactoids();
                    //_SceneControllerRef.ProbeTargetLabel.text = hit.collider.gameObject.transform.parent.gameObject.name;
                    _SceneControllerRef.TriggerCheckEvent();
                }
            }
        }
    }
    public void OnFingerDown(Lean.LeanFinger finger)
    {
        var ray       = finger.GetRay();          //fires ray with ScreenToWorld at finger pos using LeanTouch
        int layerMask = (1 << 8);                 //ground layer

        CamActive = true;
        if (Physics.Raycast(ray, out hit, 1500, layerMask))
        {
            InitialHit = hit.point;
        }
    }
    void OnFingerDown(Lean.LeanFinger finger)
    {
        //If the touch isn't over a GUI we send a raycast to the world
        if (!finger.IsOverGui)
        {
            Ray ray = finger.GetRay();

            if (!Physics.Raycast(ray, out hitInfo, Mathf.Infinity, ~layerMask) && UIController.Instance.ActiveMenu != null)
            {
                UIController.Instance.ActiveMenu.SetActive(false);
                UIController.Instance.ActiveMenu = null;
            }
        }
    }
Example #7
0
    public void OnFingerDown(Lean.LeanFinger finger)
    {
        // Raycast information
        var ray = finger.GetRay();
        var hit = default(RaycastHit);

        // Was this finger pressed down on a collider?
        if (Physics.Raycast(ray, out hit, float.PositiveInfinity, LayerMask) == true)
        {
            // Was that collider this one?
            if (hit.collider.gameObject == gameObject)
            {
                // Set the current finger to this one
                draggingFinger = finger;
            }
        }
    }
Example #8
0
    public void OnFingerTap(Lean.LeanFinger finger)
    {
        // Raycast information
        var ray = finger.GetRay();
        var hit = default(RaycastHit);

        // Was this finger pressed down on a collider?
        if (Physics.Raycast(ray, out hit, float.PositiveInfinity, LayerMask) == true)
        {
            // Remove the color from the currently selected one?
            if (SelectedGameObject != null)
            {
                ColorGameObject(SelectedGameObject, Color.white);
            }

            SelectedGameObject = hit.collider.gameObject;

            ColorGameObject(SelectedGameObject, Color.green);
        }
    }
Example #9
0
    public void OnFingerDown(Lean.LeanFinger finger)
    {
        // Does the prefab exist?
        Ray        ray = finger.GetRay(MyCamera);
        RaycastHit hit;

        //Debug.DrawLine(MyCamera.transform.position, transform.position);
        Debug.DrawRay(MyCamera.transform.position, MyCamera.transform.forward);

        // Was this finger pressed down on a collider?
        if (Physics.Raycast(ray, out hit, Mathf.Infinity, 13) == true)
        {
            Debug.Log("I hit a " + hit.collider.name);
            // Was that collider this one?
            if ((hit.collider.gameObject.transform.parent == gameObject.transform.parent) && (hit.collider.gameObject.layer == 13))
            {
                // Set the current finger to this one
                MyFinger = finger;
                Debug.Log("DEM TAPS");
            }
        }
    }
Example #10
0
    /*protected virtual void LateUpdate()
     * {
     * // If there is an active finger, move this GameObject based on it
     * if (draggingFinger != null)
     * {
     *      Lean.LeanTouch.MoveObject(transform, draggingFinger.DeltaScreenPosition);
     * }
     * }*/

    public void OnFingerDown(Lean.LeanFinger finger)
    {
        // Raycast information
        var ray = finger.GetRay();
        var hit = default(RaycastHit);

        // Was this finger pressed down on a collider?
        if (Physics.Raycast(ray, out hit, float.PositiveInfinity, LayerMask) == true)
        {
            // Was that collider this one?
            if (hit.collider.gameObject == gameObject)
            {
                // Set the current finger to this one
                draggingFinger = finger;
                //Show treasure Card
                if (Collected == false)
                {
                    gameControl.chestsCollected++;
                    Collected = true;
                    gameControl.chestNumbersList.Add(targetNumber);
                }
            }
        }
    }