示例#1
0
        void FixedUpdate()
        {
            mouseEventProcessedThisFrame = false;

            if (isMoving)
            {
                if (onFixedMoveEnabled)
                {
                    // Updates game object position
                    if (isAffectedByBuoyancy)
                    {
                        transform.rotation   = lastComputedRotation;
                        isAffectedByBuoyancy = false;
                    }

                    MoveGameObject();
                    UpdateTransformAndVisibility();
                    CheckEvents();

                    // Follow object?
                    if (_follow)
                    {
                        float   t         = Lerp.EaseOut((map.time - followStartTime) / followDuration);
                        float   zoomLevel = Mathf.Lerp(followStartZoomLevel, followZoomLevel, t);
                        Vector2 loc       = Vector2.Lerp(followStart2DLocation, _currentMap2DLocation, t);
                        map.FlyToLocation(loc, 0, zoomLevel);
                    }
                }
            }
            else
            {
                CheckBuoyancyEffect();
            }
        }
示例#2
0
        float GetLerpT(float t)
        {
            switch (easeType)
            {
            case EASE_TYPE.EaseIn:
                return(Lerp.EaseIn(t));

            case EASE_TYPE.EaseOut:
                return(Lerp.EaseOut(t));

            case EASE_TYPE.Exponential:
                return(Lerp.Exponential(t));

            case EASE_TYPE.SmoothStep:
                return(Lerp.SmoothStep(t));

            case EASE_TYPE.SmootherStep:
                return(Lerp.SmootherStep(t));
            }
            return(t);
        }