示例#1
0
 public void SetUp()
 {
     containingObject = new GameObject();
     subject          = containingObject.AddComponent <FloatToBoolean>();
 }
示例#2
0
        /// <summary>
        /// Sets the boundary data for the input.
        /// </summary>
        /// <param name="newBounds">Thew new range for the bounds.</param>
        /// <param name="deadzone">The axis deadzone to set.</param>
        /// <param name="positiveBounds">The axis positive bounds to set.</param>
        /// <param name="negativeBounds">The axis negative bounds to set.</param>
        /// <param name="boundsManager">The axis bounds manager to set.</param>
        protected virtual void SetBounds(FloatRange newBounds, FloatToBoolean[] deadzone, FloatToBoolean positiveBounds, FloatToBoolean negativeBounds, FloatToBoolean boundsManager)
        {
            foreach (FloatToBoolean zone in deadzone)
            {
                zone.SetPositiveBounds(newBounds.ToVector2());
            }

            positiveBounds.SetPositiveBounds(new Vector2(newBounds.maximum, 1f));
            negativeBounds.SetPositiveBounds(new Vector2(-1f, newBounds.minimum));
            boundsManager.SetPositiveBounds(new Vector2(Mathf.Max(-1f, newBounds.minimum - BoundOverlap), Mathf.Min(newBounds.maximum + BoundOverlap, 1f)));
        }