Beispiel #1
0
 /// <summary>
 /// Updates the bar's values based on the specified parameters
 /// </summary>
 /// <param name="currentValue">Current value.</param>
 /// <param name="minValue">Minimum value.</param>
 /// <param name="maxValue">Max value.</param>
 public virtual void UpdateBar(float currentValue, float minValue, float maxValue)
 {
     _newPercent          = HappyMath.Remap(currentValue, minValue, maxValue, startValue, endValue);
     BarProgress          = _newPercent;
     TargetFillAmount     = _newPercent;
     _lastUpdateTimestamp = Time.time;
 }
Beispiel #2
0
        protected virtual void AutoUpdate()
        {
            if (!AutoUpdating)
            {
                return;
            }

            _newPercent      = HappyMath.Remap(BarProgress, 0f, 1f, startValue, endValue);
            TargetFillAmount = _newPercent;
            //_lastUpdateTimestamp = Time.time;
        }
        public bool CheckForCapture()
        {
            Debug.Log(HappyMath.ApproximatelyEqual(shadowCaptureObject.eulerAngles.y % devideY,
                                                   objectToCapture.eulerAngles.y % devideY, 0.1f));

            if (objectToCapture.position.ApproximatelyEqual(shadowCaptureObject.position, .003f))
            {
                if (HasCaptureFlag(CaptureRotation.X) && HasCaptureFlag(CaptureRotation.Y) &&
                    HasCaptureFlag(CaptureRotation.Z))
                {
                    if (objectToCapture.rotation.ApproximatelyEqual(shadowCaptureObject.rotation, .003f))
                    {
                        captured = true;
                        return(captured);
                    }
                }

                if (HasCaptureFlag(CaptureRotation.X) && HasCaptureFlag(CaptureRotation.Y))
                {
                    if (HappyMath.ApproximatelyEqual(shadowCaptureObject.eulerAngles.x % devideX,
                                                     objectToCapture.eulerAngles.x % devideX, 3f) &&
                        HappyMath.ApproximatelyEqual(shadowCaptureObject.eulerAngles.y % devideY,
                                                     objectToCapture.eulerAngles.y % devideY, 3f))
                    {
                        captured = true;
                        return(captured);
                    }
                }

                if (HasCaptureFlag(CaptureRotation.X) && HasCaptureFlag(CaptureRotation.Z))
                {
                    if (HappyMath.ApproximatelyEqual(shadowCaptureObject.eulerAngles.x % devideX,
                                                     objectToCapture.eulerAngles.x % devideX, 3f) &&
                        HappyMath.ApproximatelyEqual(shadowCaptureObject.eulerAngles.z % devideZ,
                                                     objectToCapture.eulerAngles.z % devideZ, 3f))
                    {
                        captured = true;
                        return(captured);
                    }
                }
            }

            return(false);
        }