示例#1
0
        protected override void ClientSetupExplosionBlueprint(Tile tile, IClientBlueprint blueprint)
        {
            ProcessExplosionDirection(-1, 0);  // left
            ProcessExplosionDirection(0, 1);   // top
            ProcessExplosionDirection(1, 0);   // right
            ProcessExplosionDirection(0, -1);  // bottom

            void ProcessExplosionDirection(int xOffset, int yOffset)
            {
                foreach (var(_, offsetIndex) in
                         WeaponExplosionSystem.SharedEnumerateExplosionBombermanDirectionTilesWithTargets(
                             positionEpicenter: tile.Position.ToVector2D(),
                             damageDistanceFullDamage: DamageRadiusFullDamage,
                             damageDistanceMax: DamageRadiusMax,
                             Api.Client.World,
                             xOffset,
                             yOffset))
                {
                    var rectangle = new Rectangle()
                    {
                        Width           = 1 * ScriptingConstants.TileSizeVirtualPixels - 10,
                        Height          = 1 * ScriptingConstants.TileSizeVirtualPixels - 10,
                        StrokeThickness = 4
                    };

                    if (offsetIndex <= DamageRadiusFullDamage)
                    {
                        rectangle.Stroke = ExplosionBlueprintBorderBrushRed.Value;
                        rectangle.Fill   = ExplosionBlueprintFillBrushRed.Value;
                    }
                    else
                    {
                        switch (offsetIndex)
                        {
                        case 5:
                        case 6:
                        case 7:
                            rectangle.Stroke = ExplosionBlueprintBorderBrushYellow.Value;
                            rectangle.Fill   = ExplosionBlueprintFillBrushYellow.Value;
                            break;

                        default:
                            throw new Exception("Should be impossible");
                        }
                    }

                    // workaround for NoesisGUI
                    rectangle.SetValue(Shape.StrokeDashArrayProperty, "2,1");

                    Api.Client.UI.AttachControl(
                        blueprint.SceneObject,
                        positionOffset: this.Layout.Center
                        + (offsetIndex * xOffset,
                           offsetIndex * yOffset),
                        uiElement: rectangle,
                        isFocusable: false,
                        isScaleWithCameraZoom: true);
                }
            }
        }
示例#2
0
        protected override void ClientOnObjectDestroyed(Vector2D position)
        {
            //base.ClientOnObjectDestroyed(position);
            Logger.Important(this + " exploded at " + position);

            var explosionPresetNode = ExplosionPresets.PragmiumResonanceBomb_NodeClientOnly;
            var positionEpicenter   = position + this.Layout.Center;

            ProcessExplosionDirection(-1, 0);  // left
            ProcessExplosionDirection(0, 1);   // top
            ProcessExplosionDirection(1, 0);   // right
            ProcessExplosionDirection(0, -1);  // bottom

            ExplosionHelper.ClientExplode(position: position + this.Layout.Center,
                                          this.ExplosionPreset,
                                          this.VolumeExplosion);

            void ProcessExplosionDirection(int xOffset, int yOffset)
            {
                foreach (var(_, offsetIndex) in
                         WeaponExplosionSystem.SharedEnumerateExplosionBombermanDirectionTilesWithTargets(
                             positionEpicenter: positionEpicenter,
                             damageDistanceFullDamage: DamageRadiusFullDamage,
                             damageDistanceMax: DamageRadiusMax,
                             Api.Client.World,
                             xOffset,
                             yOffset))
                {
                    ClientTimersSystem.AddAction(
                        delaySeconds: 0.1 * offsetIndex, // please note the offsetIndex is starting with 1
                        () => ExplosionHelper.ClientExplode(
                            position: positionEpicenter + (offsetIndex * xOffset, offsetIndex * yOffset),
                            explosionPresetNode,
                            volume: 0));
                }
            }
        }