예제 #1
0
        /// <summary>
        /// Plays the player intro (MAP) and primes the table for the player status.
        /// </summary>
        public void StartPlayIntro()
        {
            //select user
            //ask the credit manager if we have credits
            PlayerStatus.CurrentPlayer.PlayerHealthStatus = "Player "
                                                            + PlayerStatus.PlayerUp + " is up";

            DisplayManager.PlaySequence(DisplayConstants.Modes.ActiveGameMode.ACTIVEGAMEMODE);
            //Character is selected, now let's show the map.
            DisplayManager.PlayCutScene(DisplayConstants.CutScenes.MapMode.MAP);
            SoundManager.PlayMusic(SoundConstants.Music.LevelStart, false);
            SoundManager.PlayMusic(SoundConstants.Music.Level1Normal, true);
            //DisplayManager.SetGameStatus(PlayerStatus.CurrentPlayer);
            SwitchManager.EnableFlippers(true);
        }
예제 #2
0
            private void handleSwitchChanges(Switch changed)
            {
                if (_isDisposed)
                {
                    return;
                }
                switch (changed.Id)
                {
                case (int)SwitchConstants.Switches.Start:
                    if (changed.State == SwitchState.On)
                    {
                        if (CurrentInputMode == InputMode.Attract)
                        {
                            //Start button Calls 'StartPressed' flash API
                            DisplayManager.StartPressed();

                            _instance.ResetForNewGame();
                            ModeStart(GameManagerConstants.GameModes.NORMALPLAY);
                        }
                    }
                    break;

                case (int)SwitchConstants.Switches.Coin:
                    if (changed.State == SwitchState.On)
                    {
                        if (CurrentInputMode == InputMode.Attract)
                        {
                            //add credit
                            GameManager.getInstance().AddCredit();
                            DisplayManager.GotoTitleScreen();
                        }
                    }
                    break;

                case (int)SwitchConstants.Switches.LeftFlipper:
                    DisplayManager.GoToHighScores();
                    break;

                case (int)SwitchConstants.Switches.RightFlipper:
                    DisplayManager.GotoTitleScreen();
                    break;

                default:
                    break;     //do nothing.
                }//end switch
            }
예제 #3
0
 /// <summary>
 /// Reinitialize the Table for a new ball (either a new ball after
 /// the player has lost one or we have moved onto the next player.
 /// </summary>
 public void ResetForNewPlayer()
 {
     TroughManager.Reset();
     _isTilted = false;
     Task.Factory.StartNew(() =>
     {
         if (PlayerStatus.CurrentPlayer.PlayerCharacter == Characters.unknown)
         {
             _inputMode = InputMode.SelectPlayer;
             DisplayManager.PlaySequence(DisplayConstants.Modes.ActiveGameMode.SubModes.CharacterSelectMode.CHARSELECT); //send high scores
         }
         else
         {
             //Need to task this out otherwise we get a AccessViolation and currupt memory.  unknown
             StartPlayIntro();
         }
     });
 }
 private void addDraculaLetter(int letterIndex)
 {
     if (!_instance._isTilted)
     {
         if (PlayerStatus.CurrentPlayer.AddDraculaLetter(letterIndex)) //true if new card
         {
             Dictionary <string, string> args = new Dictionary <string, string>();
             args.Add("DRACULA", "TRUE");
             args.Add("FLIPPED", letterIndex.ToString());
             DisplayManager.PlayCutScene(DisplayConstants.CutScenes.ActiveGameMode.ADDLETTER, args);
             _instance.AddScore(ScoreConstants.LETTERNEW);
         }
         else
         {
             _instance.AddScore(ScoreConstants.LETTER);
         }
     }
 }
예제 #5
0
            public TrophyRoomMode()
            {
                _log.Info("Trophy Room Mode Started");
                DisplayManager.OnAnimationCompleted += new DisplayEventHandler(DisplayManager_OnAnimationCompleted);
                SwitchManager.RegisterSwitchHandler(handleSwitchChanges);

                //Rotate Playfield to CenterScoop position
                SwitchManager.RotateStage(SwitchConstants.StagePositions.TrophyScoop);
                SwitchManager.RotateCross(false);

                //Play "Collect Trophy" instructional video
                DisplayManager.PlayCutScene(DisplayConstants.CutScenes.ActiveGameMode.COLLECTTROPHY);
                LightManager.PlaySequence(LightingConstants.Lfx.CollectTrophySlow);

                _collectBonusTimer = new Timer(new TimerCallback(collectBonusTimerHandler),
                                               null, 1000, 1000); //ticks every second
                _timeStarted = new System.Diagnostics.Stopwatch();
                _timeStarted.Start();
            }
 private void attack(bool isMagic, int power, bool isSplash = false)
 {
     foreach (IEnemy e in PlayerStatus.CurrentPlayer.Attack(isMagic, power, isSplash))
     {
         _log.WarnFormat("killing a {0}", e.EnemyType);
         DisplayManager.KillEnemy(e);
     }
     if (!PlayerStatus.CurrentPlayer.Paths.HasFlag(NavigationPaths.Blocked))
     {
         if (PlayerStatus.CurrentPlayer.RoomType == RoomTypes.Boss) //!BOSS IS DEAD!!!
         {
             //play DEADBOSS animation
             //Go to trophy room
             navigate(NavigationPaths.Straight);
         }
         else
         {
             DisplayManager.ShowNavigation(PlayerStatus.CurrentPlayer.Paths);
         }
     }
 }
예제 #7
0
        /// <summary>
        /// Initialize the table for a new game.
        /// </summary>
        public void ResetForNewGame()
        {
            PlayerStatus.Reset();
            AddPlayer();

            //TroughManager.CheckForStuckBall()
            //check quickly
            if (!TroughManager.WaitForAllBalls(5, false))
            {
                DisplayManager.PlayCutScene(DisplayConstants.CutScenes.Test.BALLSEARCH);
            }
            //ok, we've got a stuck ball somewhere.
            int attempts = 0;

            while (attempts < 5 && !TroughManager.WaitForAllBalls(5000, true))
            {
                DisplayManager.PlayCutScene(DisplayConstants.CutScenes.Test.BALLSEARCH);
                attempts++;
            }

            _isTilted = false;
        }
예제 #8
0
            public void DisplayManager_OnAnimationCompleted(DisplayEventArgs e)
            {
                try
                {
                    //what animation completed?
                    if (e == null || e.SceneName == null)
                    {
                        return;
                    }
                    switch (e.SceneName)
                    {
                    case DisplayConstants.Modes.AttractMode.ATTRACT:
                        DisplayManager.PlaySequence(DisplayConstants.Modes.AttractMode.ATTRACT);     //send high scores
                        break;

                    default:
                        break;
                    }
                }
                catch (Exception ex)
                {
                    _log.Error(ex);
                }
            }
예제 #9
0
        /// <summary>
        /// Singleton pattern
        /// </summary>
        protected static DisplayManager getInstance()
        {
            if (_instance == null)
                _instance = new DisplayManager();

            return _instance;
        }
예제 #10
0
 /// <summary>
 /// All players done, go back to Attract.
 /// </summary>
 public void EndPlay()
 {
     DisplayManager.PlaySequence(DisplayConstants.Modes.AttractMode.ATTRACT); //send high scores
 }
예제 #11
0
            private void handleSwitchChanges(Switch changed)
            {
                if (_isDisposed)
                {
                    return;
                }
                switch (changed.Id)
                {
                case (int)SwitchConstants.Switches.PlumbTilt:
                    _instance.TiltWarning(PlayerStatus.CurrentPlayer.TiltWarnings++);
                    break;

                case (int)SwitchConstants.Switches.Start:
                    if (changed.State == SwitchState.On)
                    {
                        //can only add a player if the current player is on ball 1
                        if (PlayerStatus.CurrentPlayer.Ball == 1)
                        {
                            _instance.AddPlayer();
                        }
                    }
                    break;

                case (int)SwitchConstants.Switches.Coin:
                    if (changed.State == SwitchState.On)
                    {
                        _instance.AddCredit();     //
                    }
                    break;

                case (int)SwitchConstants.Switches.SlamTilt:
                    break;

                case (int)SwitchConstants.Switches.MenuSelect:
                    break;

                case (int)SwitchConstants.Switches.MenuBack:
                    break;

                case (int)SwitchConstants.Switches.MenuNext:
                    break;

                case (int)SwitchConstants.Switches.MenuExit:
                    break;

                case (int)SwitchConstants.Switches.Outhole:
                    if (CurrentInputMode == InputMode.NormalPlay)
                    {
                        if (changed.State == SwitchState.On)
                        {
                            _instance.BallDrained();
                        }
                    }
                    break;

                case (int)SwitchConstants.Switches.RightBallTrough:
                    break;

                case (int)SwitchConstants.Switches.RightMidBallTrough:
                    break;

                case (int)SwitchConstants.Switches.MidBallTrough:
                    break;

                case (int)SwitchConstants.Switches.LeftMidBallTrough:
                    break;

                case (int)SwitchConstants.Switches.LeftBallTrough:
                    //if (_state[i].State == SwitchState.On)
                    //_instance.KickBack();
                    break;

                case (int)SwitchConstants.Switches.BallShooterLane:
                    if (changed.State == SwitchState.Off && CurrentInputMode == InputMode.NormalPlay)
                    {
                        //was on, now is off and we're waiting to start the ball saver timer.
                        if (TroughManager.BallSaverState == BallSaverStates.Waiting)
                        {
                            TroughManager.StartBallSaverTimer();
                        }
                    }
                    break;

                case (int)SwitchConstants.Switches.RightFlipperEOS:
                    break;

                case (int)SwitchConstants.Switches.LeftFlipperEOS:
                    break;

                case (int)SwitchConstants.Switches.LeftDrain:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        if (!_instance._isTilted)     //this might need to be higher up.. maybe an input mode
                        {
                            _instance.AddScore(ScoreConstants.OUTLANE);
                            if (PlayerStatus.CurrentPlayer.HasShield)
                            {
                                //SolenoidManager.FireKickBack();
                                PlayerStatus.CurrentPlayer.HasShield = false;     //decrement
                            }
                        }
                    }
                    break;

                case (int)SwitchConstants.Switches.LeftReturn:
                    break;

                case (int)SwitchConstants.Switches.LeftSling:
                case (int)SwitchConstants.Switches.RightSling:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        _instance.AddScore(ScoreConstants.NONTARGET);
                    }
                    break;

                case (int)SwitchConstants.Switches.RightReturn:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        _instance.AddScore(ScoreConstants.NONTARGET);
                    }
                    break;

                case (int)SwitchConstants.Switches.RightDrain:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        if (!_instance._isTilted)
                        {
                            _instance.AddScore(ScoreConstants.OUTLANE);
                            PlayerStatus.CurrentPlayer.HasCross = false;     //decrement
                        }
                    }
                    break;

                case (int)SwitchConstants.Switches.DraculaD:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addDraculaLetter(0);
                    }
                    break;

                case (int)SwitchConstants.Switches.DraculaR:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addDraculaLetter(1);
                    }
                    break;

                case (int)SwitchConstants.Switches.DraculaA:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addDraculaLetter(2);
                    }
                    break;

                case (int)SwitchConstants.Switches.DraculaC:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addDraculaLetter(3);
                    }
                    break;

                case (int)SwitchConstants.Switches.DraculaU:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addDraculaLetter(4);
                    }
                    break;

                case (int)SwitchConstants.Switches.DraculaL:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addDraculaLetter(5);
                    }
                    break;

                case (int)SwitchConstants.Switches.DraculaA2:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addDraculaLetter(6);
                    }
                    break;

                case (int)SwitchConstants.Switches.BallPopper:
                    break;

                case (int)SwitchConstants.Switches.DropTargetA:
                    break;

                case (int)SwitchConstants.Switches.DropTargetB:
                    break;

                case (int)SwitchConstants.Switches.DropTargetC:
                    break;

                //case (int)SwitchConstants.Switches.DropTargetD:
                //    break;
                case (int)SwitchConstants.Switches.BelmontB:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addBelmontLetter(0);
                    }
                    break;

                case (int)SwitchConstants.Switches.BelmontE:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addBelmontLetter(1);
                    }
                    break;

                case (int)SwitchConstants.Switches.BelmontL:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addBelmontLetter(2);
                    }
                    break;

                case (int)SwitchConstants.Switches.BelmontM:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addBelmontLetter(3);
                    }
                    break;

                case (int)SwitchConstants.Switches.BelmontO:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addBelmontLetter(4);
                    }
                    break;

                case (int)SwitchConstants.Switches.BelmontN:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addBelmontLetter(5);
                    }
                    break;

                case (int)SwitchConstants.Switches.BelmontT:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addBelmontLetter(6);
                    }
                    break;

                case (int)SwitchConstants.Switches.LeftOuterOrbit:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        _instance.AddScore(ScoreConstants.NONTARGET);
                    }
                    break;

                case (int)SwitchConstants.Switches.RampExit:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        if (PlayerStatus.CurrentPlayer.Paths.HasFlag(NavigationPaths.Up))
                        {
                            navigate(NavigationPaths.Up);
                        }
                        else
                        {
                            attack(false, int.MaxValue, false);     //kill 1 enemy
                        }
                    }
                    break;

                case (int)SwitchConstants.Switches.LeftInnerOrbit:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        _instance.AddScore(ScoreConstants.NONTARGET);
                    }
                    break;

                case (int)SwitchConstants.Switches.BossTarget:
                    break;

                case (int)SwitchConstants.Switches.CenterExit:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        if (PlayerStatus.CurrentPlayer.Paths.HasFlag(NavigationPaths.Straight))
                        {
                            navigate(NavigationPaths.Straight);
                        }
                        else
                        {
                            attack(false, int.MaxValue, false);     //kill 1 enemy
                        }
                    }
                    break;

                case (int)SwitchConstants.Switches.CenterScoop:
                    break;

                case (int)SwitchConstants.Switches.RightInnerOrbit:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        _instance.AddScore(ScoreConstants.NONTARGET);
                    }
                    break;

                case (int)SwitchConstants.Switches.CapturedBall:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addItem();
                    }
                    break;

                case (int)SwitchConstants.Switches.RightScoop:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        if (PlayerStatus.CurrentPlayer.Paths.HasFlag(NavigationPaths.Down))
                        {
                            navigate(NavigationPaths.Down);
                        }
                        else
                        {
                            attack(false, int.MaxValue, false);     //kill 1 enemy
                        }
                    }
                    break;

                case (int)SwitchConstants.Switches.RightOuterOrbit:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        _instance.AddScore(ScoreConstants.NONTARGET);
                    }
                    break;

                case (int)SwitchConstants.Switches.TopOuterOrbit:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        _instance.AddScore(ScoreConstants.NONTARGET);
                    }
                    break;

                case (int)SwitchConstants.Switches.LeftPop:
                case (int)SwitchConstants.Switches.TopPop:
                case (int)SwitchConstants.Switches.LowerPop:
                    if (changed.State == SwitchState.On && CurrentInputMode == InputMode.NormalPlay)
                    {
                        addHeart();
                        attack(false, 1, true);
                    }
                    break;

                case (int)SwitchConstants.Switches.LeftFlipper:
                case (int)SwitchConstants.Switches.RightFlipper:

                    if (CurrentInputMode == InputMode.SelectPlayer)
                    {
                        if (changed.State == SwitchState.Off)     //flip players on buttonUP
                        {
                            if (changed.Id == (int)SwitchConstants.Switches.LeftFlipper)
                            {
                                DisplayManager.CharacterPrevious();
                            }
                            else
                            {
                                DisplayManager.CharacterNext();
                            }
                        }
                        else
                        {
                            //find out if both buttons are currently on.
                            Switch left  = SwitchManager.GetSwitch(SwitchConstants.Switches.LeftFlipper);
                            Switch right = SwitchManager.GetSwitch(SwitchConstants.Switches.RightFlipper);

                            if (left.State == SwitchState.On &&
                                right.State == SwitchState.On)
                            {
                                if (PlayerStatus.CurrentPlayer.PlayerCharacter == Characters.unknown)
                                {
                                    string player = DisplayManager.GetCharacterSelection();
                                    switch (player.ToLower())
                                    {
                                    case "maria":
                                        PlayerStatus.CurrentPlayer.PlayerCharacter = Characters.Maria;
                                        break;

                                    case "sypha":
                                        PlayerStatus.CurrentPlayer.PlayerCharacter = Characters.Sypha;
                                        break;

                                    case "grant":
                                        PlayerStatus.CurrentPlayer.PlayerCharacter = Characters.Grant;
                                        break;

                                    case "alucard":
                                        PlayerStatus.CurrentPlayer.PlayerCharacter = Characters.Alucard;
                                        break;

                                    case "richter":
                                    default:
                                        PlayerStatus.CurrentPlayer.PlayerCharacter = Characters.Richter;
                                        break;
                                    }
                                    _instance.StartPlayIntro();
                                }
                            }
                        }
                    }
                    //else
                    //    continue; //TODO: check for long press status update
                    break;

                default:
                    break;
                }//end switch
            }