static private IEnumerator Simulate(Transform inTransform, Runtime inRuntime)
        {
            Vector3 currentEuler = inTransform.GetRotation(Axis.XYZ, inRuntime.Space);
            Vector3 deltaEuler;
            float   dt, dt2, damp;

            while (inRuntime.Duration > 0)
            {
                dt   = Routine.DeltaTime;
                dt2  = dt * dt;
                damp = inRuntime.Damping == 0 ? 1 : TweenUtil.LerpDecay(inRuntime.Damping, 1, dt);

                deltaEuler.x = deltaEuler.y = deltaEuler.z = 0;
                VectorUtil.Add(ref deltaEuler, inRuntime.Velocity, dt);
                VectorUtil.Add(ref deltaEuler, inRuntime.Acceleration, 0.5f * dt2);

                VectorUtil.Add(ref currentEuler, deltaEuler);

                inTransform.SetRotation(currentEuler, Axis.XYZ, inRuntime.Space);

                VectorUtil.Add(ref inRuntime.Velocity, inRuntime.Acceleration, dt);
                VectorUtil.Multiply(ref inRuntime.Velocity, damp);

                inRuntime.Duration -= dt;

                if (inRuntime.Callback != null)
                {
                    inRuntime.Callback(inTransform, currentEuler, inRuntime.Velocity);
                }

                yield return(null);
            }
        }
Exemplo n.º 2
0
    public virtual void hideCharacter()
    {
        TweenUtil.HideObjectTop(containerCharacter);

        InputSystem.Instance.currentDraggableUIGameObject =
            null;
    }
    private static int ITweenMoveTo(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 9);
            GameObject  gameObject       = (GameObject)ToLua.CheckUnityObject(L, 1, typeof(GameObject));
            object[]    path             = ToLua.CheckObjectArray(L, 2);
            bool        isMovetopath     = LuaDLL.luaL_checkboolean(L, 3);
            float       speedOrTimeValue = (float)LuaDLL.luaL_checknumber(L, 4);
            string      type             = ToLua.CheckString(L, 5);
            LuaFunction luafunc          = ToLua.CheckLuaFunction(L, 6);
            float       distance         = (float)LuaDLL.luaL_checknumber(L, 7);
            bool        isLookAt         = LuaDLL.luaL_checkboolean(L, 8);
            bool        isUseTime        = LuaDLL.luaL_checkboolean(L, 9);
            TweenUtil.ITweenMoveTo(gameObject, path, isMovetopath, speedOrTimeValue, type, luafunc, distance, isLookAt, isUseTime);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Exemplo n.º 4
0
        static private IEnumerator SimulateAnchorPos(RectTransform inTransform, Runtime inRuntime)
        {
            Vector3 currentPos;
            Vector3 deltaPos;
            float   dt, dt2, damp;

            while (inRuntime.Duration > 0)
            {
                dt   = Routine.DeltaTime;
                dt2  = dt * dt;
                damp = inRuntime.Damping == 0 ? 1 : TweenUtil.LerpDecay(inRuntime.Damping, 1, dt);

                deltaPos.x = deltaPos.y = deltaPos.z = 0;
                VectorUtil.Add(ref deltaPos, inRuntime.Velocity, dt);
                VectorUtil.Add(ref deltaPos, inRuntime.Acceleration, 0.5f * dt2);
                VectorUtil.Add(ref deltaPos, inRuntime.Gravity, 0.5f * dt2);

                currentPos = inTransform.anchoredPosition3D;
                VectorUtil.Add(ref currentPos, deltaPos);

                inTransform.anchoredPosition3D = currentPos;

                VectorUtil.Add(ref inRuntime.Velocity, inRuntime.Acceleration, dt);
                VectorUtil.Add(ref inRuntime.Velocity, inRuntime.Gravity, dt);
                VectorUtil.Multiply(ref inRuntime.Velocity, damp);

                inRuntime.Duration -= dt;

                if (inRuntime.Callback != null)
                {
                    inRuntime.Callback(inTransform, currentPos, inRuntime.Velocity);
                }
                yield return(null);
            }
        }
Exemplo n.º 5
0
 public void PanelAppContentStatesBack()
 {
     TweenUtil.HideObjectRight(contentPanelAppContentState);
     TweenUtil.ShowObjectLeft(contentPanelDefault);
     currentState = UIAppPanelContentState.DEFAULT;
     ////AppViewerUIPanelOverlays.Instance.HidePanelBackButton();
 }
Exemplo n.º 6
0
    // ---

    public void PanelAppContentStatesNext()
    {
        TweenUtil.HideObjectLeft(contentPanelDefault);
        TweenUtil.ShowObjectRight(contentPanelAppContentState);
        currentState = UIAppPanelContentState.APP_CONTENT_STATE;
        ////AppViewerUIPanelOverlays.Instance.ShowPanelBackButton();
    }
Exemplo n.º 7
0
    public void UpdateOverviewWorld()
    {
        GameWorld gameWorld = GameWorlds.Current;

        if (gameWorld == null)
        {
            return;
        }

        foreach (GameObjectInactive obj in containerOverview.GetList <GameObjectInactive>())
        {
            if (obj.type == BaseDataObjectKeys.overview &&
                obj.code == BaseDataObjectKeys.world)
            {
                foreach (GameObjectInactive world in containerOverview.GetList <GameObjectInactive>())
                {
                    if (world.type == BaseDataObjectKeys.world)
                    {
                        TweenUtil.HideObjectBottom(world.gameObject);
                    }
                }

                foreach (GameObjectInactive world in containerOverview.GetList <GameObjectInactive>())
                {
                    if (world.code.IsEqualLowercase(gameWorld.code))
                    {
                        TweenUtil.ShowObjectBottom(world.gameObject);
                    }
                }
            }
        }
    }
Exemplo n.º 8
0
        private IEnumerator CheckInputs()
        {
            TweenUtil.SetDefaultLerpPeriodByFramerate(60);

            while (true)
            {
                Vector3 screenPoint = Input.mousePosition;
                screenPoint.z = 10;
                Vector3 mousePoint = Camera.main.ScreenToWorldPoint(screenPoint);
                transform.position = Vector3.LerpUnclamped(transform.position, mousePoint, TweenUtil.Lerp(0.25f));

                if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    CycleRoutineUpdate(ref m_Update1, true);
                }
                else if (Input.GetKeyDown(KeyCode.Alpha2))
                {
                    CycleRoutineUpdate(ref m_Update2, true);
                }
                else if (Input.GetKeyDown(KeyCode.Alpha0))
                {
                    CycleRoutineUpdate(ref m_MasterUpdate, false);
                }

                if (Input.GetKey(KeyCode.Space))
                {
                    m_Update1.TryManuallyUpdate(Routine.DeltaTime * 2);
                    m_Update2.TryManuallyUpdate(Routine.DeltaTime * 2);
                }
                yield return(Routine.WaitForUpdate());
            }
        }
Exemplo n.º 9
0
 public void Defocus()
 {
     StopAllTweener();
     m_tweener = TweenUtil.CustomTweenFloat((val) =>
     {
         SetForcus(val);
     }, GetForcus(), LoadDeep(), FORCE_TIME).SetEase(Ease.OutCubic);
 }
Exemplo n.º 10
0
 private void StopAllTweener()
 {
     if (m_tweener != null)
     {
         TweenUtil.StopAnim(m_tweener);
         m_tweener = null;
     }
 }
Exemplo n.º 11
0
    public void HideDialog()
    {
        TweenUtil.MoveToObject(notificationPanel, Vector3.zero.WithY(positionYClosedInGame), .2f, 0f);

        //UITweenerUtil.MoveTo(notificationPanel, .2f, 0f, Vector3.zero.WithY(positionYClosedInGame));

        Invoke("DisplayNextNotification", 1);
    }
Exemplo n.º 12
0
 private void GrabGrabbable(IGrabbable grabbable)
 {
     _grabSlots.Add(grabbable);
     grabbable.OnGrab(_playerContext);
     grabbable.Transform.parent      = transform;
     grabbable.Rigidbody.isKinematic = true;
     grabbable.GrabCoroutine         = StartCoroutine(TweenUtil.EaseTransformToPoint(grabbable.Transform, _grabPivot, _grabEaseModifier, GRAB_PIVOT_SNAP_THRESHOLD));
 }
Exemplo n.º 13
0
 public virtual void FadeOutObjectNow(GameObject go)
 {
     if (go != null)
     {
         TweenUtil.FadeToObject(go, 0f, 0f, 0f);
         go.Hide();
     }
 }
Exemplo n.º 14
0
 public IEnumerator StartAnimation()
 {
     GetComponent <Rotator>().Stop();
     yield return(TweenUtil.Move(from: transform.position,
                                 to: new Vector3(5, transform.position.y, transform.position.z),
                                 time: 1,
                                 transform: transform));
 }
Exemplo n.º 15
0
    public IEnumerator MoveMouthNormalSlowly()
    {
        yield return(TweenUtil.LocalMove(normalMouse.transform.position, new Vector3(0, 0.2f, -1), 1.0f, normalMouse.transform));

        yield return(TweenUtil.LocalMove(normalMouse.transform.position, new Vector3(0, -0.2f, -1), 1.0f, normalMouse.transform));

        yield return(TweenUtil.LocalMove(normalMouse.transform.position, new Vector3(0, 0, -1), 1.0f, normalMouse.transform));
    }
Exemplo n.º 16
0
    public IEnumerator showUICo()
    {
        yield return(new WaitForSeconds(.55f));

        TweenUtil.ShowObjectBottom(backgroundUI, TweenCoord.local, true);

        //Debug.Log("GameUIPanelBackgrounds::ShowUICo");
    }
Exemplo n.º 17
0
 public virtual void FadeOutObject(GameObject go)
 {
     if (go != null)
     {
         TweenUtil.FadeToObject(go, 0f);
         go.HideObjectDelayed(1f);
     }
 }
Exemplo n.º 18
0
 public virtual void HideAllShares()
 {
     foreach (GameObjectShowItem item in
              containerShares.GetComponentsInChildren <GameObjectShowItem>(true))
     {
         TweenUtil.HideObjectBottom(item.gameObject);
         item.gameObject.HideObjectDelayed(.5f);
     }
 }
Exemplo n.º 19
0
    public virtual void showActionTools()
    {
        if (Context.Current.isWeb)
        {
            return;
        }

        TweenUtil.ShowObjectBottom(containerActionTools);
    }
Exemplo n.º 20
0
    IEnumerator StartAnimation()
    {
        while (true)
        {
            yield return(TweenUtil.Scale(from: @from, to: to, time: time, transform: transform));

            yield return(TweenUtil.Scale(from: to, to: from, time: time, transform: transform));
        }
    }
Exemplo n.º 21
0
    private void OnEnable()
    {
        if (_group is null)
        {
            return;
        }

        StartCoroutine(TweenUtil.AnimateFloat(0f, 1, 0.5f, x => _group.alpha = x));
    }
    public override void OnOpenTransition(Action onSuccess)
    {
        Image.enabled = true;

        TweenUtil.Fade(Image, 1, 0, TweenType.Linear, FadeTime, () =>
        {
            Image.enabled = false;
            onSuccess.Execute();
        });
    }
Exemplo n.º 23
0
    public override void OnActive(object data)
    {
        if (_popup != null)
        {
            _popup.OnActive(data);
        }
        var bg = GetBg();

        TweenUtil.Fade(bg, 0, TargetAlpha, TweenType.Linear, FadeTime);
    }
Exemplo n.º 24
0
    public override void OnDeactivate()
    {
        if (_popup != null)
        {
            _popup.OnDeactivate();
        }
        var bg = GetBg();

        TweenUtil.Fade(bg, TargetAlpha, 0, TweenType.Linear, FadeTime);
    }
    public virtual void HideInputObject(float time, float delay)
    {
        TweenUtil.MoveToObject(gameObject, Vector3.zero.WithY(3000), time, delay);

        //UITweenerUtil.MoveTo(
        //    gameObject,
        //    UITweener.Method.EaseInOut,
        //    UITweener.Style.Once, time, delay, Vector3.zero.WithY(3000));

        controlsVisible = false;
    }
Exemplo n.º 26
0
    public virtual void showActionAppRate()
    {
        if (Context.Current.isWeb)
        {
            return;
        }

        //Debug.Log("UIPaneCommnityShare::showActionAppRate:");

        TweenUtil.ShowObjectRight(containerActionAppRate);
    }
Exemplo n.º 27
0
 public IEnumerator MoveToSausage()
 {
     hand1.SetActive(false);
     hand2.SetActive(true);
     if (this.moveCoroutine != null)
     {
         StopCoroutine(moveCoroutine);
     }
     this.moveCoroutine = StartCoroutine(TweenUtil.Move(from: transform.position, to: sausagePosition, 1f, transform));
     yield return(this.moveCoroutine);
 }
Exemplo n.º 28
0
    public static void SetButtonColor(Image buttonTo, Color colorTo)
    {
        if (buttonTo == null)
        {
            return;
        }

        TweenUtil.ColorToObject(buttonTo.gameObject, colorTo, .5f, 0f);

        //UITweenerUtil.ColorTo(buttonTo.gameObject,
        //    UITweener.Method.Linear, UITweener.Style.Once, .5f, 0f, colorTo);
    }
Exemplo n.º 29
0
    public static void SetLabelColor(Text labelTo, Color colorTo)
    {
        if (labelTo == null)
        {
            return;
        }

        TweenUtil.ColorToObject(labelTo.gameObject, colorTo, .5f, 0f);

        //UITweenerUtil.ColorTo(labelTo.gameObject,
        //    UITweener.Method.Linear, UITweener.Style.Once, .5f, 0f, colorTo);
    }
    public virtual void AnimateObjectFadeOut(GameObject go)
    {
        if (go != null)
        {
            TweenUtil.FadeToObject(go, 0f, 2f, 0f);

            //UITweenerUtil.FadeTo(
            //    go,
            //    UITweener.Method.EaseInOut,
            //    UITweener.Style.Once,
            //    2f, 0f, 0f);
        }
    }