Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
        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"));
            }
        }
Exemplo n.º 3
0
        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;
            };
        }
Exemplo n.º 4
0
 public virtual void Start(ScreenHandler screen)
 {
 }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        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();
        }
Exemplo n.º 7
0
        private void ChangeScreen(ScreenHandler nextScreen)
        {
            ScreenHandler oldscreen = _currentScreen;
            _currentScreen = nextScreen;

            oldscreen.Clean();
            StartScreen();
        }
Exemplo n.º 8
0
        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;
        }
Exemplo n.º 9
0
 public virtual void Start(ScreenHandler screen)
 {
 }