コード例 #1
0
        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
            };
        }
コード例 #2
0
 private void SetShapeColour(PlayerColour colour)
 {
     if (Shape != null)
     {
         Shape.FillColor = colour.ToRGB();
     }
 }
コード例 #3
0
ファイル: Player.cs プロジェクト: Rofflarn/Wall_Street
        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);
        }
コード例 #4
0
ファイル: PlayerHuman.cs プロジェクト: FominVlad/GameDev
 public PlayerHuman(PlayerCreateDTO playerCreateDTO, int playerId)
 {
     this.Id           = playerId;
     this.Name         = playerCreateDTO.Name;
     this.PlayerColour = playerCreateDTO.PlayerColour;
     this.PlayerType   = PlayerType.Human;
 }
コード例 #5
0
    // 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;
         */
    }
コード例 #6
0
        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);
                }
            }
        }
コード例 #7
0
    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);
        }
    }
コード例 #8
0
 public PlayerGetDTO(IPlayer player)
 {
     this.Id           = player.Id;
     this.Name         = player.Name;
     this.PlayerType   = player.PlayerType;
     this.PlayerColour = player.PlayerColour;
 }
コード例 #9
0
    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);
        }
    }
コード例 #10
0
ファイル: MeshColour.cs プロジェクト: BenDy557/TheFall
    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);
        }

    }
コード例 #11
0
ファイル: Initializer.cs プロジェクト: FominVlad/GameDev
        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);
        }
コード例 #12
0
        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());
        }
コード例 #13
0
ファイル: Game.cs プロジェクト: joeywinsford/Chess
 public IPlayer GetPlayer(PlayerColour playerColour)
 {
     if (!Players.ContainsKey(playerColour))
     {
         return new PlayerOpening();
     }
     return Players[playerColour];
 }
コード例 #14
0
        /// <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>();
        }
コード例 #15
0
        public void SetPlayerColour(PlayerColour playerColour)
        {
            var player = _photonClient.CurrentRoom.Player;

            player.Colour = playerColour.Colour;
            player.Glyph  = playerColour.Glyph;
            SendPlayerUpdate(player);
        }
コード例 #16
0
        /// <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>();
        }
コード例 #17
0
 internal DummySession SetupAddPlayer(String userId, PlayerColour colour)
 {
     Players.Add(new DummyNationData(userId)
     {
         Colour = colour
     });
     return(this);
 }
コード例 #18
0
 private static IPlayer CreatePlayer(string playerName, PlayerColour playerColour)
 {
     if (playerColour == PlayerColour.Black)
     {
         return new PlayerBlack(playerName) ;
     }
     return new PlayerWhite(playerName);
 }
コード例 #19
0
 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;
 }
コード例 #20
0
    // 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;
    }
コード例 #21
0
 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;
 }
コード例 #22
0
 public void Initialize(PlayerColour colour, Size size, Padding padding)
 {
     Player       = colour;
     DisplayStyle = ToolStripItemDisplayStyle.None;
     BackColor    = colour.ToSystemInactiveColor();
     Size         = size;
     Margin       = padding;
     Visible      = false;
 }
コード例 #23
0
        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);
        }
コード例 #24
0
        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);
        }
コード例 #25
0
        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);
        }
コード例 #26
0
        public bool TryMakeMove(PlayerColour player, Move move)
        {
            if (!GetPossibleMoves(player).Contains(move))
            {
                return(false);
            }

            makeMove(move);
            return(true);
        }
コード例 #27
0
ファイル: PieceType.cs プロジェクト: epicvrvs/Shashkrid
 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);
     }
 }
コード例 #28
0
ファイル: Game.cs プロジェクト: joeywinsford/Chess
        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);
        }
コード例 #29
0
 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>();
 }
コード例 #30
0
        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);
        }
コード例 #31
0
ファイル: PlayerExtensions.cs プロジェクト: playgen/it-alert
        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);
        }
コード例 #32
0
        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));
        }
コード例 #33
0
        public override void OnMouseClick(MouseButtonEventArgs args)
        {
            if (args.Button == Mouse.Button.Left)
            {
                Colour = Colour.Next();
            }
            else
            {
                Colour = Colour.Prev();
            }

            base.OnMouseClick(args);
        }
コード例 #34
0
        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());
        }
コード例 #35
0
    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);
    }
コード例 #36
0
        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);
        }
コード例 #37
0
ファイル: PieceType.cs プロジェクト: epicvrvs/Shashkrid
 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);
     }
 }
コード例 #38
0
    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;
        }
    }
コード例 #39
0
ファイル: PieceType.cs プロジェクト: epicvrvs/Shashkrid
 public virtual void FilterMovementMap(Position initialPosition, PlayerColour colour, HashSet<Position> map)
 {
 }
コード例 #40
0
 public JoinGameAppCommand(string gameName, string playerName, PlayerColour playerColour)
 {
     _gameName = gameName;
     _playerName = playerName;
     _playerColour = playerColour;
 }
コード例 #41
0
 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;
     }
 }
コード例 #42
0
ファイル: Message.cs プロジェクト: epicvrvs/Shashkrid
 public GameOutcome(GameOutcomeType outcome, PlayerColour? winner)
 {
     Outcome = outcome;
     Winner = winner;
 }
コード例 #43
0
ファイル: TestOutput.cs プロジェクト: joeywinsford/Chess
 public void OnColourTakenCannotJoinGameError(PlayerColour playerColour, Game game)
 {
     NumberOfColourTakenCannotJoinGameErrors++;
 }
コード例 #44
0
ファイル: Player.cs プロジェクト: epicvrvs/Shashkrid
 public Player(PlayerColour colour)
 {
     Colour = colour;
     Pieces = new List<Piece>();
     Captures = new List<PieceType>();
 }
コード例 #45
0
ファイル: GameModule.cs プロジェクト: joeywinsford/Chess
 public void OnColourTakenCannotJoinGameError(PlayerColour playerColour, Game game)
 {
 }
コード例 #46
0
ファイル: Knight.cs プロジェクト: joeywinsford/Chess
 public Knight(PlayerColour colour)
 {
     Colour = colour;
 }
コード例 #47
0
ファイル: PieceType.cs プロジェクト: epicvrvs/Shashkrid
 public override void FilterMovementMap(Position initialPosition, PlayerColour colour, HashSet<Position> map)
 {
     foreach (Position position in map)
     {
         if (initialPosition.GetDistance(position) == 2)
             map.Remove(position);
     }
 }
コード例 #48
0
ファイル: Bishop.cs プロジェクト: joeywinsford/Chess
 public Bishop(PlayerColour colour)
 {
     Colour = colour;
 }
コード例 #49
0
 public void OnColourTakenCannotJoinGameError(PlayerColour playerColour, Game game)
 {
     throw new NotImplementedException();
 }
コード例 #50
0
ファイル: King.cs プロジェクト: joeywinsford/Chess
 public King(PlayerColour colour)
 {
     Colour = colour;
 }
コード例 #51
0
ファイル: Message.cs プロジェクト: epicvrvs/Shashkrid
 public NewTurn(PlayerColour activePlayer)
 {
     ActivePlayer = activePlayer;
 }