private void OnParallaxGetState(EntityUid uid, ParallaxComponent component, ref ComponentGetState args)
 {
     args.State = new ParallaxComponentState
     {
         Parallax = component.Parallax
     };
 }
Exemplo n.º 2
0
 public Terrain()
 {
     currentSprite = new TerrainSprite("transparent", new Rectangle(0, 0, 900, 100));
     loc = new Vector2(0, 660);
     for (int i = 0; i < 5; i++) {
         layers[i] = new ParallaxComponent(LAYER_X_SPEEDS[i], LAYER_Y_VALUES[i], (float)(0.5f - (i*0.1f)), "sceneL" + i);
     }
 }
Exemplo n.º 3
0
    private void OnParallaxHandleState(EntityUid uid, ParallaxComponent component, ref ComponentHandleState args)
    {
        if (args.Current is not ParallaxComponentState state)
        {
            return;
        }
        component.Parallax = state.Parallax;

        if (!_parallax.IsLoaded(component.Parallax))
        {
            _parallax.LoadParallaxByName(component.Parallax);
        }
    }