private void OnParallaxGetState(EntityUid uid, ParallaxComponent component, ref ComponentGetState args) { args.State = new ParallaxComponentState { Parallax = component.Parallax }; }
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); } }
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); } }