示例#1
0
        public void A_random_player_is_returned()
        {
            _playerType = PlayerTypes.Random;
            Execute();

            _result.GetType().Should().Equal(typeof(RandomPlayer));
        }
示例#2
0
        public void A_tactical_player_is_returned()
        {
            _playerType = PlayerTypes.Tactical;
            Execute();

            _result.GetType().Should().Equal(typeof(TacticalPlayer));
        }
示例#3
0
        public void A_human_player_is_returned()
        {
            _playerType = PlayerTypes.Human;
            Execute();

            _result.GetType().Should().Equal(typeof(HumanPlayer));
        }
示例#4
0
        protected override void Create()
        {
            var hudPlayerType = new HudPlayerType(true);

            PlayerTypes.Add(hudPlayerType);
            SelectedPlayerType = hudPlayerType;
        }
示例#5
0
    // Getters
    public GameObject Player(PlayerTypes type)
    {
        switch (type)
        {
        case PlayerTypes.Clinga: return(Clinga);

        case PlayerTypes.Dilata: return(Dilata);

        case PlayerTypes.Flatline: return(Flatline);

        case PlayerTypes.Flippa: return(Flippa);

        case PlayerTypes.Freeza: return(Freeza);

        case PlayerTypes.Jetta: return(Jetta);

        case PlayerTypes.Jumpa: return(Jumpa);

        case PlayerTypes.Limo: return(Limo);

        case PlayerTypes.Neutrala: return(Neutrala);

        case PlayerTypes.Plunga: return(Plunga);

        case PlayerTypes.Slippa: return(Slippa);

        case PlayerTypes.Testa: return(Testa);

        case PlayerTypes.Warpa: return(Warpa);

        default:
            Debug.LogError("Whoa! Player type totally not recognized: " + type);
            return(null);
        }
    }
示例#6
0
            public bool IsPlayerCheckmated(PlayerTypes player, IEnumerable <Piece> rows,
                                           Dictionary <Piece, Point[]> piecesMovesDic)
            {
                foreach (var piece in piecesMovesDic)
                {
                    foreach (var newPos in piece.Value)
                    {
                        //Simulate board after move
                        var   oldPos    = piece.Key.Position;
                        Piece destPiece = Board.At(newPos); //To restore the old board
                        ChangePiecePos(Board.At(oldPos), newPos);
                        Board[oldPos.Y][oldPos.X] = null;

                        var enemyPossibleMoves = GetPossibleMoves(rows, CurrPlayer);
                        var isPlayerChecked    = IsPlayerChecked(player, rows, enemyPossibleMoves);

                        //Restore old board
                        ChangePiecePos(Board.At(newPos), oldPos);
                        Board[newPos.Y][newPos.X] = destPiece;

                        if (!isPlayerChecked)
                        {
                            return(false);
                        }
                    }
                }

                return(true);
            }
	public TargetPlayerGambitImpl (Features pmFeature, PlayerTypes pmType, PlayerAdjectives pmAdjective, Player pmGambitPlayer)
	{
		feature = pmFeature;
		type = pmType;
		adjective = pmAdjective;
		gambitPlayer = pmGambitPlayer;
	}
示例#8
0
        private void Import()
        {
            var openFileDialog = new OpenFileDialog
            {
                Filter = CommonResourceManager.Instance.GetResourceString("SystemSettings_PlayerTypeFileDialogFilter")
            };

            if (openFileDialog.ShowDialog() != true)
            {
                return;
            }

            var importedPlayerTypes = hudLayoutService.ImportPlayerType(openFileDialog.FileName);

            if (importedPlayerTypes == null || importedPlayerTypes.Length == 0)
            {
                return;
            }

            var playerTypesMap = (from importedPlayerType in importedPlayerTypes
                                  join playerType in PlayerTypes on importedPlayerType.Name equals playerType.Name into gj
                                  from grouped in gj.DefaultIfEmpty()
                                  select new { ImportedPlayerType = importedPlayerType, ExistingPlayerType = grouped }).ToArray();

            foreach (var playerTypeMapItem in playerTypesMap)
            {
                if (playerTypeMapItem.ExistingPlayerType == null)
                {
                    PlayerTypes.Add(playerTypeMapItem.ImportedPlayerType);
                    continue;
                }

                playerTypeMapItem.ExistingPlayerType.MergeWith(playerTypeMapItem.ImportedPlayerType);
            }
        }
        protected PlayerBattleMenu(PlayerTypes playerType) : base(MenuTypes.Horizontal)
        {
            PlayerType = playerType;

            Texture2D battleGFX = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png");

            SwitchIcon = new CroppedTexture2D(battleGFX, new Rectangle(651, 13, 78, 30));

            CroppedTexture2D tacticsButton = new CroppedTexture2D(battleGFX, new Rectangle(146, 844, 24, 24));
            CroppedTexture2D itemsButton   = new CroppedTexture2D(battleGFX, new Rectangle(146, 812, 24, 24));

            ActionButtons.Add(new ActionButton("Tactics", tacticsButton, MoveCategories.Tactics, new TacticsSubMenu()));

            ActionSubMenu itemMenu = null;

            if (CheckUseDipMenu() == false)
            {
                itemMenu = new ItemSubMenu(1, 0);
            }
            else
            {
                itemMenu = new ItemDipSubMenu();
            }

            ActionButtons.Add(new ActionButton("Items", itemsButton, MoveCategories.Item, itemMenu));
        }
示例#10
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="parSize">Длина корабля</param>
 /// <param name="parOrientation">Ориентация корабля</param>
 /// <param name="parPosition">Позиция начальной точки корабля</param>
 /// <param name="parPlayerType">Тип игрока, владеющего кораблём</param>
 public Ship(int parSize, ShipOrientation parOrientation, Point parPosition, PlayerTypes parPlayerType = PlayerTypes.User)
 {
     _size        = parSize;
     _orientation = parOrientation;
     _playerType  = parPlayerType;
     AddPosition(parPosition);
 }
示例#11
0
        protected override void InitializeCommands()
        {
            base.InitializeCommands();

            LoadCommand = ReactiveCommand.Create(() => Load());

            var canDelete = this.WhenAny(x => x.SelectedPlayerType, x => x.Value != null);

            DeleteCommand = ReactiveCommand.Create(() =>
            {
                if (SelectedPlayerType != null)
                {
                    PlayerTypes.Remove(SelectedPlayerType);
                    SelectedPlayerType = PlayerTypes.FirstOrDefault();
                }
            }, canDelete);

            ResetCommand = ReactiveCommand.Create(() =>
            {
                var defaultPlayerTypes = playerTypeService.CreateDefaultPlayerTypes(viewModelInfo.TableType);

                var defaultPlayerType = defaultPlayerTypes.FirstOrDefault(p => p.Name == SelectedPlayerType.Name);

                if (defaultPlayerType == null)
                {
                    return;
                }

                SelectedPlayerType.StatsToMerge = defaultPlayerType.Stats;
            }, canDelete);

            ExportCommand    = ReactiveCommand.Create(() => Export(new[] { SelectedPlayerType }), canDelete);
            ExportAllCommand = ReactiveCommand.Create(() => Export(playerTypes));
            ImportCommand    = ReactiveCommand.Create(() => Import());
        }
示例#12
0
        /*
         * This method is responsible for creating players. The types of players
         * as well as the controller and controller scheme are a must when calling
         * this method.
         * */
        private void CreatePlayer(PlayerTypes humanOrAI, PlayerTypes pacOrGhost, ControllerTypes controller, ControllerScheme scheme)
        {
            Element player = new Element();

            if (pacOrGhost == PlayerTypes.PacPlayer)
            {
                player.et = ElementTypes.PacPlayer;
            }
            else
            {
                player.et = ElementTypes.Ghost;
            }

            if (humanOrAI == PlayerTypes.Human)
            {
                if (controller == ControllerTypes.Keyboard)
                {
                    player.AddController(new KeyboardInput(scheme));
                }
                else
                {
                    player.AddController(new ControllerInput(scheme));
                }
            }
            else
            {
                player.AddController(new GhostAI(player));
            }

            players.Add(player);
        }
示例#13
0
        public Element(PlayerTypes PlayerType, ControllerTypes ControllerType, ControllerScheme scheme)
        {
            this.PlayerType     = PlayerType;
            this.ControllerType = ControllerType;

            Logic(scheme);
        }
示例#14
0
        /*
         * This method is responsible for creating players. The types of players
         * as well as the controller and controller scheme are a must when calling
         * this method.
         * */
        private void CreatePlayer(PlayerTypes humanOrAI, PlayerTypes pacOrGhost, ControllerTypes controller, ControllerScheme scheme)
        {
            Element player;

            if (pacOrGhost == PlayerTypes.PacPlayer)
                player = new PacPlayer();
            else
                player = new Ghost();

            if (humanOrAI == PlayerTypes.Human)
            {
                if (controller == ControllerTypes.Keyboard)
                    player.AddController(new KeyboardController(scheme));
                else
                    player.AddController(new XboxController(scheme));
            }
            else
            {
                if (pacOrGhost == PlayerTypes.PacPlayer)
                    player.AddController(new PacplayerAIController());
                else
                    player.AddController(new GhostAIController());
            }

            players.Add(player);
        }
示例#15
0
    protected Player myBasePlayer = null;   // set in Awake.

    static public Color GetBodyColorNeutral(PlayerTypes playerType)
    {
        switch (playerType)
        {
        case PlayerTypes.Any: return(new ColorHSB(90 / 360f, 0.67f, 1f).ToColor());

        case PlayerTypes.Clinga: return(new ColorHSB(300 / 360f, 0.5f, 0.92f).ToColor());

        case PlayerTypes.Dilata: return(new ColorHSB(190 / 360f, 0.67f, 0.87f).ToColor());

        case PlayerTypes.Flatline: return(new ColorHSB(160 / 360f, 0.67f, 0.87f).ToColor());

        case PlayerTypes.Flippa: return(new ColorHSB(330 / 360f, 0.8f, 0.82f).ToColor());

        case PlayerTypes.Freeza: return(new ColorHSB(188 / 360f, 0.37f, 0.98f).ToColor());

        case PlayerTypes.Jetta: return(new ColorHSB(290 / 360f, 0.7f, 0.7f).ToColor());

        case PlayerTypes.Jumpa: return(new ColorHSB(100 / 360f, 0.6f, 0.7f).ToColor());

        case PlayerTypes.Limo: return(new ColorHSB(140 / 360f, 0.05f, 0.5f).ToColor());

        case PlayerTypes.Neutrala: return(new ColorHSB(100 / 360f, 0.1f, 0.6f).ToColor());

        case PlayerTypes.Plunga: return(new Color255(25, 175, 181).ToColor());

        case PlayerTypes.Slippa: return(new Color255(220, 160, 40).ToColor());

        case PlayerTypes.Testa: return(new ColorHSB(0.4f, 0.1f, 0.9f).ToColor());

        case PlayerTypes.Warpa: return(new ColorHSB(250 / 360f, 0.5f, 0.9f).ToColor());

        default: Debug.LogWarning("PlayerBody color not defined: " + playerType + "."); return(Color.magenta);    // Oops.
        }
    }
示例#16
0
        public Keys GetKey(PlayerTypes type, string key)
        {
            switch (type)
            {
            case PlayerTypes.FirstPlayer:
                if (ControlKeys.Instance.FirstPlayersControlers.Any(firstPlayersControler => ControlKeys.Instance.FirstPlayersControlers.ContainsKey(key)))
                {
                    return(ControlKeys.Instance.FirstPlayersControlers[key]);
                }

                break;

            case PlayerTypes.SecondPlayer:
                if (ControlKeys.Instance.SecondPlayersControlers.Any(secondPlayersControler => ControlKeys.Instance.SecondPlayersControlers.ContainsKey(key)))
                {
                    ;
                }
                {
                    return(ControlKeys.Instance.SecondPlayersControlers[key]);
                }
                //default:
                //    throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            return(default(Keys));
        }
 public Player(string playerName, Stone stone, PlayerTypes playertype)
 {
     PlayerName      = playerName;
     this.stone      = stone;
     this.score      = 0;
     this.playertype = playertype;
 }
 public void Temp_OnPlayerTouchRoomDoor(RoomDoor rd)
 {
     if (Temp_IsTrialEnd(rd.MyRoom))
     {
         PlayerTypes playerType = Temp_GetTrialEndPlayerType(rd.MyRoom);
         charLineup.AddPlayerType(playerType);
     }
 }
示例#19
0
 public Player(PlayerIds pId, PlayerTypes pType, string pPadName, AIs pAI = AIs.Easy)
 {
     m_id      = pId;
     m_type    = pType;
     m_padName = pPadName;
     m_AI      = pAI;
     InitPad();
 }
示例#20
0
 public Player(string name, string connID, string color, bool isAlive, PlayerTypes type)
 {
     Name         = name;
     ConnID       = connID;
     Color        = color;
     this.isAlive = isAlive;
     this.type    = type;
 }
示例#21
0
 //This function checks the strength of the hit received from the player
 //If greater than the minimum hit strength - the objects Dies.
 public void ReceivePlayerKill(PlayerTypes playerType, float killStrength)
 {
     if (killStrength >= MinKillStrength)
     {
         SetPlayerScore(playerType);
         Die();
     }
 }
示例#22
0
    // ----------------------------------------------------------------
    //  Doers
    // ----------------------------------------------------------------
    private void SetCharTypeInMe(PlayerTypes _type)
    {
        CharTypeInMe = _type;
        // Color my body!
        Color playerColor = PlayerBody.GetBodyColorNeutral(CharTypeInMe);

        sr_body.color = Color.Lerp(playerColor, Color.black, 0.2f); // darken it slightly.
    }
示例#23
0
            private bool IsPlayerChecked(PlayerTypes player, IEnumerable <Piece> rows, IEnumerable <Point> enemyPossibleMoves = null)
            {
                var enemy = player.GetOtherPlayer();

                enemyPossibleMoves = enemyPossibleMoves ?? GetPossibleMoves(rows, enemy);
                var kingPos = rows.First(piece => (piece?.GetType() == typeof(King) && piece?.Player == player)).Position;

                return(enemyPossibleMoves.Any(possibleMove => possibleMove.Equals(kingPos)));
            }
 public void OnButton_CycleChar()
 {
     if (CanCyclePlayerType())   // If we can...!
     {
         SetIsCharSwapping(true);
         PlayerTypes nextType = charLineup.GetNextPlayerType();
         gameController.SetPlayerType(nextType);
     }
 }
示例#25
0
 /// <summary>Инициализация экземпляра класса <see cref="Player"/></summary>
 /// <param name="order">Номер игрока по порядку</param>
 /// <param name="playerType">Тип игрока</param>
 /// <param name="cellValue">Чем играет игрок (Крестик или Нолик)</param>
 public Player(int order, PlayerTypes playerType, CellValues cellValue)
 {
     this.PlayerType = playerType;
     this.CellValue  = cellValue;
     this.Order      = order;
     this.Result     = ResultTypes.Play;
     History         = new List <Step>();
     Variants        = null;
     NextCell        = null;
 }
示例#26
0
文件: Player.cs 项目: ZAKosma/PTP
 public Player(int seed, PlayerTypes types, int startingWealth, int variance)
 {
     id             = seed;
     type           = types;
     points         = startingWealth;
     cryptocurrency = startingWealth / 2;
     refUser        = null;
     invst          = false;
     varianceMeter  = variance;
 }
示例#27
0
文件: Player.cs 项目: ZAKosma/PTP
 public Player(int seed, PlayerTypes types, int startingWealth, int variance, Player referrer, bool invested = false)
 {
     id             = seed;
     type           = types;
     points         = startingWealth;
     cryptocurrency = startingWealth / 2;
     refUser        = referrer;
     invst          = invested;
     varianceMeter  = variance;
 }
示例#28
0
 // ----------------------------------------------------------------
 //  Doers
 // ----------------------------------------------------------------
 public void AddPlayerType(PlayerTypes pt)
 {
     Lineup.Add(pt);
     // TEMP: For now, auto-remove Neutrala.
     if (pt != PlayerTypes.Neutrala && Lineup.Contains(PlayerTypes.Neutrala))
     {
         Lineup.Remove(PlayerTypes.Neutrala);
     }
     SaveLineup();
 }
示例#29
0
 // ----------------------------------------------------------------
 //  Events
 // ----------------------------------------------------------------
 public void OnSetCurrPlayerType(PlayerTypes pt)
 {
     // Update CurrTypeIndex!
     for (int i = 0; i < Lineup.Count; i++)
     {
         if (pt == Lineup[i])
         {
             CurrTypeIndex = i; return;
         }
     }
 }
示例#30
0
 public gameForm(settingsForm mainForm, int amount = 25, int maxPerTurn = 3,
                 PlayerTypes firstPlayer           = PlayerTypes.Player, PlayerTypes secondPlayer = PlayerTypes.AI)
 {
     InitializeComponent();
     this.maxPerTurn   = maxPerTurn;
     form              = mainForm;
     game              = new GameEngine(amount, maxPerTurn);
     validator         = new Validation();
     this.firstPlayer  = firstPlayer;
     this.secondPlayer = secondPlayer;
 }
示例#31
0
    }                                          // sum of ALL types!
    //private int total_all; // sum of all other types.


    // Getters (Public)
    /// Returns num eaten by ONLY this PlayerType.
    public int Eaten(PlayerTypes pt)
    {
        if (pt == PlayerTypes.Any)
        {
            return(eaten[pt]);
        }
        else
        {
            return(eaten[pt] + eaten[PlayerTypes.Any]);
        }
    }
示例#32
0
 /// Returns num for this PlayerType, PLUS num for the ANY PlayerType! (E.g. if 5 Plunga and 3 Any, I'll return 8.)
 public int Total(PlayerTypes pt)
 {
     if (pt == PlayerTypes.Any)
     {
         return(total[pt]);
     }
     else
     {
         return(total[pt] + total[PlayerTypes.Any]);
     }
 }
 public static void ControlsPlayer(IKeysLibrary library, PlayerTypes type,IPlayer first, IPlayer second)
 { 
     switch (type)
     {
         case PlayerTypes.FirstPlayer:
             if (firstControler)
             {
                 PlayerControls.UpdatePlayer(library,type, first);
             }
             break;
         case PlayerTypes.SecondPlayer:
             if (secondControler)
             {
                 PlayerControls.UpdatePlayer(library,type, second);
             }
             break;
         //default:
         //    throw new ArgumentOutOfRangeException(nameof(type), type, null);
     }
 }
示例#34
0
        public Keys GetKey(PlayerTypes type,string key)
        {
            switch (type)
            {
                    case PlayerTypes.FirstPlayer:
                    if (ControlKeys.Instance.FirstPlayersControlers.Any(firstPlayersControler => ControlKeys.Instance.FirstPlayersControlers.ContainsKey(key)))
                    {
                        return ControlKeys.Instance.FirstPlayersControlers[key];
                    }

                    break;

                    case PlayerTypes.SecondPlayer:
                    if (ControlKeys.Instance.SecondPlayersControlers.Any(secondPlayersControler => ControlKeys.Instance.SecondPlayersControlers.ContainsKey(key)));
                    {
                        return ControlKeys.Instance.SecondPlayersControlers[key];
                    }
                //default:
                //    throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            return default(Keys);
        }
示例#35
0
        /*
         * This method is responsible for creating players. The types of players
         * as well as the controller and controller scheme are a must when calling
         * this method.
         * */
        private void CreatePlayer(PlayerTypes humanOrAI, PlayerTypes pacOrGhost, ControllerTypes controller, ControllerScheme scheme)
        {
            Element player = new Element();

            if (pacOrGhost == PlayerTypes.PacPlayer)
                player.et = ElementTypes.PacPlayer;
            else
                player.et = ElementTypes.Ghost;

            if (humanOrAI == PlayerTypes.Human)
            {
                if (controller == ControllerTypes.Keyboard)
                    player.AddController(new KeyboardInput(scheme));
                else
                    player.AddController(new ControllerInput(scheme));
            }
            else
            {
                player.AddController(new GhostAI(player));
            }

            players.Add(player);
        }
示例#36
0
    public Player CreatePlayer(int x, int y, PlayerTypes type)
    {
        Transform parent = this.container.Find("Entities/Players");

        GameObject obj = GameObject.Instantiate(prefabs.players[type]);
        obj.transform.SetParent(parent, false);
        obj.name = type.ToString(); //"Player";
        Player player = obj.GetComponent<Player>();
        player.Init(this, x, y, Color.white);

        player.type = type;

        return player;
    }
示例#37
0
 public Paddle(Texture2D texture, Vector2 location, Rectangle screenBounds,PlayerTypes playerType)
     : base(texture, location,screenBounds)
 {
     _playerType = playerType;
 }
        private static void UpdatePlayer(IKeysLibrary library, PlayerTypes type, IPlayer player)
        {

            player.InputManagerInstance.RotateStates();

            #region Down Direction
            
            if (player.InputManagerInstance.KeyDown(library.GetKey(type,"Down")))
            {
                player.Ship.Move(CoordsDirections.Ordinate, Direction.Positive, player.Ship.Speed);
                if (type == PlayerTypes.FirstPlayer)
                {
                    PositionValidation.FirstShipValidation();
                }
                else
                {
                    PositionValidation.SecondShipValidation();
                }
               
            }
            
            #endregion

            #region Up Direction

            if (player.InputManagerInstance.KeyDown(library.GetKey(type, "Up")))
            {
                player.Ship.Move(CoordsDirections.Ordinate, Direction.Negative, player.Ship.Speed);
                if (type == PlayerTypes.FirstPlayer)
                {
                    PositionValidation.FirstShipValidation();
                }
                else
                {
                    PositionValidation.SecondShipValidation();
                }
            }

            #endregion

            #region Right  Direction
            if (player.InputManagerInstance.KeyDown(library.GetKey(type, "Right")))
            {
                player.Ship.Move(CoordsDirections.Abscissa, Direction.Positive, player.Ship.Speed);
                PositionValidation.FirstShipValidation();
                if (type == PlayerTypes.FirstPlayer)
                {
                    PositionValidation.FirstShipValidation();
                }
                else
                {
                    PositionValidation.SecondShipValidation();
                }
            }

            #endregion

            #region Left Direction
            if (player.InputManagerInstance.KeyDown(library.GetKey(type, "Left")))
            {
                player.Ship.Move(CoordsDirections.Abscissa, Direction.Negative, player.Ship.Speed);
                PositionValidation.FirstShipValidation();
                if (type == PlayerTypes.FirstPlayer)
                {
                    PositionValidation.FirstShipValidation();
                }
                else
                {
                    PositionValidation.SecondShipValidation();
                }
            }

            #endregion

            player.InputManagerInstance.Update();
        }
 private static void ControlsPlayer(PlayerTypes type)
 {
     if (control)
     {
         switch (type)
         {
             case PlayerTypes.FirstPlayer:
                 CombatManager.UpdateFirstPlayer();
                 break;
             case PlayerTypes.SecondPlayer:
                 CombatManager.UpdateSecondPlayer();
                 break;
         }
     }
 }
        private bool InitializeWindowsMediaPlayerControl()
        {
            try
            {
                DisposeQuickTimeControl();

                wmPlayer = new WindowsMediaPlayerControl();

                wmPlayer.OpenStateChanged += new EventHandler<OpenStateChangedEventArgs>(this.handleOpenStateChanged);
                wmPlayer.PlayStateChanged += new EventHandler<PlayStateChangedEventArgs>(this.handlePlayStateChanged);
                wmPlayer.PlayerError += new System.EventHandler<PlayerErrorEventArgs>(this.handlePlayerError);

                wmPlayer.Visible = false;

                this.Controls.Add(wmPlayer);

                this.PlayerType = PlayerTypes.WindowsMediaPlayer;

                Logger.Info("success");

                return true;
            }
            catch (Exception ex)
            {
                Logger.Error("Error initializing: " + ex);

                return false;
            }
        }
	public List<Player> GetPlayersByPlayerType(PlayerTypes pmType)
	{
		bool isPlayer = false;

		if (pmType == PlayerTypes.PLAYER) {
			isPlayer = true;
		}

		List<Player> result = new List<Player> ();

		foreach (Player pooled in mPool) {
			FigurineStatus status = pooled.Figurine.GetComponent<FigurineStatus> ();

			if (status.enemy == !isPlayer)
				result.Add (pooled);
		}

		return result;
	}
示例#42
0
文件: Paddle.cs 项目: joshuarose/Pong
 public Paddle(Texture2D texture, Vector2 location, Rectangle gameBoundaries, PlayerTypes playertype)
     : base(texture, location, gameBoundaries)
 {
     _playertype = playertype;
 }
示例#43
0
文件: Paddle.cs 项目: k0vl/Pong
 public Paddle(Texture2D texture, Vector2 location, Rectangle gameBoundries, PlayerTypes playerType)
     : base(texture, location, gameBoundries)
 {
     this.playerType = playerType;
     this.reactionTreshold = random.Next(0, 5);
 }
示例#44
0
 public Player(PlayerTypes playerType, PlayerColours colour)
 {
     CurrentNoOfPieces = maximumNoOfPieces;
     PlayerColour = colour;
     this.PlayerType = playerType;
 }
示例#45
0
        public void Initialise(Vector2 pos, PlayerTypes type)
        {
            this.position = pos;
            this.heightMax = pos.Y - 50;
            this.counter = 0;
            this.flipper = false;

            switch (type)
            {
                case PlayerTypes.FirstPlayer:
                    this.Fire = new Image("firstFire");
                    this.LoadContent();
                    break;
                case PlayerTypes.SecondPlayer:
                    this.Fire = new Image("secondFire");
                    this.LoadContent();
                    break;
            }
        }
 public static void CannonBallControls(PlayerTypes type, GameTime gameTime)
 {
     switch (type)
     {
         case PlayerTypes.FirstPlayer:
             if (firstController)
             {
                 FirstPlayerBallControls(gameTime);
             }
             break;
         case PlayerTypes.SecondPlayer:
             if (secondController)
             {
                 SecondPlayerBallControls(gameTime);
             }
             break;
             //default:
             //    throw new ArgumentOutOfRangeException(nameof(type), type, null);
     }
 }
        private bool InitializeQuickTimePlayerControl()
        {
            if (!MainModel.isQuickTimeSupported) // it failed last time so don't try initializing again this session
            {
                Logger.Debug("isQuickTimeSupported = false");
                return false;
            }

            try
            {
                DisposeWindowsMediaPlayerControl();

                qtPlayer = new QuickTimePlayerControl();

                qtPlayer.OpenStateChanged += new EventHandler<OpenStateChangedEventArgs>(handleOpenStateChanged);
                qtPlayer.PlayStateChanged += new EventHandler<PlayStateChangedEventArgs>(handlePlayStateChanged);
                qtPlayer.PlayerError += new EventHandler<PlayerErrorEventArgs>(handlePlayerError);

                qtPlayer.Visible = false;

                this.Controls.Add(qtPlayer);

                this.PlayerType = PlayerTypes.QuickTime;

                AnalyticsHelper.FireEvent("Each details - QuickTime installed");

                Logger.Info("success");

                return true;
            }
            catch (Exception ex)
            {
                Logger.Error("Error initializing: " + ex);

                MainModel.isQuickTimeInstalled = false;

                MainModel.isQuickTimeSupported = false;

                AnalyticsHelper.FireEvent("Each details - QuickTime not installed");

                return false;
            }
        }
 public static void CannonBallDraw(PlayerTypes type, SpriteBatch spriteBatch)
 {
     switch (type)
     {
         case PlayerTypes.FirstPlayer:
             FirstPlayerBallDraw(spriteBatch);
             break;
         case PlayerTypes.SecondPlayer:
             SecondPlayerBallDraw(spriteBatch);
             break;
     }
 }
示例#49
0
 public Paddle(Texture2D texture, Vector2 location, Rectangle gameBoundaries, PlayerTypes playerType)
     : base(texture, location, gameBoundaries)
 {
     this.playerTypes = playerType;// lets a paddle be a computer or player
 }
        public static void Update(GameTime gameTime, PlayerTypes type, IPlayer current)
        {
            RegenManager.EnergyRegenUpdate();
            current.Ship.Specialty.Update(gameTime, current);
            ControlsPlayer(type);

            #region Ball Players Collisions

            // KOGATO TEPAT PURVIQ
            ballColliding = BallCollision.Collide(
                    FirstPlayer.Instance.Ship,
                    BallControls.BallSecond);
            if (ballColliding)
            {
                firstPlayerHitCounter = 0;
                SecondPlayer.Instance.Ship.Attack(FirstPlayer.Instance.Ship);
            }

            ballColliding = BallCollision.Collide(
                SecondPlayer.Instance.Ship,
                BallControls.BallFirst);
            if (ballColliding)
            {
                secondPlayerHitCounter = 0;
                FirstPlayer.Instance.Ship.Attack(SecondPlayer.Instance.Ship);

            }
            #endregion

            #region Ball Boss Collisions
            // 5 - const i za spawn na bossa
            if (activateBossWatch.Elapsed.TotalSeconds > BossActivationSeconds)
            {
                // topchEto na pyrviq igrach
                bossBallCollide = OctopusCollision.BossBallCollide(BallControls.BallFirst);
                if (bossBallCollide)
                {
                    firstPlayerHitCounter = 0;
                    Boss.Instance.Health -= FirstPlayer.Instance.Ship.Damage;  // ne e dobre da e tuk, no Attack() priema Ship, a ne Boss
                }

                // topchEto na vtoriq igrach
                bossBallCollide = OctopusCollision.BossBallCollide(BallControls.BallSecond);
                if (bossBallCollide)
                {
                    secondPlayerHitCounter = 0;
                    Boss.Instance.Health -= SecondPlayer.Instance.Ship.Damage;  // ne e dobre da e tuk, no Attack() priema Ship, a ne Boss
                }
            }
            #endregion

            #region BossVsPlayer Collisions

            if (activateBossWatch.Elapsed.TotalSeconds > BossActivationSeconds)
            {
                Boss.Instance.Update();
                bossVsShipCollide = OctopusCollision.Collide(current.Ship);
                if (bossVsShipCollide)
                {
                    bossHitCounter = 0;
                    Boss.Instance.Attack(current.Ship);
                    if (current is FirstPlayer)
                    {
                        playerFlagBossCollide = 1;
                    }
                    else
                    {
                        playerFlagBossCollide = 0;
                    }
                }
            }

            #endregion
        }