// Update is called once per frame
 void Update()
 {
     if (transform.hasChanged)
     {
         _position = IsometricGrid.IsoTo2D(transform.position.x, transform.position.y);
         _point0   = _position + _point;
         SetPoint1();
         SnapToGrid();
         Position = _position;
         SetWorldPosition();
     }
     else if (Size != _size)
     {
         _size = Size;
         SetPoint1();
     }
     else if (Position != _position)
     {
         _position = Position;
         _point0   = _position + _point;
         SetPoint1();
         SetWorldPosition();
     }
     else if (Point != _point)
     {
         _point  = Point;
         _point0 = _position + _point;
         SetPoint1();
     }
 }
示例#2
0
        // Update is called once per frame
        void Update()
        {
            bool needSort = false;

            if (transform.hasChanged)
            {
                var point = IsometricGrid.IsoTo2D(transform.position.x, transform.position.y - _position.z);
                _position.x = point.x;
                _position.y = point.y;
                _point0     = _position + _point;
                SetPoint1();
                SnapToGrid();
                Position = _position;
                SetWorldPosition();
                needSort = true;
            }
            else if (Size != _size)
            {
                _size = Size;
                SetPoint1();
                needSort = true;
            }
            else if (Position != _position)
            {
                _position = Position;
                _point0   = _position + _point;
                SetPoint1();
                SetWorldPosition();
                needSort = true;
            }
            else if (Point != _point)
            {
                _point  = Point;
                _point0 = _position + _point;
                SetPoint1();
                needSort = true;
            }

            if (needSort)
            {
                Topological(this);
            }
        }