Beispiel #1
0
        private void MainForm_KeyPress(object sender, KeyPressEventArgs e)
        {
            switch (e.KeyChar)
            {
            case '1':
                _activeBase.IsActive = false;
                _activeBase          = _bases[0];
                _bases[0].IsActive   = true;
                break;

            case '2':
                _activeBase.IsActive = false;
                _activeBase          = _bases[1];
                _bases[1].IsActive   = true;
                break;

            case '3':
                _activeBase.IsActive = false;
                _activeBase          = _bases[2];
                _bases[2].IsActive   = true;
                break;

            case '7':
                _score -= 5;
                break;

            case '8':
                _score += 5;
                break;

            case '9':
                _activeBase.RemoveHealth(5);
                break;

            case '0':
                _activeBase.AddHealth(5);
                break;

            case '-':
                _activeBase.RemoveAmmo(1);
                break;

            case '=':
                _activeBase.AddAmmo(1);
                break;

            case 'K':
            case 'k':
                _bases[0].RemoveHealth(100);
                _bases[1].RemoveHealth(100);
                _bases[2].RemoveHealth(100);
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        private void gamePanel_MouseClick(object sender, MouseEventArgs e)
        {
            if ((e.Y < _activeBase.MissileStartPosition.Y - 70) && (_activeBase.HasAmmo) && (_activeBase.IsAlive))
            {
                Missile mis;

                mis = new Missile(_activeBase.MissileStartPosition, e.Location, false);

                _missiles.Add(mis);

                _activeBase.RemoveAmmo(1);
            }
        }