Example #1
0
        /// <inheritdoc />
        protected override void Startup()
        {
            base.Startup();

            _snapGrid.OnPositionChanged += SnapGridOnPositionChanged;
            Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new WindowSmoothDirtyEvent(Owner));

            var          state0        = $"{_stateBase}0";
            const string cracksRSIPath = "/Textures/Constructible/Structures/Windows/cracks.rsi";

            _sprite.LayerMapSet(CornerLayers.SE, _sprite.AddLayerState(state0));
            _sprite.LayerSetDirOffset(CornerLayers.SE, SpriteComponent.DirectionOffset.None);
            _sprite.LayerMapSet(WindowDamageLayers.DamageSE, _sprite.AddLayerState("0_1", cracksRSIPath));
            _sprite.LayerSetVisible(WindowDamageLayers.DamageSE, false);

            _sprite.LayerMapSet(CornerLayers.NE, _sprite.AddLayerState(state0));
            _sprite.LayerSetDirOffset(CornerLayers.NE, SpriteComponent.DirectionOffset.CounterClockwise);
            _sprite.LayerMapSet(WindowDamageLayers.DamageNE, _sprite.AddLayerState("0_1", cracksRSIPath));
            _sprite.LayerSetDirOffset(WindowDamageLayers.DamageNE, SpriteComponent.DirectionOffset.CounterClockwise);
            _sprite.LayerSetVisible(WindowDamageLayers.DamageNE, false);

            _sprite.LayerMapSet(CornerLayers.NW, _sprite.AddLayerState(state0));
            _sprite.LayerSetDirOffset(CornerLayers.NW, SpriteComponent.DirectionOffset.Flip);
            _sprite.LayerMapSet(WindowDamageLayers.DamageNW, _sprite.AddLayerState("0_1", cracksRSIPath));
            _sprite.LayerSetDirOffset(WindowDamageLayers.DamageNW, SpriteComponent.DirectionOffset.Flip);
            _sprite.LayerSetVisible(WindowDamageLayers.DamageNW, false);

            _sprite.LayerMapSet(CornerLayers.SW, _sprite.AddLayerState(state0));
            _sprite.LayerSetDirOffset(CornerLayers.SW, SpriteComponent.DirectionOffset.Clockwise);
            _sprite.LayerMapSet(WindowDamageLayers.DamageSW, _sprite.AddLayerState("0_1", cracksRSIPath));
            _sprite.LayerSetDirOffset(WindowDamageLayers.DamageSW, SpriteComponent.DirectionOffset.Clockwise);
            _sprite.LayerSetVisible(WindowDamageLayers.DamageSW, false);
        }
Example #2
0
        public override void Initialize()
        {
            base.Initialize();

            var state0 = $"{StateBase}0";

            SnapGrid = Owner.GetComponent <SnapGridComponent>();
            Sprite   = Owner.GetComponent <ISpriteComponent>();
            Sprite.LayerMapSet(CornerLayers.SE, Sprite.AddLayerState(state0));
            Sprite.LayerSetDirOffset(CornerLayers.SE, DirectionOffset.None);
            Sprite.LayerMapSet(CornerLayers.NE, Sprite.AddLayerState(state0));
            Sprite.LayerSetDirOffset(CornerLayers.NE, DirectionOffset.CounterClockwise);
            Sprite.LayerMapSet(CornerLayers.NW, Sprite.AddLayerState(state0));
            Sprite.LayerSetDirOffset(CornerLayers.NW, DirectionOffset.Flip);
            Sprite.LayerMapSet(CornerLayers.SW, Sprite.AddLayerState(state0));
            Sprite.LayerSetDirOffset(CornerLayers.SW, DirectionOffset.Clockwise);
        }
        /// <inheritdoc />
        protected override void Startup()
        {
            base.Startup();

            _snapGrid.OnPositionChanged += SnapGridOnPositionChanged;
            Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new WindowSmoothDirtyEvent(Owner));

            var state0 = $"{_stateBase}0";

            _sprite.LayerMapSet(CornerLayers.SE, _sprite.AddLayerState(state0));
            _sprite.LayerSetDirOffset(CornerLayers.SE, SpriteComponent.DirectionOffset.None);
            _sprite.LayerMapSet(CornerLayers.NE, _sprite.AddLayerState(state0));
            _sprite.LayerSetDirOffset(CornerLayers.NE, SpriteComponent.DirectionOffset.CounterClockwise);
            _sprite.LayerMapSet(CornerLayers.NW, _sprite.AddLayerState(state0));
            _sprite.LayerSetDirOffset(CornerLayers.NW, SpriteComponent.DirectionOffset.Flip);
            _sprite.LayerMapSet(CornerLayers.SW, _sprite.AddLayerState(state0));
            _sprite.LayerSetDirOffset(CornerLayers.SW, SpriteComponent.DirectionOffset.Clockwise);
        }
        protected override void Startup()
        {
            base.Startup();

            _overlayEntity = Owner.EntityManager.SpawnEntity("LowWallOverlay", Owner.Transform.Coordinates);
            _overlayEntity.Transform.AttachParent(Owner);

            _overlaySprite = _overlayEntity.GetComponent <ISpriteComponent>();

            var overState0 = $"{StateBase}over_0";

            _overlaySprite.LayerMapSet(OverCornerLayers.SE, _overlaySprite.AddLayerState(overState0));
            _overlaySprite.LayerSetDirOffset(OverCornerLayers.SE, DirectionOffset.None);
            _overlaySprite.LayerMapSet(OverCornerLayers.NE, _overlaySprite.AddLayerState(overState0));
            _overlaySprite.LayerSetDirOffset(OverCornerLayers.NE, DirectionOffset.CounterClockwise);
            _overlaySprite.LayerMapSet(OverCornerLayers.NW, _overlaySprite.AddLayerState(overState0));
            _overlaySprite.LayerSetDirOffset(OverCornerLayers.NW, DirectionOffset.Flip);
            _overlaySprite.LayerMapSet(OverCornerLayers.SW, _overlaySprite.AddLayerState(overState0));
            _overlaySprite.LayerSetDirOffset(OverCornerLayers.SW, DirectionOffset.Clockwise);
        }