Exemplo n.º 1
0
    public bool AttachObject(PlaceObject obj)
    {
        if (_attached == null)
        {
            var prevTile = obj.GetPlacedTile();

            if (prevTile != null)
            {
                prevTile.DetachObject();
            }

            // 순환 참조 적용. 레퍼런스 관리에 신경 쓸 것
            _attached = obj;

            obj.Attach(this);

            return(true);
        }

        return(false);
    }