public Player(float posX, float posY, PlayerColour colour, PlayerDirection direction) { position = new PointF(posX, posY); UpdateHitbox(); playerColour = colour; playerDirection = direction; moving = false; maxBombs = 1; bombsLeft = maxBombs; moveSpeed = 1.0f; bombSize = 1; bombType = BombType.GRAY; falling = false; animationTick = 0; animationFrame = 0; animationFoot = false; keysDown = new bool[4] { false, false, false, false }; }
private void SetShapeColour(PlayerColour colour) { if (Shape != null) { Shape.FillColor = colour.ToRGB(); } }
public Player CreatePlayer(string playerName, int playerID, PlayerColour playerColour) { CarType noCar = Model.CarType.NoCar; var fundList = new List <Fund>(); var stockList = new List <Stock>(); var purchaseHistory = new List <PurchaseHistory>(); var happeningCards = new List <HappeningCard>(); var streetList = new List <Street>(); var corporateGroupList = new List <CorporateGroup>(); var player = new Player { PlayerID = playerID, PlayerName = playerName, PlayerColour = playerColour, Cartype = noCar, BankAccount = 0, Loan = 0, Wallet = 600000, Funds = fundList, Stocks = stockList, HappeningCards = happeningCards, Streets = streetList, Coroprategroup = corporateGroupList, PurchaseHistory = purchaseHistory }; return(player); }
public PlayerHuman(PlayerCreateDTO playerCreateDTO, int playerId) { this.Id = playerId; this.Name = playerCreateDTO.Name; this.PlayerColour = playerCreateDTO.PlayerColour; this.PlayerType = PlayerType.Human; }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody>(); anim = GetComponent <Animator>(); audioSource = GetComponent <AudioSource>(); anim.SetFloat("Speed", movePower); anim.SetBool("isRunning", false); playerColours = new PlayerColour[] { PlayerColour.Blue, PlayerColour.Green, PlayerColour.Red }; colourIndex = 0; trail = GetComponentInChildren <ParticleSystem> (); currentColour = PlayerColour.Blue; hatParent = transform.Find("Head_Section").Find("Hat").transform; layerMask = LayerMask.GetMask("Platform"); startPosition = transform.position.z + 30f; // Magic number used here is the distance the player is from the 0 z position in Global Position. StartCoroutine("CheckVerticalSwipes"); InvokeRepeating("AdjustSpeed", 0, 50); /* * // Google VR * CardboardMagnetSensor.SetEnabled(true); * //Disable screen dimming * Screen.sleepTimeout = SleepTimeout.NeverSleep; */ }
private void OnCrossingFinishLine(PlayerColour ColourOfPlayerCrossingFinish) { switch (ColourOfPlayerCrossingFinish) { case PlayerColour.Blue: PostionalImages[PlayersPastFinishLine] = BluePlayerImage; break; case PlayerColour.Green: PostionalImages[PlayersPastFinishLine] = GreenPlayerImage; break; case PlayerColour.Yellow: PostionalImages[PlayersPastFinishLine] = YellowPlayerImage; break; case PlayerColour.Red: PostionalImages[PlayersPastFinishLine] = RedPlayerImage; break; } ++PlayersPastFinishLine; if (PlayersPastFinishLine >= PlayersInLevel) { GameObject NewCanvasElement = Instantiate(Positions, new Vector3(100, Screen.height / 2), new Quaternion(0, 0, 0, 0)); NewCanvasElement.transform.SetParent(SceneCanvas.transform); for (int i = 0; i < PlayersInLevel; ++i) { NewCanvasElement = Instantiate(PostionalImages[i], new Vector3(400.0f, ((Screen.height / 2) + 200) - (100 * i), 0.0f), new Quaternion(0, 0, 0, 0)); NewCanvasElement.transform.SetParent(SceneCanvas.transform); } } }
public void NextColour() { colourIndex++; currentColour = playerColours[colourIndex % playerColours.Length]; var main = trail.main; switch (currentColour) { case PlayerColour.Blue: SetHatColourToAllRenderers(blueColour); main.startColor = blueColour; uiManager.UpdateColourIndicator(greenColour, redColour); break; case PlayerColour.Green: SetHatColourToAllRenderers(greenColour); main.startColor = greenColour; uiManager.UpdateColourIndicator(redColour, blueColour); break; case PlayerColour.Red: SetHatColourToAllRenderers(redColour); main.startColor = redColour; uiManager.UpdateColourIndicator(blueColour, greenColour); break; } if (!inAir && currentPlatform) { CheckColourMatch(currentPlatform); } }
public PlayerGetDTO(IPlayer player) { this.Id = player.Id; this.Name = player.Name; this.PlayerType = player.PlayerType; this.PlayerColour = player.PlayerColour; }
public void ColourizeMesh(PlayerColour playerColourIn) { switch (playerColourIn) { case PlayerColour.Red: m_CurrentMaterial = m_Red; break; case PlayerColour.Blue: m_CurrentMaterial = m_Blue; break; case PlayerColour.Green: m_CurrentMaterial = m_Green; break; case PlayerColour.Yellow: m_CurrentMaterial = m_Yellow; break; case PlayerColour.Default: break; default: break; } for (int i = 0; i < m_Meshes.Count; i++) { m_Meshes[i].GetComponent <SkinnedMeshRenderer>().material = new Material(m_CurrentMaterial); } }
public void ColourizeMesh(PlayerColour playerColourIn) { switch (playerColourIn) { case PlayerColour.Red: m_CurrentMaterial = m_Red; break; case PlayerColour.Blue: m_CurrentMaterial = m_Blue; break; case PlayerColour.Green: m_CurrentMaterial = m_Green; break; case PlayerColour.Yellow: m_CurrentMaterial = m_Yellow; break; case PlayerColour.Default: break; default: break; } for (int i = 0; i < m_Meshes.Count; i++) { m_Meshes[i].GetComponent<SkinnedMeshRenderer>().material = new Material(m_CurrentMaterial); } }
public PlayerService InitPlayers(PlayerColour currentPlayerColor, BoardService boardService, out int currentPlayerId, out int opponentPlayerId) { PlayerService playerService = new PlayerService(boardService); PlayerColour opponentPlayerColor = colorParser.StringsToPlayerColours .Where(obj => obj.Value != currentPlayerColor) .Select(obj => obj.Value).FirstOrDefault(); List <PlayerCreateDTO> playerCreates = new List <PlayerCreateDTO>() { new PlayerCreateDTO() { Name = "Current Player", PlayerColour = currentPlayerColor, PlayerType = PlayerType.PC }, new PlayerCreateDTO() { Name = "Opponent Player", PlayerColour = opponentPlayerColor, PlayerType = PlayerType.Human } }; playerService.InitPlayers(playerCreates); currentPlayerId = playerService.Players .Where(player => player.PlayerType == PlayerType.PC) .Select(player => player.Id).FirstOrDefault(); opponentPlayerId = playerService.Players .Where(player => player.PlayerType == PlayerType.Human) .Select(player => player.Id).FirstOrDefault(); return(playerService); }
public List <Move> GetPossibleMoves(PlayerColour playersTurn) { var pieceMoveMap = new Dictionary <string, List <Move> >(); var foundMandatoryMove = false; for (var row = 0; row < BoardHeight; row++) { for (var col = 0; col < BoardWidth; col++) { var moves = GetMovesForPosition(playersTurn, row, col); if (moves == null) { continue; } if (moves[0].IsMandatory) { if (!foundMandatoryMove) { pieceMoveMap = new Dictionary <string, List <Move> >(); } foundMandatoryMove = true; pieceMoveMap.Add(row + "-" + col, moves); continue; } if (!foundMandatoryMove) { pieceMoveMap.Add(row + "-" + col, moves); } } } //Convert the nice dictionary of per-piece moves into a linear collection. return(pieceMoveMap.SelectMany(kvp => kvp.Value).ToList()); }
public IPlayer GetPlayer(PlayerColour playerColour) { if (!Players.ContainsKey(playerColour)) { return new PlayerOpening(); } return Players[playerColour]; }
/// <summary> /// Initializes a player with the given colour and name /// </summary> /// <param name="colour">The colour associated with the player</param> /// <param name="name">The name of the player</param> public Player(PlayerColour colour, string name) { this.name = name; this.colour = colour; this.graphs = new List <Graph>(); this.units = new HashSet <Unit>(); }
public void SetPlayerColour(PlayerColour playerColour) { var player = _photonClient.CurrentRoom.Player; player.Colour = playerColour.Colour; player.Glyph = playerColour.Glyph; SendPlayerUpdate(player); }
/// <summary> /// Initializes a player with the given colour and name /// </summary> /// <param name="colour">The colour associated with the player</param> /// <param name="name">The name of the player</param> public Player(PlayerColour colour, string name) { this.name = name; this.colour = colour; this.graphs = new List<Graph>(); this.units = new HashSet<Unit>(); }
internal DummySession SetupAddPlayer(String userId, PlayerColour colour) { Players.Add(new DummyNationData(userId) { Colour = colour }); return(this); }
private static IPlayer CreatePlayer(string playerName, PlayerColour playerColour) { if (playerColour == PlayerColour.Black) { return new PlayerBlack(playerName) ; } return new PlayerWhite(playerName); }
public Piece(PlayerColour colour, Cell parentCell, Board gameBoard) { this.ID = counter++; this.Colour = colour; this.ParentCell = parentCell; this.gameBoard = gameBoard; this.AtStartPosition = true; this.VulnerableCheck = false; }
// ATTENTION - if both players "hasWon" - it is a draw. That is also THE ONLY way to write "draw". public Player(PlayerType _type, PlayerColour _colour) { Type = _type; Colour = _colour; PlayerUnits = new List <UnitScript>(); PlayerScore = 0; HasWon = false; Race = Faction.Human; }
public Node(BoardGame game, INode parent, Move move, PlayerColour colour) { this.parent = parent; this.game = game; this.previousMove = move; this.colour = colour; children = new List <INode>(); timesVisited = 0; }
public void Initialize(PlayerColour colour, Size size, Padding padding) { Player = colour; DisplayStyle = ToolStripItemDisplayStyle.None; BackColor = colour.ToSystemInactiveColor(); Size = size; Margin = padding; Visible = false; }
private void AddPlayerTool(PlayerColour colour) { var toolStripButton = new PlayerToolButton(); toolStripButton.Initialize(colour, toolSize, playerToolPadding); toolStripButton.Click += (s, e) => SelectPlayer(colour); playerTools.Add(toolStripButton); Items.Add(toolStripButton); }
private List <Move> GetMovesForPosition(PlayerColour playersTurn, int row, int col) { //If it isn't your turn, move on to the next square if (!IsPlayersPiece(playersTurn, row, col)) { return(null); } var directions = TryGetPossibleMoveDirections(row, col); if (directions == null) { return(null); } var moves = new List <Move>(); var foundMandatoryMove = false; foreach (var dir in directions) { var possibleMove = new Move(row, col, row + dir.Item1, col + dir.Item2); //Don't use out of bound moves, or moves that would stack a players pieces on top of each other if (possibleMove.IsTargetOutOfBounds(BoardHeight, BoardWidth) || IsPlayersPiece(playersTurn, possibleMove.ToRow, possibleMove.ToCol)) { continue; } //Check if a normal non-capturing move is allowed if (Board[possibleMove.ToRow, possibleMove.ToCol] == SquareType.Empty) { if (!foundMandatoryMove) { moves.Add(possibleMove); } continue; } //once here you must be looking at an enemy, so handle it possibleMove = possibleMove.AdvanceInDirection(dir.Item1, dir.Item2); if (!possibleMove.IsTargetOutOfBounds(BoardHeight, BoardWidth) && Board[possibleMove.ToRow, possibleMove.ToCol] == SquareType.Empty) { //reset the moves in case they contained non-optional moves if (!foundMandatoryMove) { moves = new List <Move>(); } moves.Add(possibleMove); foundMandatoryMove = true; } //if(Board[possibleMove.ToRow, possibleMove.ToCol] == SquareType.Empty) continue; } return(moves.Count > 0 ? moves : null); }
internal DummySession SetupDummySession(Guid sessionId, String ownerId, PlayerColour colour) { DummySession session = new DummySession { GameId = sessionId, OwnerId = ownerId }; session.SetupAddPlayer(ownerId, colour); SessionMap[sessionId] = session; return(session); }
public bool TryMakeMove(PlayerColour player, Move move) { if (!GetPossibleMoves(player).Contains(move)) { return(false); } makeMove(move); return(true); }
public override void FilterMovementMap(Position initialPosition, PlayerColour colour, HashSet<Position> map) { int direction = colour == PlayerColour.Black ? 1 : -1; foreach (Position position in map) { int yDirection = direction * (position.Y - initialPosition.Y); if (yDirection < 1 && initialPosition.GetDistance(position) > 1) map.Remove(position); } }
public JoinGameResult Join(PlayerColour playerColour, IPlayer player) { if (Players.ContainsKey(playerColour)) { return new JoinGameResult(wasSuccess:false); } Players.Add(playerColour, player); return new JoinGameResult(wasSuccess:true); }
public Player(int _index, PlayerColour _colour, string _playerName, Faction _race, PlayerType _type, PlayerTeam _team) { index = _index; colour = _colour; playerName = _playerName; race = _race; type = _type; team = _team; playerScore = 0; playerUnits = new List <Unit>(); }
public async Task <Guid> CreateSession(String userId, PlayerColour colour) { Guid newId = Guid.NewGuid(); SessionMap[newId] = new DummySession { GameId = newId, OwnerId = userId }; await JoinSession(newId, userId, colour); return(newId); }
public static PlayerColour GetUnusedGlyph(this IEnumerable <ITAlertPlayer> players) { var glyph = PlayerColour.Glyphs.Except(players.Select(p => p.Glyph)).First(); var glyphIndex = PlayerColour.Glyphs.ToList().IndexOf(glyph); var playerColour = new PlayerColour { Glyph = glyph, Colour = ConvertIntToHexColor(glyphIndex) }; return(playerColour); }
public void SelectPlayer(PlayerColour colour) { var newPlayerTool = playerTools.Where(x => x.Player == colour).First(); if (selectedPlayerTool != null) { selectedPlayerTool.Select(false); } newPlayerTool.Select(true); selectedPlayerTool = newPlayerTool; PlayerSelected?.Invoke(this, new PlayerSelectedEventArgs(colour)); }
public override void OnMouseClick(MouseButtonEventArgs args) { if (args.Button == Mouse.Button.Left) { Colour = Colour.Next(); } else { Colour = Colour.Prev(); } base.OnMouseClick(args); }
public List <INode> process(BoardGame game, PlayerColour colour) { DateTime startTime = DateTime.UtcNow; TimeSpan duration = TimeSpan.FromSeconds(2); INode root = nodeService.createNode(game.Clone() as BoardGame, colour); root.expand(); for (int i = 0; i < 3000; i++) { expansion(traverse(root)); } return(root.getChildren()); }
public static void Clear() { isAHeroDead = false; Player one = Player.Players[0]; Player two = Player.Players[1]; PlayerType type = one.Type; PlayerColour colour = one.Colour; Player.Players[0] = new Player(type, colour); type = two.Type; colour = two.Colour; Player.Players[1] = new Player(type, colour); }
public void OwnerWillNotBeSame() { TicTacToe game = new TicTacToe(null); game.board = new List <List <BoardGame> >(); game.boardFilter = new Point2D(); PlayerColour colour = (PlayerColour)1000; game.owner = colour; TicTacToe result = game.Clone() as TicTacToe; Assert.AreNotSame(colour, result.owner); }
public override void FilterMovementMap(Position initialPosition, PlayerColour colour, HashSet<Position> map) { foreach (Position position in map) { int axesUsed = 0; if (position.X != initialPosition.X) axesUsed++; if (position.Y != initialPosition.Y) axesUsed++; if (position.Z != initialPosition.Z) axesUsed++; if (axesUsed!= 2) map.Remove(position); } }
void Update() { if (lastProgress != progress) { this.imageRenderer.fillAmount = this.progress; lastProgress = this.progress; } if (lastColour != color) { if (color == PlayerColour.Red) this.imageRenderer.sprite = RedFill; else if (color == PlayerColour.Yellow) this.imageRenderer.sprite = YellowFill; else if (color == PlayerColour.Green) this.imageRenderer.sprite = GreenFill; else this.imageRenderer.sprite = BlueFill; lastColour = this.color; } if (lastTimeLeft != timeLeft) { this.timeLeftLabel.text = this.timeLeft + "s"; lastTimeLeft = timeLeft; } }
public virtual void FilterMovementMap(Position initialPosition, PlayerColour colour, HashSet<Position> map) { }
public JoinGameAppCommand(string gameName, string playerName, PlayerColour playerColour) { _gameName = gameName; _playerName = playerName; _playerColour = playerColour; }
private Material getStandMaterial(PlayerColour color) { switch (color) { case PlayerColour.Red: return RedStandMaterial; case PlayerColour.Green: return GreenStandMaterial; case PlayerColour.Yellow: return YellowStandMaterial; default: return BlueStandMaterial; } }
public GameOutcome(GameOutcomeType outcome, PlayerColour? winner) { Outcome = outcome; Winner = winner; }
public void OnColourTakenCannotJoinGameError(PlayerColour playerColour, Game game) { NumberOfColourTakenCannotJoinGameErrors++; }
public Player(PlayerColour colour) { Colour = colour; Pieces = new List<Piece>(); Captures = new List<PieceType>(); }
public void OnColourTakenCannotJoinGameError(PlayerColour playerColour, Game game) { }
public Knight(PlayerColour colour) { Colour = colour; }
public override void FilterMovementMap(Position initialPosition, PlayerColour colour, HashSet<Position> map) { foreach (Position position in map) { if (initialPosition.GetDistance(position) == 2) map.Remove(position); } }
public Bishop(PlayerColour colour) { Colour = colour; }
public void OnColourTakenCannotJoinGameError(PlayerColour playerColour, Game game) { throw new NotImplementedException(); }
public King(PlayerColour colour) { Colour = colour; }
public NewTurn(PlayerColour activePlayer) { ActivePlayer = activePlayer; }