예제 #1
0
        } //END IsInputInStartPhase

        //------------------------------------//
        private void CheckIfLeanSelectableShouldBeDisabled()
        //------------------------------------//
        {

#if LEANTOUCH
            if( RequireCollider() && leanSelectable != null && leanSelectable.IsSelected )
            {
                if( LeanTouch.Fingers != null && LeanTouch.Fingers.Count < 1 )
                {
                    leanSelectable.Deselect();
                }
                else if( LeanTouch.Fingers == null )
                {
                    leanSelectable.Deselect();
                }
            }
#endif

        } //END CheckIfLeanSelectableShouldBeDisabled
 /// <summary>
 ///
 /// </summary>
 /// <param name="gameObject"></param>
 /// <param name="selectable"></param>
 private void HandleIncludeChildren(GameObject gameObject, LeanSelectable selectable)
 {
     foreach (Transform child in gameObject.transform)
     {
         LeanSelectable s = AddSelectableComponent(child.gameObject);
         s.DeselectOnUp = true;
         s.OnSelect.AddListener((LeanFinger finger) =>
         {
             selectable.Select(finger);
         });
         s.OnDeselect.AddListener(() =>
         {
             selectable.Deselect();
         });
     }
 }
예제 #3
0
    private void JumpOutward()
    {
        leanSelectable.Deselect();

        // Random stuff
        randAngle = Random.Range(0, 360);

        // Angle rotation to vector
        var presentRotation = Quaternion.AngleAxis(randAngle, Vector3.forward) * Vector3.right;

        // Add Force
        if (kind == Kind.Random)
        {
            rb.AddForce(presentRotation.normalized * randForce * 50);
        }
        else if (kind == Kind.Up)
        {
            Vector2 upRight = new Vector2(-0.3f, 1);
            rb.AddForce(upRight.normalized * randForce * 50);
        }

        // Random next time
        randTime = Random.Range(minTimeRange, maxTimeRange);
    }