/// <summary>
 /// Sets up event listeners when a new machine is entered.
 /// </summary>
 /// <param name="machine"></param>
 protected virtual void EnterGame(PinballGameMachine machine)
 {
 }
 /// <summary>
 /// Removes event listeners when a machine is left
 /// </summary>
 /// <param name="machine"></param>
 protected virtual void LeaveGame(PinballGameMachine machine)
 {
 }
示例#3
0
 protected override void LeaveGame(PinballGameMachine machine)
 {
     machine.Input.KeyDown -= OnKeyDown;
     machine.Input.KeyUp -= OnKeyUp;
 }
示例#4
0
 protected override void EnterGame(PinballGameMachine machine)
 {
     machine.Input.KeyDown += OnKeyDown;
     machine.Input.KeyUp += OnKeyUp;
 }
示例#5
0
 protected override void LeaveGame(PinballGameMachine machine)
 {
     // Unbind key event
     machine.Input.KeyDown -= Charge;
     machine.Input.KeyUp -= Discharge;
 }
示例#6
0
 protected override void EnterGame(PinballGameMachine machine)
 {
     // Bind key event
     machine.Input.KeyDown += Charge;
     machine.Input.KeyUp += Discharge;
 }
示例#7
0
        /// <summary>
        /// Starts a new game.
        /// </summary>
        public void Start()
        {
            lock (this)
            {
                if (Machine != null)
                {
                    Machine.Dispose();
                }

                Machine = new PinballGameMachine(OriginalMachine);
                Machine.prepareForLaunch();

                Status = GameStatus.Playing;
                Machine.Input.Enabled = true;

                Score = 0;
                Lives = TOTAL_LIVES;

                // Wire up event handlers
                Machine.Collision += OnScore;
                Machine.GameOver += OnGameOver;

                Machine.IntroduceBall();
                Lives--;
            }
        }