Пример #1
0
 public void LateUpdate()
 {
     _position           = _transform.position;
     _transform.position = new Vector3(
         DMath.Round(_position.x, Interval.x),
         DMath.Round(_position.y, Interval.y),
         _position.z);
 }
Пример #2
0
        public void MoveTo(Vector3 target)
        {
            float x = target.x, y = target.y;

            x += (target.x - Center.x) * GetRatio(Factor.x);
            y += (target.y - Center.y) * GetRatio(Factor.y);

            if (SnapInterval != default(Vector2))
            {
                x = DMath.Round(x, SnapInterval.x);
                y = DMath.Round(y, SnapInterval.y);
            }

            transform.position = new Vector2(x, y);
        }