コード例 #1
0
ファイル: XYPoint.cs プロジェクト: Brondahl/MDMUtils
 public IEnumerable <XYPoint> GetAllAdjacentPoints(
     eDirection startingDirection    = eDirection.North,
     eDirectionChange deltaDirection = eDirectionChange.Clockwise)
 {
     // ReSharper disable once RedundantArgumentDefaultValue
     return(GetAdjacentPoints(startingDirection, deltaDirection, eAdjacencyType.All));
 }
コード例 #2
0
 /// <summary>
 /// 레버가 이동명령을할 때, 이동 가능한지를 먼저 체크해줍니다.
 /// </summary>
 /// <returns></returns>
 public bool TryCanMove(eDirection direction)
 {
     if (liftMoveType == eLiftMoveType.UPNDOWN)
     {
         if (direction == eDirection.UP || direction == eDirection.DOWN)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         if (direction == eDirection.LEFT || direction == eDirection.RIGHT)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
コード例 #3
0
        public static bool GetNextNodeInRoute(ref int io_Line, ref int io_Column, eDirection i_CurrentDirection, int i_MatrixSize)
        {
            int  original_i    = io_Line;
            int  original_j    = io_Column;
            bool isOutOfMatrix = true;

            if ((i_CurrentDirection == eDirection.Up) || (i_CurrentDirection == eDirection.UpLeft) || (i_CurrentDirection == eDirection.UpRight))
            {
                io_Line--;
            }
            if ((i_CurrentDirection == eDirection.Down) || (i_CurrentDirection == eDirection.DownLeft) || (i_CurrentDirection == eDirection.DownRight))
            {
                io_Line++;
            }
            if ((i_CurrentDirection == eDirection.Right) || (i_CurrentDirection == eDirection.UpRight) || (i_CurrentDirection == eDirection.DownRight))
            {
                io_Column++;
            }
            if ((i_CurrentDirection == eDirection.Left) || (i_CurrentDirection == eDirection.DownLeft) || (i_CurrentDirection == eDirection.UpLeft))
            {
                io_Column--;
            }
            if ((io_Line < i_MatrixSize && io_Line >= 0) && (io_Column < i_MatrixSize && io_Column >= 0))
            {
                isOutOfMatrix = false;
            }
            else
            {
                io_Line   = original_i;
                io_Column = original_j;
            }
            return(!isOutOfMatrix);
        }
コード例 #4
0
        public static float GetAngleForDirection(eDirection direction)
        {
            float angle = 0;

            switch (direction)
            {
            case eDirection.right:
                angle = 0.0f;
                break;

            case eDirection.up:
                angle = 270.0f;
                break;

            case eDirection.left:
                angle = 180.0f;
                break;

            case eDirection.down:
            case eDirection.none:
                angle = 90.0f;
                break;
            }

            return(angle);
        }
コード例 #5
0
ファイル: Piece.cs プロジェクト: Orbitton276/CheckersGame
        private bool checkIfJumpIsPossible(eDirection i_JumpDirection, Point i_OpponentPieceLocation, Board i_GameBoard)
        {
            Point locationAfterJumpOver = i_OpponentPieceLocation;

            locationAfterJumpOver.ShiftPoint(i_JumpDirection);
            bool      jumpIsPossible;
            string    opponentBoardSlot;
            BoardSlot destinationBoardSlot;

            if (!destinationInBorders(locationAfterJumpOver, i_GameBoard))
            {
                jumpIsPossible = false;
            }
            else
            {
                opponentBoardSlot    = i_OpponentPieceLocation.GetColCoord + i_OpponentPieceLocation.GetRowCoord;
                destinationBoardSlot = i_GameBoard.GetBoardSlotFromIdentifierString(opponentBoardSlot);
                if (destinationBoardSlot.DoesContainsPiece())
                {
                    jumpIsPossible = false;
                }
                else
                {
                    jumpIsPossible = true;
                }
            }

            return(jumpIsPossible);
        }
コード例 #6
0
        private void TestIt(Room room, eDirection directionTestingFrom)
        {
            if (!room.Connected)
            {
                room.Connected = true;
                if (room.North && directionTestingFrom != eDirection.South)
                {
                    TestIt(this.Rooms[new Point(room.Position.X, room.Position.Y - 1)], eDirection.North);
                }

                if (room.South && directionTestingFrom != eDirection.North)
                {
                    TestIt(this.Rooms[new Point(room.Position.X, room.Position.Y + 1)], eDirection.South);
                }

                if (room.East && directionTestingFrom != eDirection.West)
                {
                    TestIt(this.Rooms[new Point(room.Position.X + 1, room.Position.Y)], eDirection.East);
                }

                if (room.West && directionTestingFrom != eDirection.East)
                {
                    TestIt(this.Rooms[new Point(room.Position.X - 1, room.Position.Y)], eDirection.West);
                }
            }
        }
コード例 #7
0
ファイル: PossibleMove.cs プロジェクト: liornaar/mta-othello
 public PossibleMove(int i_X, int i_Y, eDirection i_Direction)
 {
     m_X = i_X;
     m_Y = i_Y;
     m_Direction = eDirection.None;
     m_Direction = i_Direction;
 }
コード例 #8
0
ファイル: MovementTests.cs プロジェクト: Brondahl/MDMUtils
        public void CanUseDirectionsToConstructMovements(eDirection direction, int multiplier, int endX, int endY)
        {
            var expectedMove = new Movement(endX, endY);
            var actualMove   = new Movement(direction, multiplier);

            Assert.AreEqual(expectedMove, actualMove);
        }
コード例 #9
0
    public void PlayAnim(eDirection ePlayDir, GameObject pTargetObject, AnimationClip pClip, Action pEndCallback)
    {
        if (null == pTargetObject)
        {
            pTargetObject = gameObject;
        }

        if (null == pClip)
        {
            if (null != pEndCallback)
            {
                pEndCallback();
            }
            return;
        }

        if (false == pTargetObject.activeInHierarchy)
        {
            if (null != pEndCallback)
            {
                pEndCallback();
            }
            return;
        }

        var pAnim = GetAnimation(pTargetObject);

        if (null == pAnim.GetClip(pClip.name))
        {
            pAnim.AddClip(pClip, pClip.name);
        }

        if (1.0f == Time.timeScale)
        {
            var pState = pAnim[pClip.name];
            pState.normalizedTime = (eDirection.Front == ePlayDir) ? 0.0f :  1.0f;
            pState.speed          = (eDirection.Front == ePlayDir) ? 1.0f : -1.0f;

            pAnim.Stop();
            pAnim.Play(pClip.name);

            if (WrapMode.Loop != pState.wrapMode)
            {
                StartCoroutine(CoroutinePlayAnim_WaitTime(pState.length, pEndCallback));
            }
        }
        else
        {
            switch (ePlayDir)
            {
            case eDirection.Front:
                StartCoroutine(CoroutinePlayAnim_UnScaledForward(pTargetObject, pAnim[pClip.name], pEndCallback));
                break;

            case eDirection.Back:
                StartCoroutine(CoroutinePlayAnim_UnScaledBackward(pTargetObject, pAnim[pClip.name], pEndCallback));
                break;
            }
        }
    }
コード例 #10
0
    private void Fire(eDirection dir)
    {
        GameObject gObj = Instantiate(fireBall, projectileSpawnPos.position, Quaternion.identity);
        FireBall   fb   = gObj.GetComponent <FireBall>();

        fb.direction = dir;
    }
コード例 #11
0
ファイル: IdleState.cs プロジェクト: AntarticPenguin/ProjectF
    string GetTriggerName(eDirection lookAt)
    {
        string trigger = "";

        switch (lookAt)
        {
        case eDirection.NORTH_EAST:
            trigger = "NORTH_EAST";
            break;

        case eDirection.NORTH_WEST:
            trigger = "NORTH_WEST";
            break;

        case eDirection.SOUTH_EAST:
            trigger = "SOUTH_EAST";
            break;

        case eDirection.SOUTH_WEST:
            trigger = "SOUTH_WEST";
            break;

        default:
            trigger = "NORTH_EAST";
            break;
        }
        return(trigger);
    }
コード例 #12
0
        public static bool MatchesDirection(FieldInfo fieldInfo, eDirection direction)
        {
            var attributes = fieldInfo.GetCustomAttributes<DirectionAttribute>();

              return attributes != null &&
             attributes.Any(attr => attr.Direction == direction);
        }
コード例 #13
0
        /// <summary>
        /// 扫描圆弧获取圆弧的角度
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="direction"></param>
        /// <returns></returns>
        double GetSweep(double start, double end, eDirection direction)
        {
            double sweep = 360;

            if (start == end)
            {
                return(sweep);
            }
            if (direction == eDirection.kCCW)
            {
                if (end >= start)
                {
                    sweep = end - start;
                }
                else
                {
                    sweep = 360 - (start - end);
                }
            }
            if (direction == eDirection.kCW)
            {
                if (end >= start)
                {
                    sweep = -(360 - (end - start));
                }
                else
                {
                    sweep = -(start - end);
                }
            }
            return(sweep);
        }
コード例 #14
0
        public Square GetSquareInDirection(Square i_FromSquare, eDirection i_PlayerDirection)
        {
            int offsetCol = 1;
            int offsetRow = -1;
            int addition  = 1;

            if (i_PlayerDirection == eDirection.BottomLeft || i_PlayerDirection == eDirection.BottomRight)
            {
                addition = -1;
            }

            if (i_PlayerDirection == eDirection.TopLeft || i_PlayerDirection == eDirection.BottomLeft)
            {
                offsetCol = -1;
                offsetRow = -1;
            }

            Square resSquare = new Square(i_FromSquare.Row + (offsetRow * addition), i_FromSquare.Col + offsetCol);

            if (this.GetSquareStatus(resSquare) != Square.eSquareType.invalid)
            {
                return(resSquare);
            }
            else
            {
                return(null);
            }
        }
コード例 #15
0
ファイル: PossibleMove.cs プロジェクト: liornaar/mta-othello
        // this method adds another direction to the possible move
        public eDirection addDirection(ref eDirection i_Direction)
        {
            eDirection newDirection = new eDirection();

            newDirection = m_Direction | i_Direction;
            return newDirection;
        }
コード例 #16
0
ファイル: Matrix.cs プロジェクト: Nono02P/TankArmageddon
        /// <summary>
        /// Effectue une symétrie sur la matrice.
        /// </summary>
        /// <param name="direction">Sens de la symétrie à appliquer.</param>
        public void Reflection(eDirection direction)
        {
            float[] newData = new float[Rows * Columns];
            switch (direction)
            {
            case eDirection.Vertical:
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Columns; j++)
                    {
                        newData[i * Columns + Columns - j - 1] = Data[i * Columns + j];
                    }
                }
                Data = newData;
                break;

            case eDirection.Horizontal:
                for (int i = 0; i < Rows; i++)
                {
                    for (int j = 0; j < Columns; j++)
                    {
                        newData[(Rows - i - 1) * Columns + j] = Data[i * Columns + j];
                    }
                }
                Data = newData;
                break;

            default:
                throw new Exception("This case of reflection isn't supported.");
            }
        }
コード例 #17
0
ファイル: Board.cs プロジェクト: def-au1t/BIT_statki_WPF
 private void SurroundShip(int x, int y, eDirection dir, int len)   //otoczenie statku nieaktywnymi polami po zatopieniu
 {
     if (dir == eDirection.Horizontal)
     {
         for (int i = x - 1; i <= x + 1; i++)
         {
             for (int j = y - 1; j <= y + len; j++)
             {
                 if (i >= 0 && i < this.size && j >= 0 && j < this.size)
                 {
                     if (this.field[i, j].Status == eFieldStatus.Empty)
                     {
                         this.field[i, j].Status = eFieldStatus.Empty_Missed;
                     }
                 }
             }
         }
     }
     else
     {
         for (int i = x - 1; i <= x + len; i++)
         {
             for (int j = y - 1; j <= y + 1; j++)
             {
                 if (i >= 0 && i < this.size && j >= 0 && j < this.size)
                 {
                     if (this.field[i, j].Status == eFieldStatus.Empty)
                     {
                         this.field[i, j].Status = eFieldStatus.Empty_Missed;
                     }
                 }
             }
         }
     }
 }
コード例 #18
0
    private void randomDirection(bool leftBool, bool rightBool, bool upBool, bool downBool)
    {
        int randomDirectionNumber = -1;

        while (randomDirectionNumber == -1)
        {
            randomDirectionNumber = Random.Range(0, 4);
            if (!leftBool && randomDirectionNumber == 0)
            {
                randomDirectionNumber = -1;
            }
            if (!rightBool && randomDirectionNumber == 1)
            {
                randomDirectionNumber = -1;
            }
            if (!upBool && randomDirectionNumber == 2)
            {
                randomDirectionNumber = -1;
            }
            if (!downBool && randomDirectionNumber == 3)
            {
                randomDirectionNumber = -1;
            }
        }
        switch (randomDirectionNumber)
        {
        case 0: direction = eDirection.left; break;

        case 1: direction = eDirection.right; break;

        case 2: direction = eDirection.up; break;

        case 3: direction = eDirection.down; break;
        }
    }
コード例 #19
0
        internal Room RoomAt(DungeonLocation currentLocation, eDirection direction)
        {
            switch (direction)
            {
            case eDirection.North:
                return(this.Levels[currentLocation.Level].Rooms[new Point(currentLocation.X, currentLocation.Y - 1)]);

            case eDirection.South:
                return(this.Levels[currentLocation.Level].Rooms[new Point(currentLocation.X, currentLocation.Y + 1)]);

            case eDirection.East:
                return(this.Levels[currentLocation.Level].Rooms[new Point(currentLocation.X + 1, currentLocation.Y)]);

            case eDirection.West:
                return(this.Levels[currentLocation.Level].Rooms[new Point(currentLocation.X - 1, currentLocation.Y)]);

            case eDirection.Up:
                return(this.Levels[currentLocation.Level - 1].Rooms[new Point(currentLocation.X, currentLocation.Y)]);

            case eDirection.Down:
                return(this.Levels[currentLocation.Level + 1].Rooms[new Point(currentLocation.X, currentLocation.Y)]);

            default:
                return(this.Levels[currentLocation.Level].Rooms[currentLocation.Point]);
            }
        }
コード例 #20
0
 public static void CheckEightDirectionForMove(List <NodeForGame> io_OptionForMoveList, Player i_PlayerinMove, NodeForGame i_CurrentNodeToCheck, bool i_IsCheckOnly)
 {
     for (eDirection i = eDirection.Up; i <= eDirection.UpLeft; i++)
     {
         CheckCourseOfMove(i, i_PlayerinMove, i_CurrentNodeToCheck, io_OptionForMoveList, i_IsCheckOnly);
     }
 }
コード例 #21
0
ファイル: USBRXDevice.cs プロジェクト: g3gg0/rx-fft
        private void AddAccess(eDirection dir, int device, int length, byte[] data)
        {
            if (Counter == null)
            {
                Counter = new HighPerformanceCounter("I²C Debug");
                Counter.Start();
            }
            if (I2CAccesses == null)
            {
                I2CAccesses = new LinkedList <I2CDataEntry>();
            }

            lock (I2CAccesses)
            {
                I2CDataEntry entry = new I2CDataEntry();
                entry.Direction = dir;
                entry.Device    = device;
                entry.Length    = length;
                entry.Data      = data;

                Counter.Stop();
                entry.Timestamp = Counter.Duration;
                Counter.Start();

                I2CAccesses.AddLast(entry);
            }
        }
コード例 #22
0
        // this method adds another direction to the possible move
        public eDirection addDirection(ref eDirection i_Direction)
        {
            eDirection newDirection = new eDirection();

            newDirection = m_Direction | i_Direction;
            return(newDirection);
        }
コード例 #23
0
        /// <summary>
        /// Trigger a Page Show animation
        /// </summary>
        /// <param name="page"></param>
        /// <param name="direction"></param>
        /// <param name="initial"></param>
        protected void PageEnterAnimation(Page page, eDirection direction, bool initial = false)
        {
            if (!Application.isPlaying || AnimationType == eAnimationType.None || initial)
            {
                page.gameObject.SetActive(true);
            }
            else
            {
                var animationType = page.UsePageAnimationType ? page.AnimationType : AnimationType;
                switch (animationType)
                {
                case eAnimationType.Fade:
                {
                    //StartCoroutine(DelayedCall(0.5f, () => page.FadeIn()));
                    page.FadeIn();
                }
                break;

                case eAnimationType.SlideHorizontal:
                case eAnimationType.SlideVertical:
                {
                    if (page.FlipAnimationDirection)
                    {
                        direction = (direction == eDirection.Left) ? eDirection.Right : eDirection.Left;
                    }

                    page.SlideIn(direction, animationType == eAnimationType.SlideVertical);
                }
                break;
                }
            }
        }
コード例 #24
0
ファイル: MovementTests.cs プロジェクト: Brondahl/MDMUtils
        public void CanCastDirectionstoMovements(eDirection direction, int moveX, int moveY)
        {
            var expectedMove = new Movement(moveX, moveY);
            var actualMove   = (Movement)direction;

            Assert.AreEqual(expectedMove, actualMove);
        }
コード例 #25
0
        /// <summary>
        /// Trigger a Page Exit animation
        /// </summary>
        /// <param name="page"></param>
        /// <param name="direction"></param>
        protected void PageExitAnimation(Page page, eDirection direction)
        {
            if (!Application.isPlaying || AnimationType == eAnimationType.None)
            {
                page.gameObject.SetActive(false);
            }
            else
            {
                var animationType = page.UsePageAnimationType ? page.AnimationType : AnimationType;
                switch (animationType)
                {
                case eAnimationType.Fade:
                {
                    page.FadeOut();
                }
                break;

                case eAnimationType.SlideHorizontal:
                case eAnimationType.SlideVertical:
                {
                    if (page.FlipAnimationDirection)
                    {
                        direction = (direction == eDirection.Left) ? eDirection.Right : eDirection.Left;
                    }

                    page.SlideOut(direction, animationType == eAnimationType.SlideVertical);
                }
                break;
                }
            }
        }
コード例 #26
0
            // ============== ICommand ================

            void ICommand.Exec(IContextWritable context)
            {
                IGhostBWritable ghostB = context.CharactardsContainer.Get <IGhostBWritable>();

                if (_isScared)
                {
                    IPacManWritable pacman = context.CharactardsContainer.Get <IPacManWritable>();

                    ePacmanPosition   pacmanPosition = Direction.getPacmanPosition(pacman.X, pacman.Y, ghostB.X, ghostB.Y);
                    List <eDirection> directions     = Direction.RunFromPacman(pacmanPosition);

                    foreach (eDirection direction in directions)
                    {
                        if (context.Field.IsCanMove(ghostB.X, ghostB.Y, direction))
                        {
                            _direction = direction;
                            break;
                        }
                    }
                }
                else
                {
                    bool isCanMove = context.Field.IsCanMove(ghostB.X, ghostB.Y, _direction);
                    while (!isCanMove)
                    {
                        ChangeDirection();
                        isCanMove = context.Field.IsCanMove(ghostB.X, ghostB.Y, _direction);
                    }
                }

                (int x, int y)nextPositon = Direction.GetNextPosition(ghostB.X, ghostB.Y, _direction);
                ghostB.UpdatePositionB(nextPositon.x, nextPositon.y);
                context.EventManager.Get <IPacManEventsWritable>().UpdateGhostBPosition(nextPositon.x, nextPositon.y);
            }
コード例 #27
0
ファイル: GameEngine.cs プロジェクト: liornaar/mta-othello
        // Get the list of the possible moves in the board for a player
        public List <PossibleMove?> GetPossibleMoves(Player i_Player)
        {
            List <int[]>         playerCells = getPlayerCellsInBoard(i_Player);
            List <eDirection>    listOfDirectionsForPossibleMoves = new List <eDirection>();
            List <PossibleMove?> listOfPossibleMoves = new List <PossibleMove?>();
            bool searchInDirection = false;

            foreach (int[] xyCoord in playerCells)
            {
                // Now we need to check all the directions with opponent sign in them
                foreach (string str in Enum.GetNames(typeof(eDirection)))
                {
                    eDirection direction = (eDirection)System.Enum.Parse(typeof(eDirection), str);
                    searchInDirection = checkCellInDirection(xyCoord[k_XCoord], xyCoord[k_YCoord], (eDirection)direction, i_Player.GetOpponentSign());
                    if (searchInDirection)
                    {
                        listOfDirectionsForPossibleMoves.Add(direction);
                    }
                }

                // For each direction with opponent we need to check if there is a possible move in the direction
                foreach (eDirection direction in listOfDirectionsForPossibleMoves)
                {
                    PossibleMove?newMove = getPossibleCellFromDirection(xyCoord[k_XCoord], xyCoord[k_YCoord], direction, i_Player);
                    addLocationToCell(newMove, ref listOfPossibleMoves);
                }

                // every new position we check we clear the list
                listOfDirectionsForPossibleMoves.Clear();
            }

            m_listOfPossibleMoves = listOfPossibleMoves;
            return(listOfPossibleMoves);
        }
コード例 #28
0
ファイル: ModelPacMan.cs プロジェクト: NnX/PakPak
        void IModelPacMan.UpdateGhostB()
        {
            CreateAndExecuteTurn(
                (ITurn turn) =>
            {
                CmdMoveGhostB cmdMoveGhostB = new CmdMoveGhostB(_eDirectionGhostB_current);
                _eDirectionGhostB_last      = _eDirectionGhostB_current;
                _eDirectionGhostB_current   = cmdMoveGhostB.getDirection(_eDirectionGhostB_current, _context);
                if (_eDirectionGhostB_current == _eDirectionGhostB_last)
                {
                    direction_counter++;
                }
                else
                {
                    direction_counter = 0;
                }
                if (direction_counter == DIRECTION_MAX)     // fix sticking to borders
                {
                    while (_eDirectionGhostB_last == _eDirectionGhostB_current)
                    {
                        cmdMoveGhostB.ChangeDirection();
                        _eDirectionGhostB_current = cmdMoveGhostB.getDirection(_eDirectionGhostB_current, _context);
                    }

                    direction_counter = 0;
                }
                turn.Push(cmdMoveGhostB);
            });
        }
コード例 #29
0
ファイル: GameEngine.cs プロジェクト: liornaar/mta-othello
        private void addLocationToCell(PossibleMove?i_Cell, ref List <PossibleMove?> i_ListOfPossibleMoves)
        {
            bool         cellFound = false;
            PossibleMove?newMove;

            if (i_Cell != null)
            {
                // Checks if the cell is already in the possible move list
                foreach (PossibleMove?move in i_ListOfPossibleMoves)
                {
                    if (move.Value.isEqualToPoisition(i_Cell.Value.X, i_Cell.Value.Y))
                    {
                        eDirection direction = new eDirection();
                        direction  = i_Cell.Value.Direction;
                        direction |= move.Value.Direction;
                        cellFound  = true;
                        newMove    = new PossibleMove(i_Cell.Value.X, i_Cell.Value.Y, direction);
                        i_ListOfPossibleMoves.Remove(move);
                        i_ListOfPossibleMoves.Add(newMove);
                        break;
                    }
                }

                // If the cell is not in the list we add it.
                if (!cellFound)
                {
                    i_ListOfPossibleMoves.Add(i_Cell);
                }
            }
        }
コード例 #30
0
        public static void CheckCourseOfMove(eDirection i_CurrentDirection, Player i_PlayerInMove, NodeForGame i_CurrentNodeToCheck, List <NodeForGame> io_OptionForCoursesList, bool i_IsCheckOnly)
        {
            List <NodeForGame> optionNodesToChange = new List <NodeForGame>(2);
            bool noOppositeSymbolInRoute           = true;
            char opponentSymbol = 'X';

            if (i_PlayerInMove.m_PlayerSymbol == 'X')
            {
                opponentSymbol = 'O';
            }

            int i_Line   = i_CurrentNodeToCheck.LineNumber;
            int j_Column = i_CurrentNodeToCheck.ColumnNumber;

            if (GetNextNodeInRoute(ref i_Line, ref j_Column, i_CurrentDirection, m_MainBoard.BoardSize))
            {
                CheckingForOppositesymbol(m_MainBoard, opponentSymbol, i_IsCheckOnly, ref optionNodesToChange, ref noOppositeSymbolInRoute, i_CurrentDirection, ref i_Line, ref j_Column);
            }

            if (m_MainBoard.BoardMatrix[i_Line, j_Column] == '\0' && (!noOppositeSymbolInRoute) && i_IsCheckOnly)
            {
                NodeForGame newValidOption = new NodeForGame(i_Line, j_Column);
                io_OptionForCoursesList.Add(newValidOption);
            }

            if (m_MainBoard.BoardMatrix[i_Line, j_Column] == i_PlayerInMove.m_PlayerSymbol && (!noOppositeSymbolInRoute) && (!i_IsCheckOnly))
            {
                AddNewSmallListToBigList(io_OptionForCoursesList, optionNodesToChange, io_OptionForCoursesList.Count);
            }
        }
コード例 #31
0
    public void ToggleDirection()
    {
        if (m_direction == eDirection.dirVertical)
        {
            m_direction = eDirection.dirHorizontal;
        }

        if (m_direction == eDirection.dirHorizontal)
        {
            if (m_bAllowDiagonal)
            {
                m_direction = eDirection.dirDiagnoal;
            }
            else
            {
                m_direction = eDirection.dirStationary;
            }
        }

        if (m_direction == eDirection.dirDiagnoal)
        {
            m_direction = eDirection.dirStationary;
        }

        if (m_direction == eDirection.dirStationary)
        {
            m_direction = eDirection.dirVertical;
        }
    }
コード例 #32
0
ファイル: Matrix.cs プロジェクト: Nono02P/TankArmageddon
        /// <summary>
        /// Retourne une nouvelle matrice correspondant au résultat de la réflection (symétrie) de la matrice passée en paramètre.
        /// </summary>
        /// <param name="pMatrix">Matrice contenant les données sur lesquels doivent être fait la symétrie.</param>
        /// <param name="direction">Type de symétrie.</param>
        /// <returns>Matrice résultante de la réflection (symétrie) de la matrice passée en paramètre.</returns>
        public static Matrix Reflection(Matrix pMatrix, eDirection direction)
        {
            Matrix result = pMatrix.Copy();

            result.Reflection(direction);
            return(result);
        }
コード例 #33
0
 public PossibleMove(int i_X, int i_Y, eDirection i_Direction)
 {
     m_X         = i_X;
     m_Y         = i_Y;
     m_Direction = eDirection.None;
     m_Direction = i_Direction;
 }
コード例 #34
0
ファイル: PlatformMover.cs プロジェクト: spmkd/2DGame
    // Use this for initialization
    void Start()
    {
        // TODO: this is test - remove
        m_direction = bVertical ? eDirection.dirVertical : eDirection.dirHorizontal;

        m_startPositionX = transform.position.x;
        m_startPositionY = transform.position.y;
    }
コード例 #35
0
        public void NewLightSection_HasValidLightInRightDirection(eDirection direction)
        {
            var section = sectionBuilder
            .WithLightInDirection(direction, aribitraryColour)
            .Build();

              Assert.AreEqual(aribitraryColour, section.GetComponentSectionInDirection(direction));
        }
コード例 #36
0
ファイル: MonsterFeet.cs プロジェクト: spmkd/2DGame
    public void Kill()
    {
        StopCoroutine (SpeedTweak());

        m_direction = eDirection.dirStationary;
        m_stepX = 0;
        m_stepY = 0;
        m_speedModX = 0;
        m_speedModY = 0;
    }
        private static FieldInfo GetComponentInfoInDirection(this IComponentSection section, eDirection direction)
        {
            if (section == null)
              {
            return null;
              }

              return GetSectionFields(section)
            .SingleOrDefault(field => DirectionAttribute.MatchesDirection(field, direction));
        }
コード例 #38
0
        public RumbleSectionBuilder WithRumbleInDirection(eDirection direction, Rumble rumble)
        {
            if (rumbleSection.GetComponentSectionInDirection(direction) != null)
              {
            throw new ArgumentException("Attempted to add multiple Rumbles in the same direction");
              }

              rumble.Direction = direction;
              rumbleSection.Rumbles.Add(rumble);
              return this;
        }
コード例 #39
0
        public FanSectionBuilder WithFanInDirection(eDirection direction, Fan fan)
        {
            if (fanSection.GetComponentSectionInDirection(direction) != null)
              {
            throw new ArgumentException("Attempted to add multiple fans in the same direction");
              }

              fan.Direction = direction;
              fanSection.Fans.Add(fan);
              return this;
        }
        private static FieldInfo GetPhysicalComponentInfoInDirection(this IComponentSection section, eDirection direction)
        {
            var fieldInDirection = GetComponentInfoInDirection(section, direction);
              if (fieldInDirection == null)
              {
            return null;
              }

              return PhysicalComponentAttribute.IsPhysicalDirection(fieldInDirection)
            ? fieldInDirection
            : null;
        }
コード例 #41
0
        public LightSectionBuilder WithLightInDirection(eDirection direction, Light light)
        {
            if (lightSection.GetComponentSectionInDirection(direction) != null)
              {
            throw new ArgumentException("Attempted to add multiple lights in the same direction");
              }

              if (!LightIsValid(light))
              {
            throw new ArgumentException("Input Light is invalid");
              }

              light.Direction = direction;
              lightSection.Lights.Add(light);
              return this;
        }
コード例 #42
0
        public static DirectionalComponent GetComponentInDirection(this Frame frame, eComponentType componentType, eDirection direction)
        {
            switch (componentType)
              {
            case eComponentType.Light:
              return frame.LightSection.GetComponentSectionInDirection(direction);

            case eComponentType.Fan:
              return frame.FanSection.GetComponentSectionInDirection(direction);

            case eComponentType.Rumble:
              return frame.RumbleSection.GetComponentSectionInDirection(direction);

            default:
              throw new ArgumentException("Unexpected Component Type");
              }
        }
コード例 #43
0
ファイル: PlatformMover.cs プロジェクト: spmkd/2DGame
    public void ToggleDirection()
    {
        if (m_direction == eDirection.dirVertical)
            m_direction = eDirection.dirHorizontal;

        if (m_direction == eDirection.dirHorizontal)
        {
            if (m_bAllowDiagonal)
                m_direction = eDirection.dirDiagnoal;
            else
                m_direction = eDirection.dirStationary;
        }

        if (m_direction == eDirection.dirDiagnoal)
            m_direction = eDirection.dirStationary;

        if (m_direction == eDirection.dirStationary)
            m_direction = eDirection.dirVertical;
    }
コード例 #44
0
 public DirectionAttribute(eDirection direction)
 {
     Direction = direction;
 }
コード例 #45
0
ファイル: MonsterFeet.cs プロジェクト: spmkd/2DGame
    IEnumerator SpeedTweak()
    {
        yield return new WaitForSeconds(m_startCheckInSeconds);

        // TODO: diagnoal

        while (m_stepX + m_stepY > 0.0f)
        {
            m_speedModX = Random.Range(0.0f, m_stepX);
            m_speedModY = Random.Range(0.0f, m_stepY);

            if (m_direction == eDirection.dirHorizontal && m_speedModX < m_stepX / 4.0f)
            {
                m_direction = eDirection.dirStationary;
            }
            else if (m_direction == eDirection.dirVertical && m_speedModY < m_stepY / 4.0f)
            {
                m_direction = eDirection.dirStationary;
            }
            else if (m_direction == eDirection.dirStationary)
            {
                if (bVertical && m_speedModY >= m_stepY / 4.0f)
                    m_direction = eDirection.dirVertical;
                else if (!bVertical && m_speedModX >= m_stepY / 4.0f)
                    m_direction = eDirection.dirHorizontal;

            }

            float wait = m_checkEverySecond + m_speedModX + m_speedModY;
            yield return new WaitForSeconds(wait);
        }
    }
コード例 #46
0
ファイル: Constants.cs プロジェクト: ltloibrights/AsyncRPG
        public static float GetAngleForDirection(eDirection direction)
        {
            float angle = 0;

            switch (direction)
            {
                case eDirection.right:
                    angle = 0.0f;
                    break;
                case eDirection.up:
                    angle = 270.0f;
                    break;
                case eDirection.left:
                    angle = 180.0f;
                    break;
                case eDirection.down:
                case eDirection.none:
                    angle = 90.0f;
                    break;
            }

            return angle;
        }
コード例 #47
0
ファイル: PlatformMover.cs プロジェクト: spmkd/2DGame
 public void SetDiagonal()
 {
     m_direction = eDirection.dirDiagnoal;
 }
コード例 #48
0
        public void ShouldReverseCanvas(eDirection direction)
        {
            //Given
            PaintingMediator paint = new PaintingMediator();
            CanvasBackService canvasService = new CanvasBackService();
            Canvas canvasNode = new Canvas();

            canvasService.SetCanvas(canvasNode);
            paint.SetCanvasService(canvasService);

            //When
            paint.Reverse(direction);

            //Then
            ScaleTransform expectedTransform = new ScaleTransform();
            if (direction.Equals(eDirection.Horizontal))
                expectedTransform.ScaleY = -1;
            else if (direction.Equals(eDirection.Vertical))
                expectedTransform.ScaleX = -1;

            Assert.AreEqual(expectedTransform.Value, canvasNode.RenderTransform.Value);
        }
コード例 #49
0
ファイル: AINode.cs プロジェクト: chulanbetra/PixelTest
 public AINode GetNeighbor(eDirection dir)
 {
     return Neighbors[(int)dir];
 }
 public static bool SetPhysicalComponentValueInDirection(this IComponentSection section, IComponent component, eDirection direction)
 {
     var field = section.GetPhysicalComponentInfoInDirection(direction);
       return section.TrySetComponent(field, component);
 }
 public static IComponent GetPhysicalComponentValueInDirection(this IComponentSection section, eDirection direction)
 {
     var field = section.GetPhysicalComponentInfoInDirection(direction);
       return section.GetComponent(field);
 }
コード例 #52
0
ファイル: PlatformMover.cs プロジェクト: spmkd/2DGame
 public void SetVertical()
 {
     m_direction = eDirection.dirVertical;
 }
コード例 #53
0
ファイル: ucMoveNavigator.cs プロジェクト: infobook/Tools4
 public EvA_MoveNavigator(eDirection aDirection, int aPos)
 {
     _dir = aDirection;
     _pos = aPos;
 }
コード例 #54
0
ファイル: ucMoveNavigator.cs プロジェクト: infobook/Tools4
 public EvA_MoveNavigator(eDirection aDirection)
     : this(aDirection, 0)
 {
 }
コード例 #55
0
ファイル: AINode.cs プロジェクト: chulanbetra/PixelTest
 public void SetNeighbor(eDirection dir, AINode aiNode)
 {
     Neighbors[(int)dir] = aiNode;
 }
コード例 #56
0
ファイル: PlatformMover.cs プロジェクト: spmkd/2DGame
 public void SetStationary()
 {
     m_direction = eDirection.dirStationary;
 }
コード例 #57
0
ファイル: ExcelBarChart.cs プロジェクト: huoxudong125/EPPlus
 private string GetDirectionText(eDirection direction)
 {
     switch (direction)
     {
         case eDirection.Bar:
             return "bar";
         default:
             return "col";
     }
 }
コード例 #58
0
ファイル: PlatformMover.cs プロジェクト: spmkd/2DGame
 public void SetHorizontal()
 {
     m_direction = eDirection.dirHorizontal;
 }
コード例 #59
0
	private int UpdateId(int id, eDirection direction)
	{
		switch(direction)
		{
			case eDirection.Up:
				id += (id >= 1 && id <= gridSize) ? (gridSize*(gridSize-1)) : -gridSize;
				break;

			case eDirection.Down:
				int offset = gridSize*(gridSize-1);
				id += (id >= offset+1 && id <= gridSize+offset) ? -offset : gridSize;
				break;

			case eDirection.Left:
				id += (id % gridSize == 1) ? (gridSize-1) : -1;
				break;

			case eDirection.Right:
				id += (id % gridSize == 0) ? -(gridSize-1) : 1;
				break;
		}

		return id;
	}
コード例 #60
0
 public RotateAnimator(int i_RoundsPerLength, eDirection i_Direction, TimeSpan i_AnimationLength)
     : base("RotateAnimator", i_AnimationLength)
 {
     m_AngularVelocityDirection = (int)i_Direction;
     k_AngularVelocity = (float)MathHelper.Pi * (float)i_RoundsPerLength;
 }