private static JoinHandler CreateJoin(Join join, ScreenHandler currentScreen) { if (join.bossDoor) { GameEntity door = GameEntity.Get(join.bossEntityName); if (door != null) { return new BossDoorHandler(door, join, currentScreen); } } return new JoinHandler(join, currentScreen); }
public override void BeginScroll(ScreenHandler next, PointF playerPos) { doorOne.SendMessage(new StateMessage(null, "Opening")); if (direction == Direction.Down) triggerSize = (int)(height - playerPos.Y); else if (direction == Direction.Left) triggerSize = (int)playerPos.X; else if (direction == Direction.Right) triggerSize = (int)(width - playerPos.X); else triggerSize = (int)playerPos.Y; base.BeginScroll(next, playerPos); if (doorTwo != null) { doorTwo.SendMessage(new StateMessage(null, "Open")); } }
public override void Start(ScreenHandler screen) { base.Start(screen); doorOne = _entityPool.CreateEntity(JoinInfo.bossEntityName); doorTwo = _entityPool.CreateEntity(JoinInfo.bossEntityName); doorOne.GetComponent<PositionComponent>().SetPosition(new PointF(doorOneX, doorOneY)); doorTwo.GetComponent<PositionComponent>().SetPosition(new PointF(doorTwoX, doorTwoY)); doorOne.Start(container); doorTwo.Start(container); doorOne.GetComponent<StateComponent>().StateChanged += s => { if (s == "Open") open = true; }; }
public virtual void Start(ScreenHandler screen) { }
public virtual void BeginScroll(ScreenHandler next, PointF playerPos) { scrollDist = 0; tickdist = (TriggerSize() + OffsetDist()) / ticks; this.nextHeight = next.Screen.PixelHeight; this.nextWidth = next.Screen.PixelWidth; if (direction == Direction.Down) NextScreenY = -height; else if (direction == Direction.Right) NextScreenX = -width; else if (direction == Direction.Left) NextScreenX = nextWidth; else if (direction == Direction.Up) NextScreenY = nextHeight; Calculate(); }
private void OnScrollTriggered(JoinHandler join) { currentJoin = join; Player.Paused = true; nextScreen = screens[join.NextScreenName]; join.BeginScroll(nextScreen, PlayerPos.Position); updateFunc = () => join.Update(PlayerPos); join.ScrollDone += ScrollDone; drawFunc = DrawJoin; StopScreen(); }
private void ChangeScreen(ScreenHandler nextScreen) { ScreenHandler oldscreen = _currentScreen; _currentScreen = nextScreen; oldscreen.Clean(); StartScreen(); }
protected override void BeforeStart() { Player = Entities.CreateEntityWithId("Player", "Player"); PlayerPos = Player.GetComponent<PositionComponent>(); Player.Death += Player_Death; PlayerPos = Player.GetComponent<PositionComponent>(); PlayerPos.SetPosition(new PointF(startX, 0)); if (!info.Screens.ContainsKey(startScreen)) throw new GameRunException("The start screen for \""+info.Name+"\" is supposed to be \""+startScreen+"\", but it doesn't exist!"); _currentScreen = screens[startScreen]; StartScreen(); Engine.Instance.SoundSystem.StopMusicNsf(); if (music != null) music.Play(); if (info.MusicNsfTrack != 0) Engine.Instance.SoundSystem.PlayMusicNSF((uint)info.MusicNsfTrack); // updateFunc isn't set until BeginPlay drawFunc = DrawScreen; BeginPlay(); // make sure we can move (Player.GetComponent<InputComponent>()).Paused = false; }