/// <summary> /// Make a new player. /// </summary> /// <param name="playerNumber">The player's number(i.e. player one, or player two)</param> /// <param name="position">The starting position of the player.</param> public Player(PlayerNumber playerNumber, Vector2 position) : base(position, Vector2.Zero, Vector2.Zero, new Vector2(MAX_VELOCITY_X, MAX_VELOCITY_Y), new Vector2(ACCELERATION_X, ACCELERATION_Y), new Vector2(DECELERATION_X, DECELERATION_Y), playerNumber == PlayerNumber.One ? TextureManager.GetTexture(TextureNames.PLAYER_ONE_IDLE) : TextureManager.GetTexture(TextureNames.PLAYER_TWO_IDLE)) { this.PlayerNumber = playerNumber; this.origin = new Vector2(Texture.Width / 2, Texture.Height / 2); if (PlayerNumber == PlayerNumber.One) { Up = Keys.Up; Down = Keys.Down; Right = Keys.Right; Left = Keys.Left; Fire = Keys.RightControl; } else { Up = Keys.W; Down = Keys.S; Right = Keys.D; Left = Keys.A; Fire = Keys.LeftControl; } }
public bool TryEngage(IPlayer playerOne, IPlayer playerTwo, out PlayerNumber number) { number = PlayerNumber.None; if (playerOne.GType != GestureType.Rock) return false; switch (playerTwo.GType) { case GestureType.Scissor: number = PlayerNumber.PlayerOne; return true; case GestureType.Paper: number = PlayerNumber.PlayerTwo; return true; case GestureType.Rock: return true; case GestureType.Lizard: number = PlayerNumber.PlayerOne; return true; case GestureType.Spock: number = PlayerNumber.PlayerTwo; return true; default: throw new NotImplementedException(); } }
public Scissor(PlayerNumber number) { Number = number; GType = GestureType.Scissor; WinTo = new List<GestureType> { GestureType.Paper, GestureType.Lizard }; }
public Lizard(PlayerNumber number) { Number = number; GType = GestureType.Lizard; WinTo = new List<GestureType> { GestureType.Spock, GestureType.Paper }; }
public Paper(PlayerNumber number) { Number = number; GType = GestureType.Paper; WinTo = new List<GestureType> { GestureType.Rock, GestureType.Spock }; }
public static RTSPlayer GetPlayer(PlayerNumber number) { foreach (RTSPlayer player in Players) { if ((int)number == player.Number) { return player; } } return null; }
internal void Bind(int touchPointId, PlayerNumber player) { var playersTouchPoints = _boundTouchPoints.Where(btp => btp.Value == player).ToList(); foreach (var touchPointBinding in playersTouchPoints) { _boundTouchPoints.Remove(touchPointBinding.Key); } _boundTouchPoints.Add(touchPointId, player); }
/// <summary> /// Returns whether or not the given player owns this continent. /// </summary> /// <param name="game">The game that this continent is a part of.</param> /// <param name="playerName">The name of the player who may own this country.</param> /// <returns>Whether or not the given player owns this continent.</returns> public bool OwnedByName(Game game, PlayerNumber playerName) { foreach(Country country in Countries(game)) { if(country.OwnedBy != playerName) { return false; } } return true; }
public override void SetPeripheralString(PlayerNumber aPlayerNumber) { if (aPlayerNumber != PlayerNumber.God) { PeripheralString = "Joystick" + aPlayerNumber.ToString(); } else { PeripheralString = "Joystick"; } }
/// <summary> /// Method to check if a touch point is bound to a specific player. /// </summary> /// <param name="touchPointId">The touch point Id to check.</param> /// <param name="player">The player to check.</param> /// <returns>Flag indicating if the touch point specified is bound to the player specified.</returns> public bool IsTouchPointBoundToPlayer(int touchPointId, PlayerNumber player) { PlayerNumber boundPlayer; if (_boundTouchPoints.TryGetValue(touchPointId, out boundPlayer)) { return boundPlayer == player; } else { return false; } }
public PongPaddle(PlayerNumber pNumber, Sprite sprite, Vector2 startPosition, Vector2 direction, float speed, ContentManager contMan, Rectangle collision, SoundEffect soundEffect) : base(sprite, startPosition, direction, speed, contMan, collision, soundEffect) { this.score = 0; playerNumber = pNumber; if (playerNumber == Pong.PlayerNumber.player2) canDoAnything = false; if (canDoAnything) { Thread t = new Thread(UpdatePosition); t.Start(); } }
// 勝利条件系 public void FinishBattle(PlayerNumber _winner) { this.Winner = _winner; this.isFinishedBattle = true; this.ChageState(State.Result); }
public float GetPlayerHitPoint(PlayerNumber _playerNumber) { return(this.GetPlayer(_playerNumber).HitPoint); }
protected void AddPlayer(PlayerNumber playerNumber, IPlayer player) { Players[playerNumber] = player; }
public bool BelongsTo(PlayerNumber player) { return(PawnPlayerNumber == player); }
public Player GetPlayerByNumber(PlayerNumber _targetPlayer) { return(playerByNumber[_targetPlayer]); }
public void SelectPlayer(PlayerNumber newPlayerNumber, Player_asset newPlayerAsset) { Debug.Log("new player:" + newPlayerNumber + " (" + newPlayerAsset.GetPlayerName() + ")"); }
public void SelectPlayer1() { playerNumber = PlayerNumber.one; Debug.Log("player 1 selected"); }
public override void SetPeripheralString(PlayerNumber aPlayerNumber) { PeripheralString = "Keyboard"; }
public abstract void SetPeripheralString(PlayerNumber aPlayerNumber);
public GameState(PlayerNumber winner, byte[] winningLine) { Winner = winner; WinningLine = winningLine; }
void Player(PlayerNumber number, Action <Grid> action) => action(number switch
protected override void BeforeMove() { currentPlayer = Game.CurrentPlayer; }
public Line GetBaseline(PlayerNumber playerNumber, int totalPlayers) { return(baselines[totalPlayers == 2 ? (playerNumber == PlayerNumber.Player1 ? 0 : 2) : ((int)playerNumber)]); }
public Round Defeated(PlayerNumber defeated) => new Round(Number, MatchedOther, Defeateds.Append(defeated).ToArray());
public void Score(PlayerNumber whoScored) { ballCount--; switch (whoScored) { case PlayerNumber.player1: hasJustScored = true; p1Pad.Score++; break; case PlayerNumber.player2: hasJustScored = true; p2Pad.Score++; break; default: break; } }
public void SelectPlayer2() { playerNumber = PlayerNumber.two; Debug.Log("player 2 selected"); }
public void GameOver(PlayerNumber winner) { winnerTxt.text = winner + " gagne la partie !"; gameObject.SetActive(true); }
public Player(PlayerNumber playerNumber) { this.playerNumber = playerNumber; }
/// <summary> /// Updates the background color (=owner player) /// </summary> /// <param name="player"></param> public void UpdateOwnerPlayer(PlayerNumber player) { Button.Background = player.Color(); }
static public bool HasKeyboard(PlayerNumber player = PlayerNumber.Player1) { return(instance.players [(int)player].keyboard); }
public void Init(PlayerNumber _playerNumber) { this.PlayerNumber = _playerNumber; this.imgLiveColor.fillAmount = 1.0f; this.HitPointMax = GameManager.Instance.GetPlayerHitPointMax(this.PlayerNumber); }
static public ControllerNumber GetControllerNumber(PlayerNumber player = PlayerNumber.Player1) { return(instance.players [(int)player].controller); }
public Domain.Action Execute(IList <RoundResult> previousRoundResults, PlayerNumber playerNumber) { return(Domain.Action.Cooperate); }
public Player(Game game, PlayerNumber playerNumber, PlayerTouchBinder touchBinder) : base(game) { _playerNumber = playerNumber; _touchBinder = touchBinder; }
public GameEngine() { lastPlayerTurn = PlayerNumber.FirstPlayer; RegisterNewGameState(new GameState()); }
public bool EventPlayerNumber(PlayerNumber ev) { return(EventRedirect(OnPlayerNumber, ev)); }
public float GetPlayerHitPointMax(PlayerNumber _playerNumber) { return(((RiaPlayerScript)this.GetPlayer(_playerNumber).Actor.CharacterScript).HitPointMax); }
public void SubtractResource(PlayerNumber PlayerNumber, Resource Resource, int Amount) { Resources[(int)PlayerNumber, (int)Resource] -= Amount; }
private void YoureWinner(PlayerNumber playerNo) { winnerText.text = "게임종료!\n플레이어" + ((int)playerNo + 1) + "의 승리"; ActiveRestartButton(); }
public Round NextMatch(PlayerNumber matchedOther) => new Round(Number + 1, matchedOther, Array.Empty <PlayerNumber>());
/// <summary> /// Create a new instance of the Pallet class using the game reference and a player number. /// </summary> /// <param name="game">Reference to the game class.</param> /// <param name="playerNumber">Player number.</param> public Pallet(PungGame game, PlayerNumber playerNumber) : base(game) { playerIndex = playerNumber; // Associate the pallet to a player using it's player number. }
public int GetResource(PlayerNumber PlayerNumber, Resource Resource) { return Resources[(int)PlayerNumber, (int)Resource]; }
public void AddResource(PlayerNumber PlayerNumber, Resource Resource, int Amount) { Resources[(int)PlayerNumber, (int)Resource] += Amount; }
public void ButtonPressedMessage(ButtonPressed btnPrs, PlayerNumber playnum) { Enqueue(new LogMsg { ReportedAt = DateTime.UtcNow, ButtonPressed = btnPrs, Player = playnum, Seriousness = Severity.Info, LogType = LogType.InputPressed }); }
public bool IsPlayerTurnRight(PlayerNumber number) { switch(number) { case PlayerNumber.One: return IsKeyPress(Keys.Q, PlayerIndex.One) || IsButtonPress(Buttons.DPadRight, PlayerIndex.One); case PlayerNumber.Two: return IsKeyPress(Keys.LeftAlt, PlayerIndex.One) || IsButtonPress(Buttons.DPadRight, PlayerIndex.Two); case PlayerNumber.Three: return IsKeyPress(Keys.OemComma, PlayerIndex.One) || IsButtonPress(Buttons.DPadRight, PlayerIndex.Three); case PlayerNumber.Four: return IsKeyPress(Keys.Down, PlayerIndex.One) || IsButtonPress(Buttons.DPadRight, PlayerIndex.Four); case PlayerNumber.Five: return IsKeyPress(Keys.Subtract, PlayerIndex.One) || IsButtonPress(Buttons.B, PlayerIndex.One); case PlayerNumber.Six: return IsKeyPress(Keys.B, PlayerIndex.One) || IsButtonPress(Buttons.B, PlayerIndex.Two); } return false; }
void Start() { var go = gameObject.GetComponent<GameEntity>() as GameEntity; if (go == null) throw new UnityException("attack script is not attached to a GameEntity."); owner = go.owner; projectileBase.transform.position = transform.position; }
/// <summary> /// Ends current player's turn and transitions to the next player. /// </summary> public void EndCurrentPlayerTurn() { if (CurrentPlayerNumber == PlayerNumber.P1) { CurrentPlayerNumber = PlayerNumber.P2; if (!Players[CurrentPlayerNumber].IsActive) { EndCurrentPlayerTurn(); return; } } else if (CurrentPlayerNumber == PlayerNumber.P2 && Players.Count > 2) { CurrentPlayerNumber = PlayerNumber.P3; if (!Players[CurrentPlayerNumber].IsActive) { EndCurrentPlayerTurn(); return; } } else if (CurrentPlayerNumber == PlayerNumber.P3 && Players.Count > 3) { CurrentPlayerNumber = PlayerNumber.P4; if (!Players[CurrentPlayerNumber].IsActive) { EndCurrentPlayerTurn(); return; } } else if (CurrentPlayerNumber == PlayerNumber.P4 && Players.Count > 4) { CurrentPlayerNumber = PlayerNumber.P5; if (!Players[CurrentPlayerNumber].IsActive) { EndCurrentPlayerTurn(); return; } } else if (CurrentPlayerNumber == PlayerNumber.P5 && Players.Count > 5) { CurrentPlayerNumber = PlayerNumber.P6; if (!Players[CurrentPlayerNumber].IsActive) { EndCurrentPlayerTurn(); return; } } else { CurrentPlayerNumber = PlayerNumber.P1; if (!Players[CurrentPlayerNumber].IsActive) { EndCurrentPlayerTurn(); return; } } Players[CurrentPlayerNumber].SetReinforcments(); GameLog.AddEvent(Players[CurrentPlayerNumber].Name + " has begun their turn with " + Players[CurrentPlayerNumber].UnitsToPlace.ToString() + " reinforcements"); }
private void WindowLoaded(object sender, RoutedEventArgs e) { currentPlayer = PlayerNumber.First; MakeGameBoard(); }
public InputConfig(InputPeripheral aPeripheral, PlayerNumber aNumber = PlayerNumber.God, int aJoystickNumber = 0) { Peripheral = aPeripheral; Number = aNumber; JoystickNumber = aJoystickNumber; InputObjects = new Dictionary<string, InputObj>(); Peripheral.SetPeripheralString(Number); Debug.Log(aNumber); //SetInputObjs(); }
// Update is called once per frame void Update() { if (State == GameState.STARTING) { GameStartTimer -= Time.deltaTime; if (GameStartTimer <= 0) { State = GameState.PLAYING; PlayerNumber playerToStart = PlayerNumber.ONE; if (IsRestart) { IsRestart = false; if (LastStartingPlayer != PlayerNumber.UNKNOWN) { playerToStart = LastStartingPlayer; } else { if (Random.Range(0f, 1f) < 0.5f) { playerToStart = PlayerNumber.ONE; } else { playerToStart = PlayerNumber.TWO; } } } else { switch (FirstPlayer) { case StartingPlayer.ONE: playerToStart = PlayerNumber.ONE; break; case StartingPlayer.TWO: playerToStart = PlayerNumber.TWO; break; case StartingPlayer.RANDOM: if (Random.Range(0f, 1f) < 0.5f) { playerToStart = PlayerNumber.ONE; } else { playerToStart = PlayerNumber.TWO; } break; case StartingPlayer.ALTERNATING: if (LastStartingPlayer == PlayerNumber.UNKNOWN) { if (Random.Range(0f, 1f) < 0.5f) { playerToStart = PlayerNumber.ONE; } else { playerToStart = PlayerNumber.TWO; } } else { switch (LastStartingPlayer) { case PlayerNumber.ONE: playerToStart = PlayerNumber.TWO; break; case PlayerNumber.TWO: playerToStart = PlayerNumber.ONE; break; } } break; } } LastStartingPlayer = playerToStart; StartTurn(playerToStart); } } //DEBUG remove if (Input.GetKeyDown(KeyCode.A)) { Win(PlayerNumber.ONE); } if (Input.GetKeyDown(KeyCode.S)) { INPUT_PlayAgain(); } }
public void ShowMessage(PlayerNumber recipientPlayer, string message) { NotificationText.gameObject.SetActive(true); NotificationText.ShowMessage(recipientPlayer, message); }
// Start is called before the first frame update void Start() { fartAudio = GetComponent <AudioSource>(); mPlayerNumer = gameObject.CompareTag("Player") ? PlayerNumber.Player1 : PlayerNumber.Player2; }
public void TotalDamageTaken(int dmgtk, PlayerNumber playnum) { Enqueue(new LogMsg { ReportedAt = DateTime.UtcNow, Player = playnum, DamageTaken = dmgtk, Seriousness = Severity.Info, LogType = LogType.DamageTaken }); }
public bool IsPlayerTurnLeft(PlayerNumber number) { switch (number) { case PlayerNumber.One: return IsKeyPress(Keys.D1, PlayerIndex.One) || IsButtonPress(Buttons.DPadLeft, PlayerIndex.One); case PlayerNumber.Two: return IsKeyPress(Keys.LeftControl, PlayerIndex.One) || IsButtonPress(Buttons.DPadLeft, PlayerIndex.Two); case PlayerNumber.Three: return IsKeyPress(Keys.M, PlayerIndex.One) || IsButtonPress(Buttons.DPadLeft, PlayerIndex.Three); case PlayerNumber.Four: return IsKeyPress(Keys.Left, PlayerIndex.One) || IsButtonPress(Buttons.DPadLeft, PlayerIndex.Four); case PlayerNumber.Five: return IsKeyPress(Keys.Multiply, PlayerIndex.One) || IsButtonPress(Buttons.X, PlayerIndex.One); case PlayerNumber.Six: return IsKeyPress(Keys.V, PlayerIndex.One) || IsButtonPress(Buttons.X, PlayerIndex.Two); } return false; }