Exemplo n.º 1
0
 private void GameOver(GameOverCondition failCondition)
 {
     if (OnGameOver != null)
     {
         OnGameOver(failCondition);
     }
 }
Exemplo n.º 2
0
 /*public AutomatedCar(int x, int y, string filename)
  *  : base(x, y, filename, true,  new RotationMatrix(1.0, 0.0, 0.0, 1.0))*/
 public AutomatedCar(int x, int y, string filename, int width, int height, List <List <Point> > polylist)
     : base(x, y, filename, width, height, -width / 2, -height / 2, new Matrix(1, 0, 0, 1, 1, 1), polylist)
 {
     this.virtualFunctionBus = new VirtualFunctionBus();
     this.AEB = new AEB(this.virtualFunctionBus);
     this.humanMachineInterface = new HumanMachineInterface(this.virtualFunctionBus);
     this.accController         = new AccController(this.virtualFunctionBus);
     this.powerTrain            = new PowerTrain(this.virtualFunctionBus, x, y);
     this.gameOver    = new GameOverCondition(this.virtualFunctionBus);
     this.Brush       = new SolidColorBrush(Color.Parse("red"));
     this.Ultrasounds = new Ultrasound[]
     {
         new Ultrasound(this.virtualFunctionBus, 110, 30, 0),
         new Ultrasound(this.virtualFunctionBus, 105, 45, 90),
         new Ultrasound(this.virtualFunctionBus, 110, -30, 0),
         new Ultrasound(this.virtualFunctionBus, 105, -45, -90),
         new Ultrasound(this.virtualFunctionBus, -120, 25, 180),
         new Ultrasound(this.virtualFunctionBus, -105, 45, 90),
         new Ultrasound(this.virtualFunctionBus, -120, -25, 180),
         new Ultrasound(this.virtualFunctionBus, -105, -45, -90),
     };
     this.Radar             = new Radar(this.virtualFunctionBus);
     this.ultraSoundVisible = false;
     this.radarVisible      = false;
     this.cameraVisible     = false;
     this.polygonVisible    = false;
 }
Exemplo n.º 3
0
 // Constructor to initialize a new game state using the specified
 // GameBoard.
 public GameState(GameBoard aBoard)
 {
     this.board = aBoard;
     this.gameIsOver = false;
     this.totalMoveCount = 0;
     this.gameOverCondition = GameOverCondition.None;
     this.winningPlayerNumber = GamePlayer.None;
     this.history = new Stack<string>();
 }
            // Constructor instantiates a GameMessage of type GameOver and sets the
            // GameOverCondition with the data contained in the specified message string.
            public GameOver(string msg)
            {
                if (!GameMessage.IsGameOver(msg))
                    throw new Exception("This is not a GameOver message.");

                // Remove all whitespace characters from the message string.
                string msgString = RemoveAllWhiteSpace(msg);

                this.data = msgString;
                string conditionString = GameMessage.GetMessageData(msgString);

                this.condition = (GameOverCondition)Enum.Parse(typeof(GameOverCondition), conditionString);
            }
Exemplo n.º 5
0
    private void OnWrongAnswer(GameOverCondition condition)
    {
        mIsGameOver = true;
        _Tint.SetActive(true);

        if (condition == GameOverCondition.WrongAnswer)
        {
            _Result.text = "Game over. Wrong answer! Tap to restart.";
        }
        else
        {
            _Result.text = "Time UP!";
        }
    }
Exemplo n.º 6
0
    // Use this for initialization
    void Awake()
    {
        _overCondition = (GameOverCondition)FindObjectOfType(typeof(GameOverCondition));
        type           = _overCondition.overType();
        string title = "";

        if (type == GameOverCondition.OverType.MOVE)
        {
            title = "Move";
        }
        else if (type == GameOverCondition.OverType.TIME)
        {
            title = "Time";
        }
        MakeText(title, new Vector2(0, 0.2f), 40, Color.black);
        _text = MakeText("0", new Vector2(0, -0.2f), 30, Color.black);
    }
 public void EndGame(GamePlayer winner, GameOverCondition condition)
 {
     this.logic.GetGameState().SetGameOver(winner, condition);
 }
 // Constructor instantiates a GameMessage of type GameOver with
 // the specified GameOverCondition.
 public GameOver(GameOverCondition aCondition)
 {
     this.condition = aCondition;
     this.data = string.Format("{0}{{{1}}}", typeof(GameMessage.GameOver).Name.ToString(), this.condition.ToString());
 }
        private void EndGame(GameOverCondition condition)
        {
            if (this.stateCode != ClientStateCode.GameIsOver)
            {
                ClientStateCode lastStateCode = this.stateCode;
                this.stateCode = ClientStateCode.GameIsOver;

                if (lastStateCode > 0)
                {
                    this.Display("Disconnected.");

                    this.client.Disconnect();

                    if (lastStateCode == ClientStateCode.GameIsInProgress)
                        lock (this.locker)
                        {
                            this.gameClientLogic.EndGame(this.playerNumber, condition);
                            this.gameStateQueue.Enqueue(this.gameClientLogic.GetGameState());
                        }
                }

                ChangeConnectButtonText("Connect");
            }

            pictureBox1.Invalidate();
        }
Exemplo n.º 10
0
 public void NotifyFailure(GameOverCondition cond)
 {
     NotifyGameOver(false, cond.GetProgressInfo());
 }
Exemplo n.º 11
0
 public void NotifySuccess(GameOverCondition cond)
 {
     NotifyGameOver(true, cond.GetProgressInfo());
 }
Exemplo n.º 12
0
 public void SetGameOver(GamePlayer winner, GameOverCondition condition)
 {
     this.winningPlayerNumber = winner;
     this.gameOverCondition = condition;
     this.gameIsOver = true;
 }
Exemplo n.º 13
0
 public GameOverEventArgs(GameOverCondition condition)
 {
     Condition = condition;
 }