예제 #1
0
        //Tweener tweener;
        protected override void OnRender(Entitas.Entity entity)
        {
            base.OnRender(entity);

            TransformComponent com_Pos  = entity.GetComponent <TransformComponent>();
            MoveComponent      com_Move = entity.GetComponent <MoveComponent>();

            if (com_Pos != null)
            {
                double lerp    = SimulationManager.Instance.GetFrameLerp() * SimulationManager.Instance.GetFrameMsLength() / 1000;/// Time.deltaTime;
                var    pos1    = com_Pos.GetPositionVector2();
                var    nextPos = pos1 + com_Move.GetDirVector2() * (com_Move.GetSpeed() * (float)(Time.deltaTime / SimulationManager.Instance.GetFrameMsLength() / 1000));

                //if (tweener != null)
                //    tweener.Kill();
                //tweener = null;

                transform.DOLocalMove(Vector2.Lerp(pos1, nextPos, (float)lerp), .5f, false);

                //transform.localPosition = Vector2.Lerp(transform.position, nextPos, (float)lerp);
            }
        }