Exemplo n.º 1
0
        public void StartBuilding(PrimitiveBuilding primitivebuilding, bool shouldCarryOnAfterDragging)
        {
            if (BuildingController.IsDragging() || Zoning.ZoneController.IsDragging())
            {
                Nez.Console.DebugConsole.instance.log("We are already building, placing or zoning.");
                return;
            }

            this.primitivebuilding = primitivebuilding;
            StartDragging(shouldCarryOnAfterDragging);
        }
Exemplo n.º 2
0
        public void StartPlacing(PrimitiveBuilding primitiveBuilding)
        {
            if (BuildingController.IsDragging() || Zoning.ZoneController.IsDragging())
            {
                Nez.Console.DebugConsole.instance.log("We are already building, placing or zoning.");
                return;
            }

            this.primitiveBuilding = primitiveBuilding;
            placingComponent.StartPlacing(primitiveBuilding.GetSize(), primitiveBuilding.CarryOnBuildingAfterPlacement(), false);

            if (entitySprite == null)
            {
                entitySprite = WorldController.SCENE.createEntity("GameplayItemPlacement sprite");
                sprite       = new Sprite();
                entitySprite.addComponent(sprite);
            }

            entitySprite.setEnabled(true);
            sprite.setSubtexture((primitiveBuilding as IBuildingStandardGameplayRenderer).GetTexture());
            sprite.setLocalOffset(new Vector2(sprite.width / 2, 0) - new Vector2(50, 0));
            placingComponent.ShouldCarryOnAfterPlaced(primitiveBuilding.CarryOnBuildingAfterPlacement());
        }