Ejemplo n.º 1
0
 internal LandPlan(LandBuilderContribution _contrib, IULVFactory factory, Location _loc, Size _size)
     : base(factory.create(new Cube(_loc, _size.Width, _size.Height, 0)))
 {
     this.contrib = _contrib;
     this.loc     = _loc;
     this.size    = _size;
 }
Ejemplo n.º 2
0
 internal LandPlan(LandBuilderContribution _contrib, ULVFactory factory, Location _loc, SIZE _size)
     : base(factory.create(new Cube(_loc, _size.x, _size.y, 0)))
 {
     this.contrib = _contrib;
     this.loc     = _loc;
     this.size    = _size;
 }
Ejemplo n.º 3
0
        protected BulldozeController()
        {
            InitializeComponent();
            previewBitmap = ResourceUtil.loadSystemBitmap("bulldozer.bmp");
            preview.Image = previewBitmap;
            LandBuilderContribution builder = (LandBuilderContribution)PluginManager.theInstance.getContribution("{AE43E6DB-39F0-49FE-BE18-EE3FAC248FDE}");

            currentController = builder.createBuilder(new ControllerSiteImpl(this));
        }
Ejemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 public BulldozeController()
 {
     InitializeComponent();
     previewBitmap = ResourceUtil.LoadSystemBitmap("bulldozer.bmp");
     preview.Image = previewBitmap;
     LandBuilderContribution builder = (LandBuilderContribution)PluginManager.GetContribution("{AE43E6DB-39F0-49FE-BE18-EE3FAC248FDE}");
     //TODO: fix this
     //currentController = builder.createBuilder(new ControllerSiteImpl(this));
 }
Ejemplo n.º 5
0
        public override void updatePreview()
        {
            LandBuilderContribution builder = (LandBuilderContribution)indexSelector.currentItem;

            using (PreviewDrawer drawer = builder.createPreview(preview.Size))
            {
                if (previewBitmap != null)
                {
                    previewBitmap.Dispose();
                }
                preview.Image = previewBitmap = drawer.createBitmap();
            }

            currentController = builder.createBuilder(new ControllerSiteImpl(this));
        }
Ejemplo n.º 6
0
        protected Plan GetPlan(IEntityBuilder entity)
        {
            Plan p = null;

            finalPrice = 0;
            if (entity is LandBuilderContribution)
            {
                LandBuilderContribution lbc = entity as LandBuilderContribution;
                SIZE size = new SIZE(Rand(F_LandAveSize, F_LandFlexSize), Rand(F_LandAveSize, F_LandFlexSize));
                p          = new LandPlan(lbc, dev, scaning, size);
                finalPrice = lbc.price * size.x * size.y;
            }
            else if (entity is CommercialStructureContribution)
            {
                CommercialStructureContribution csb = entity as CommercialStructureContribution;
                p          = new CommercialStructurePlan(csb, dev, scaning);
                finalPrice = entity.price;
            }
            else if (entity is VarHeightBuildingContribution)
            {
                VarHeightBuildingContribution vhbc = entity as VarHeightBuildingContribution;
                int  h     = vhbc.minHeight;
                int  h2    = vhbc.maxHeight;
                int  price = vhbc.price * h;
                Cube tmp   = new Cube(scaning, vhbc.size, h);
                int  cost  = 0;
                foreach (Entity e in tmp.getEntities())
                {
                    cost += e.entityValue;
                }
                while (price < cost && h < h2)
                {
                    if (price < cost)
                    {
                        price += vhbc.price;
                    }
                    h++;
                }
                p          = new VarHeightBuildingPlan(vhbc, dev, scaning, h);
                finalPrice = price;
            }
            return(p);
        }