Exemplo n.º 1
0
        public Player(string name, Car car, int type, int inputid)
        {
            Name = name;
            CarObject = car;

            if (type == 1)
                UseKeyboard = true;
            else if (type == 0)
                UseKeyboard = false;
            else
            {
                IsAI = true;
            }

            InputID = inputid;
        }
Exemplo n.º 2
0
        void _addPlayerButton_ClickEvent(object sender, EventArgs e)
        {
            if (_usernameTextBox.Text == "")
                _userWarning = true;
            else if (_selectedIndex == -1)
                _controlWarning = true;
            else
            {
                Car c = new Car(100);

                switch (_carPreviewIndex)
                {
                    case 0: c = new BMW(100); break;
                    case 1: c = new Lambor(100); break;
                }

                Player p = new Player(_usernameTextBox.Text, c, _selectedIndex, Player.GetInputId(Player.Players, 1));
                Player.Players.Add(p);
                _playerRectangles.Add(new Rectangle(451, 358 + (_playerRectangles.Count * 50), 827, 50));

                _selectedIndex = -1;
                _usernameTextBox.Text = "";
            }
        }