protected void UpdateFillIcon()
        {
            if (string.IsNullOrEmpty(_fillInitState))
            {
                return;
            }

            var percentage = (CurrentVolume / MaxVolume).Double();
            var level      = ContentHelpers.RoundToLevels(percentage * 100, 100, _fillInitSteps);

            //Transformed glass uses special fancy sprites so we don't bother
            if (level == 0 || (Owner.TryGetComponent <TransformableContainerComponent>(out var transformComp) && transformComp.Transformed))
            {
                _spriteComponent.LayerSetColor(1, Color.Transparent);
                return;
            }

            _fillSprite = new SpriteSpecifier.Rsi(_fillPath, _fillInitState + level);
            _spriteComponent.LayerSetSprite(1, _fillSprite);
            _spriteComponent.LayerSetColor(1, SubstanceColor);
        }
Exemplo n.º 2
0
    private void TurnOn(
        AppearanceComponent component,
        EnergySwordStatus status,
        Color color,
        IEntityManager entManager,
        SpriteComponent?spriteComponent = null)
    {
        if ((status & EnergySwordStatus.Hacked) != 0x0)
        {
            if (entManager.TryGetComponent(component.Owner, out SharedItemComponent? itemComponent))
            {
                itemComponent.EquippedPrefix = "on-rainbow";
            }

            //todo: figure out how to use the RGBLightControllerSystem to phase out the rainbow sprite AND add lights.
            spriteComponent?.LayerSetColor(1, Color.White);
            spriteComponent?.LayerSetVisible(1, false);
            spriteComponent?.LayerSetState(0, "e_sword_rainbow_on");
        }
        else
        {
            if (entManager.TryGetComponent(component.Owner, out SharedItemComponent? itemComponent))
            {
                itemComponent.EquippedPrefix = "on";
                itemComponent.Color          = color;
            }

            spriteComponent?.LayerSetColor(1, color);
            spriteComponent?.LayerSetVisible(1, true);

            if (entManager.TryGetComponent(component.Owner, out PointLightComponent? pointLightComponent))
            {
                pointLightComponent.Color   = color;
                pointLightComponent.Enabled = true;
            }
        }
    }