public void updateLocationChanged()
 {
     if (updateLocationDropDown.GetComponent <Dropdown>().value == 0)
     {
         UL = updateLocation.fixedUpdate;
     }
     else
     {
         UL = updateLocation.update;
     }
 }
 static float secondsToFrames(float seconds, updateLocation UL)
 {
     if (UL == updateLocation.fixedUpdate)
     {
         return(seconds / Time.fixedDeltaTime);
     }
     else //updateLocation.Update
     {
         return(seconds / Time.deltaTime);
     }
 }
 static float timeToFrames(float time, unitOfTime UOT, updateLocation UL)
 {
     if (UOT == unitOfTime.frames)
     {
         return(time);
     }
     else //unitOfTime.seconds
     {
         return(secondsToFrames(time, UL));
     }
 }
Пример #4
0
        //-------------------------HELPER FUNCTIONS-------------------------

        //NOTE: this is public only so we can make our extension methods work
        public static float timeToFrames(float time, unitOfTime UOT, updateLocation UL) //Prefably calculate velocity and dont use this function directly
        {
            if (UOT == unitOfTime.frames)
            {
                return(time);
            }
            else //unitOfTime.seconds
            {
                return(secondsToFrames(time, UL));
            }
        }
    // Use this for initialization
    void Awake()
    {
        distanceToTravel = 7.5f;
        distanceSlider.GetComponent <Slider>().value = distanceToTravel;
        distanceDisplay.GetComponent <Text>().text   = distanceToTravel.ToString();

        t = .25f;
        lerpValueSlider.GetComponent <Slider>().value = t;
        maxDistanceDelta = 1f;
        moveTowardsInputField.GetComponent <InputField>().text = maxDistanceDelta.ToString();

        UL            = updateLocation.fixedUpdate;
        UOT           = unitOfTime.seconds;
        guideDistance = 10;
        distanceInputField.GetComponent <InputField>().text = guideDistance.ToString();
        guideTime = 5;
        timeInputField.GetComponent <InputField>().text = guideTime.ToString();

        points = new []
        {
            lerpPoint,
            lerpWithDeltaTimePoint,
            lerpWithFixedDeltaTimePoint,
            moveTowardsPoint,
            moveTowardsWithDeltaTimePoint,
            moveTowardsWithFixedDeltaTimePoint,
            lerpHelperPoint
        };

        labels = new[]
        {
            label1,
            label2,
            label3,
            label4,
            label5,
            label6,
            label7
        };

        prevPosition = new Vector3[7];

        prepPrivateVars();
        positionPointsOnStart();
    }
Пример #6
0
 public static float calcLerpVelocity(this float f, float guideDistance, float timeToTravel_GD, unitOfTime UOT_GD, updateLocation UL)
 {
     return(lerpHelper.calcLerpVelocity(guideDistance, lerpHelper.timeToFrames(timeToTravel_GD, UOT_GD, UL)));
 }
 public static float calcLerpValue(Color startColor, Color currColor, Color endColor, float guideDistance, float guideTime, unitOfTime UOT_GD, updateLocation UL, colorSpace CS)
 {
     return(calcLerpValue(startColor, currColor, endColor, calcLerpVelocity(guideDistance, guideTime, UOT_GD, UL), CS));
 }
        //-------------------------CALCULATE LERP VELOCITY-------------------------(NOTE: these functions are also found in colorKit)

        static float calcLerpVelocity(float guideDistance, float timeToTravel_GD, unitOfTime UOT_GD, updateLocation UL)
        {
            return(calcLerpVelocity(guideDistance, timeToFrames(timeToTravel_GD, UOT_GD, UL)));
        }
 public static float calcLerpValue(this Color startColor, Color currColor, Color endColor, float guideDistance, float guideTime, unitOfTime UOT_GD, updateLocation UL, colorSpace CS)
 {
     return(colorLerpHelper.calcLerpValue(startColor, currColor, endColor, guideDistance, guideTime, UOT_GD, UL, CS));
 }