示例#1
0
        private void UpdateAction()
        {
            List <Key?> keys = _keyboardInput.GetActiveKeys();

            Action <Key?> ManageAction = (key) =>
            {
                switch (key)
                {
                case Key.Left:
                    _playerShip.MoveLeft();
                    break;

                case Key.Right:
                    _playerShip.MoveRight();
                    break;

                case Key.Up:
                    //_playerShip.MoveUp();
                    break;

                case Key.Down:
                    //_playerShip.MoveDown();
                    break;

                case Key.Space:
                    _weapon.Add(_munitionsFactory.MakeArmament(ArmamentType.Pulsecannon, _playerShip.GetPositionOfCentre()));
                    break;
                }
            };

            for (int i = keys.Count - 1; i >= 0; i--)
            {
                ManageAction(keys[i]);
            }
        }
示例#2
0
        private void Fire()
        {
            IAGameObject weapon = _munitionsFactory.MakeArmament((_aiPlayer as Ship)._armamentType, (_aiPlayer as Ship).GetPositionOfCentre());

            (weapon as Armory).Fired = false;
            _aiWeapons.Add(weapon);
            (_aiPlayer as Ship).FrameTimeStamp = 0;
            (_aiPlayer as EnemyShip).AdjustFiringClock();
        }